[Intel-gfx] [PATCH 6/6] drm/i915: Use coarse grained residency counter with byt

Chris Wilson chris at chris-wilson.co.uk
Wed Mar 15 15:56:27 UTC 2017


On Wed, Mar 15, 2017 at 05:43:04PM +0200, Mika Kuoppala wrote:
> Set byt rc residency counters high level as chv does by
> default. We lose some accuracy on byt but we can do the calculation
> without extra hw read on both platforms, as now they behave
> identically in this respect.
> 
> v2: use ktime
> 
> Cc: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Ville Syrjälä <ville.syrjala at linux.intel.com>
> Signed-off-by: Mika Kuoppala <mika.kuoppala at intel.com>
> ---
>  drivers/gpu/drm/i915/i915_irq.c | 9 ++-------
>  drivers/gpu/drm/i915/intel_pm.c | 9 +++------
>  2 files changed, 5 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> index f73d8db..7fb35a5 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -1100,11 +1100,6 @@ static u32 vlv_wa_c0_ei(struct drm_i915_private *dev_priv, u32 pm_iir)
>  	if (prev->ktime) {
>  		u64 time, c0;
>  		u32 render, media;
> -		unsigned int mul;
> -
> -		mul = 1000 * 100; /* scale to threshold% */
> -		if (I915_READ(VLV_COUNTER_CONTROL) & VLV_COUNT_RANGE_HIGH)
> -			mul <<= 8;
>  
>  		time = ktime_us_delta(now.ktime, prev->ktime);
>  		time *= dev_priv->czclk_freq;
> @@ -1116,8 +1111,8 @@ static u32 vlv_wa_c0_ei(struct drm_i915_private *dev_priv, u32 pm_iir)
>  		 */
>  		render = now.render_c0 - prev->render_c0;
>  		media = now.media_c0 - prev->media_c0;
> -		c0 = max(render, media);
> -		c0 *= mul;
> +		c0 = max_t(u64, render, media) << 8; /* upper part of 40 bit */

Keep the comparison at u32, do the promotion afterwards, be kind to
32bit machines, i.e.  c0 *= 1000 * 100 << 8; as before

With that
Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list