From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH 2/4] drm/i915: Adjust LUT rounding rules
Date: Fri, 13 Oct 2023 16:14:00 +0300 [thread overview]
Message-ID: <20231013131402.24072-3-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20231013131402.24072-1-ville.syrjala@linux.intel.com>
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
drm_color_lut_extract() rounding was changed to follow the
OpenGL int<->float conversion rules. Adjust intel_color_lut_pack()
to match.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
drivers/gpu/drm/i915/display/intel_color.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_color.c b/drivers/gpu/drm/i915/display/intel_color.c
index 2a2a163ea652..b01f463af861 100644
--- a/drivers/gpu/drm/i915/display/intel_color.c
+++ b/drivers/gpu/drm/i915/display/intel_color.c
@@ -785,14 +785,12 @@ static void chv_assign_csc(struct intel_crtc_state *crtc_state)
/* convert hw value with given bit_precision to lut property val */
static u32 intel_color_lut_pack(u32 val, int bit_precision)
{
- u32 max = 0xffff >> (16 - bit_precision);
-
- val = clamp_val(val, 0, max);
-
- if (bit_precision < 16)
- val <<= 16 - bit_precision;
-
- return val;
+ if (bit_precision > 16)
+ return DIV_ROUND_CLOSEST_ULL(mul_u32_u32(val, (1 << 16) - 1),
+ (1 << bit_precision) - 1);
+ else
+ return DIV_ROUND_CLOSEST(val * ((1 << 16) - 1),
+ (1 << bit_precision) - 1);
}
static u32 i9xx_lut_8(const struct drm_color_lut *color)
--
2.41.0
next prev parent reply other threads:[~2023-10-13 13:14 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-13 13:13 [Intel-gfx] [PATCH 0/4] drm/i915: Fix LUT rounding Ville Syrjala
2023-10-13 13:13 ` [Intel-gfx] [PATCH 1/4] drm: Fix color " Ville Syrjala
2023-10-31 9:15 ` Jani Nikula
2023-10-31 16:06 ` Ville Syrjälä
2023-11-20 13:03 ` Borah, Chaitanya Kumar
2023-11-20 13:17 ` Borah, Chaitanya Kumar
2023-11-20 14:27 ` Ville Syrjälä
2023-10-13 13:14 ` Ville Syrjala [this message]
2023-11-20 6:08 ` [Intel-gfx] [PATCH 2/4] drm/i915: Adjust LUT rounding rules Borah, Chaitanya Kumar
2023-11-20 14:26 ` Ville Syrjälä
2023-11-21 6:15 ` Borah, Chaitanya Kumar
2023-10-13 13:14 ` [Intel-gfx] [PATCH 3/4] drm/i915: s/clamp()/min()/ in i965_lut_11p6_max_pack() Ville Syrjala
2023-11-03 4:39 ` Borah, Chaitanya Kumar
2023-10-13 13:14 ` [Intel-gfx] [PATCH 4/4] drm/i915: Fix glk+ degamma LUT conversions Ville Syrjala
2023-11-20 6:13 ` Borah, Chaitanya Kumar
2023-10-13 20:27 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Fix LUT rounding Patchwork
2023-10-13 20:27 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2023-10-13 20:41 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2023-10-15 1:55 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2023-11-13 17:37 ` [Intel-gfx] [PATCH 0/4] " Jani Nikula
2023-11-20 14:30 ` Ville Syrjälä
2023-11-21 10:51 ` Maxime Ripard
2023-11-23 17:35 ` Ville Syrjälä
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=20231013131402.24072-3-ville.syrjala@linux.intel.com \
--to=ville.syrjala@linux.intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox