Re: [PATCH] drm: fix lut value extraction function

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

 



On Mon, Apr 18, 2016 at 12:09:51PM +0100, Lionel Landwerlin wrote:
> Ping?
> 
> On 22/03/16 14:10, Lionel Landwerlin wrote:
> >When extracting the value at full precision (16 bits), no need to
> >round the value.
> >
> >This was spotted by Jani when running sparse. Unfortunately this fix
> >doesn't get rid of the warning.

It sounded like no bug, and the patch itself fails to appease sparse. And
I didn't check what's upsetting sparse itself, so figured "nothing to do
here until a real fix shows up".

Should I do something here?
-Daniel

> >
> >Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@xxxxxxxxx>
> >Reported-by: Jani Nikula <jani.nikula@xxxxxxxxx>
> >Cc: Daniel Stone <daniels@xxxxxxxxxxxxx>
> >Cc: Daniel Vetter <daniel.vetter@xxxxxxxx>
> >Cc: Matt Roper <matthew.d.roper@xxxxxxxxx>
> >Cc: dri-devel@xxxxxxxxxxxxxxxxxxxxx
> >Fixes: 5488dc16fde7 ("drm: introduce pipe color correction properties")
> >---
> >  include/drm/drm_crtc.h | 8 ++++++--
> >  1 file changed, 6 insertions(+), 2 deletions(-)
> >
> >diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> >index e0170bf..da63b4d 100644
> >--- a/include/drm/drm_crtc.h
> >+++ b/include/drm/drm_crtc.h
> >@@ -2600,10 +2600,14 @@ static inline struct drm_property *drm_property_find(struct drm_device *dev,
> >  static inline uint32_t drm_color_lut_extract(uint32_t user_input,
> >  					     uint32_t bit_precision)
> >  {
> >-	uint32_t val = user_input + (1 << (16 - bit_precision - 1));
> >+	uint32_t val = user_input;
> >  	uint32_t max = 0xffff >> (16 - bit_precision);
> >-	val >>= 16 - bit_precision;
> >+	/* Round only if we're not using full precision. */
> >+	if (bit_precision < 16) {
> >+		val += 1UL << (16 - bit_precision - 1);
> >+		val >>= 16 - bit_precision;
> >+	}
> >  	return clamp_val(val, 0, max);
> >  }
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux