From: Lionel Landwerlin Subject: Re: [PATCH v2 6/9] drm/i915: expose command stream timestamp frequency to userspace Date: Thu, 9 Nov 2017 17:44:45 +0000 Message-ID: <69c918c1-c6d2-98ad-8e88-b814e0d2c5af@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> <1f1133de-734f-487e-6b66-779837c51594@intel.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0432751709==" Return-path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTPS id D95426E95E for ; Thu, 9 Nov 2017 17:44:46 +0000 (UTC) In-Reply-To: <1f1133de-734f-487e-6b66-779837c51594@intel.com> 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. --===============0432751709== Content-Type: multipart/alternative; boundary="------------C3CECDFB94CFA64F0AF69E75" Content-Language: en-US This is a multi-part message in MIME format. --------------C3CECDFB94CFA64F0AF69E75 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 09/11/17 14:13, Lionel Landwerlin wrote: > 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. Okay, looks like that's wrong on my BDW system.... So this bit of right shift should probably only be applied to the else case (i.e. gen9) - Lionel --------------C3CECDFB94CFA64F0AF69E75 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit
On 09/11/17 14:13, Lionel Landwerlin wrote:
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.

Okay, looks like that's wrong on my BDW system....
So this bit of right shift should probably only be applied to the else case (i.e. gen9)

-
Lionel
--------------C3CECDFB94CFA64F0AF69E75-- --===============0432751709== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KSW50ZWwtZ2Z4 IG1haWxpbmcgbGlzdApJbnRlbC1nZnhAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vaW50ZWwtZ2Z4Cg== --===============0432751709==--