From: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
Daniel Stone <daniels@collabora.com>,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm: fix lut value extraction function
Date: Mon, 18 Apr 2016 12:09:51 +0100 [thread overview]
Message-ID: <5714C07F.3050807@intel.com> (raw)
In-Reply-To: <1458655833-19547-1-git-send-email-lionel.g.landwerlin@intel.com>
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.
>
> Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
> Reported-by: Jani Nikula <jani.nikula@intel.com>
> Cc: Daniel Stone <daniels@collabora.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Matt Roper <matthew.d.roper@intel.com>
> Cc: dri-devel@lists.freedesktop.org
> 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);
> }
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-04-18 11:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-22 14:10 [PATCH] drm: fix lut value extraction function Lionel Landwerlin
2016-03-22 16:04 ` ✗ Fi.CI.BAT: warning for " Patchwork
2016-04-18 11:09 ` Lionel Landwerlin [this message]
2016-04-18 12:36 ` [PATCH] " Daniel Vetter
2016-04-18 14:40 ` Emil Velikov
2016-04-18 15:53 ` Daniel Vetter
2016-04-18 19:39 ` Emil Velikov
2016-04-20 10:52 ` Daniel Vetter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5714C07F.3050807@intel.com \
--to=lionel.g.landwerlin@intel.com \
--cc=daniel.vetter@ffwll.ch \
--cc=daniels@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.