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

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

 



On Mon, Apr 22, 2013 at 05:23:50PM +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>

Since it took me a while to fire up my brain and understand the magic
values ... can we please have some #defines for the magic 23 = 24 -1 and
the magic 0xffffff = 1 << (24) - 1 ?

Also maybe call intel_reduce_ratio intel_reduce_m_n_ratio or so while at
it.

> ---
> 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.

It's pretty early for 3.10, so I think we can just stick this into -fixes
and see what happens.
-Daniel

> 
>  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)
> -- 
> 1.8.1.5
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


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