Re: [PATCH] [v3] drm/i915: Clean up the ring scaling calculations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 02, 2013 at 09:25:02AM -0700, Ben Widawsky wrote:
> This patch attempts to clean up the ring/IA scaling programming in the
> following ways.
> 1. Fix the comment about the DDR frequency. The math is 266MHz, not
> 133MHz. Formula was right, docs are wrong.

Confirmed by inspection, units are 266MHz.

> 2. Mask the DCLK register since I don't know how it is defined on future
> platforms.
> 
> 3. use mult_frac instead of magic math.
> 
> This helps for future platform enabling.
> 
> v2: Actually use the right patch. The v1 was a mix of things, none of
> which was right. Note that due to rounding, we actually get different
> values (slightly higher) for the effective ring frequency.
> 
> v3: Use 1.25 instead of 1.33 as the original code did. (Jesse)
> 
> CC: Jesse Barnes <jbarnes@xxxxxxxxxxxxxxxx>
> CC: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
> Signed-off-by: Ben Widawsky <ben@xxxxxxxxxxxx>
> ---
>  drivers/gpu/drm/i915/intel_pm.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index 698257c..9753bd9 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -3663,9 +3663,9 @@ void gen6_update_ring_freq(struct drm_device *dev)
>  	/* Convert from kHz to MHz */
>  	max_ia_freq /= 1000;
>  
> -	min_ring_freq = I915_READ(MCHBAR_MIRROR_BASE_SNB + DCLK);
> -	/* convert DDR frequency from units of 133.3MHz to bandwidth */
> -	min_ring_freq = (2 * 4 * min_ring_freq + 2) / 3;
> +	min_ring_freq = I915_READ(MCHBAR_MIRROR_BASE_SNB + DCLK) & 0xf;
> +	/* convert DDR frequency from units of 266.6MHz to bandwidth */
> +	min_ring_freq = mult_frac(min_ring_freq, 8, 3);

mult_frac() does not round upwards, so that will be a potential, but
small, difference.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux