[Intel-gfx] [RFC][PATCH] drm/i915: Make data/link N value power of two

Jesse Barnes jbarnes at virtuousgeek.org
Tue Apr 23 22:07:31 CEST 2013


On Mon, 22 Apr 2013 17:23:50 +0300
ville.syrjala at linux.intel.com wrote:

> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
> 
> The BIOS uses power of two values for the data/link N value.
> 
> Follow suit to make the Zotac DP to dual-HDMI dongle work.
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=49402
> Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
> ---
> Warning: I've only tested this with the Zotac dongle hooked to my 1080p
> Samsumg telly. Whether or not it works with other displays is an open
> question.
> 
>  drivers/gpu/drm/i915/intel_display.c | 23 +++++++++++++++++------
>  1 file changed, 17 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 74156e2..fea9c99 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -4151,18 +4151,29 @@ intel_reduce_ratio(uint32_t *num, uint32_t *den)
>  	}
>  }
>  
> +static void compute_m_n(int m, int n, uint32_t *ret_m, uint32_t *ret_n)
> +{
> +	if (n >= 1 << 23)
> +		*ret_n = 1 << 23;
> +	else
> +		*ret_n = roundup_pow_of_two(n);
> +	*ret_m = div_u64((uint64_t) m * *ret_n, n);
> +	intel_reduce_ratio(ret_m, ret_n);
> +}
> +
>  void
>  intel_link_compute_m_n(int bits_per_pixel, int nlanes,
>  		       int pixel_clock, int link_clock,
>  		       struct intel_link_m_n *m_n)
>  {
>  	m_n->tu = 64;
> -	m_n->gmch_m = bits_per_pixel * pixel_clock;
> -	m_n->gmch_n = link_clock * nlanes * 8;
> -	intel_reduce_ratio(&m_n->gmch_m, &m_n->gmch_n);
> -	m_n->link_m = pixel_clock;
> -	m_n->link_n = link_clock;
> -	intel_reduce_ratio(&m_n->link_m, &m_n->link_n);
> +
> +	compute_m_n(bits_per_pixel * pixel_clock,
> +		    link_clock * nlanes * 8,
> +		    &m_n->gmch_m, &m_n->gmch_n);
> +
> +	compute_m_n(pixel_clock, link_clock,
> +		    &m_n->link_m, &m_n->link_n);
>  }
>  
>  static inline bool intel_panel_use_ssc(struct drm_i915_private *dev_priv)

You can add my Tested-by: to this one, it seems to fix
https://bugs.freedesktop.org/show_bug.cgi?id=59810 as well.

Art, is this something we've just missed and should have been doing all
along?

Thanks,
-- 
Jesse Barnes, Intel Open Source Technology Center



More information about the Intel-gfx mailing list