From: Lionel Landwerlin Subject: Re: [PATCH v2 6/9] drm/i915: expose command stream timestamp frequency to userspace Date: Thu, 9 Nov 2017 14:13:03 +0000 Message-ID: <1f1133de-734f-487e-6b66-779837c51594@intel.com> References: <20171102162949.22221-1-lionel.g.landwerlin@intel.com> <20171102162949.22221-7-lionel.g.landwerlin@intel.com> <3e18b118-09a9-0401-f592-fd6b586d483c@intel.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1994916529==" Return-path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1C6196E21E for ; Thu, 9 Nov 2017 14:13:04 +0000 (UTC) In-Reply-To: Content-Language: en-US List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Sagar Arun Kamble , intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org This is a multi-part message in MIME format. --===============1994916529== Content-Type: multipart/alternative; boundary="------------6380A5A68C563DE0D7450E98" Content-Language: en-US This is a multi-part message in MIME format. --------------6380A5A68C563DE0D7450E98 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 09/11/17 14:06, Lionel Landwerlin wrote: >> >> +    } else if (INTEL_GEN(dev_priv) <= 9) { >> +        u32 ctc_reg = I915_READ(GEN8_CTC_MODE); >> +        u64 freq = 0; >> + >> +        if ((ctc_reg & GEN8_CTC_SOURCE_PARAMETER_MASK) == >> GEN8_CTC_SOURCE_DIVIDE_LOGIC) >> +            freq = read_timestamp_frequency_from_divide(dev_priv); >> +        else >> +            freq = IS_GEN9_LP(dev_priv) ? 19200000 : 24000000; >> + >> +        /* Now figure out how the command stream's timestamp register >> +         * increments from this frequency (it might increment only >> +         * every few clock cycle). >> +         */ >> +        freq >>= 3 - ((ctc_reg & GEN8_CTC_SHIFT_PARAMETER_MASK) >> >> +                  GEN8_CTC_SHIFT_PARAMETER_SHIFT); > Gen8 documentation is indeed fuzzy. Are we getting 12.5mhz after this > shift as doc says it to have 80ns base. Forgot to answer that point. Let me check this on BDW again. But yes, the idea is that we should get 12.5MHz on BDW. --------------6380A5A68C563DE0D7450E98 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit
On 09/11/17 14:06, Lionel Landwerlin wrote:

+    } else if (INTEL_GEN(dev_priv) <= 9) {
+        u32 ctc_reg = I915_READ(GEN8_CTC_MODE);
+        u64 freq = 0;
+
+        if ((ctc_reg & GEN8_CTC_SOURCE_PARAMETER_MASK) == GEN8_CTC_SOURCE_DIVIDE_LOGIC)
+            freq = read_timestamp_frequency_from_divide(dev_priv);
+        else
+            freq = IS_GEN9_LP(dev_priv) ? 19200000 : 24000000;
+
+        /* Now figure out how the command stream's timestamp register
+         * increments from this frequency (it might increment only
+         * every few clock cycle).
+         */
+        freq >>= 3 - ((ctc_reg & GEN8_CTC_SHIFT_PARAMETER_MASK) >>
+                  GEN8_CTC_SHIFT_PARAMETER_SHIFT);
Gen8 documentation is indeed fuzzy. Are we getting 12.5mhz after this shift as doc says it to have 80ns base.
Forgot to answer that point. Let me check this on BDW again.
But yes, the idea is that we should get 12.5MHz on BDW.
--------------6380A5A68C563DE0D7450E98-- --===============1994916529== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KSW50ZWwtZ2Z4 IG1haWxpbmcgbGlzdApJbnRlbC1nZnhAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vaW50ZWwtZ2Z4Cg== --===============1994916529==--