[PATCH 15/21] drm/amd/display: Limit user regamma to a valid value
Pavle Kotarac
pavle.kotarac at amd.com
Wed Sep 7 18:11:54 UTC 2022
From: Yao Wang1 <Yao.Wang1 at amd.com>
[Why]
For HDR mode, we get total 512 tf_point and after
switching to SDR mode we actually get 400 tf_point
and the rest of points(401~512) still use dirty
value from HDR mode. We should limit the rest of
the points to max value.
[How]
Limit the value when coordinates_x.x > 1, just like
what we do in translate_from_linear_space for other
re-gamma build paths.
Reviewed-by: Krunoslav Kovac <Krunoslav.Kovac at amd.com>
Reviewed-by: Krunoslav Kovac <Krunoslav.Kovac at amd.com>
Reviewed-by: Aric Cyr <Aric.Cyr at amd.com>
Acked-by: Pavle Kotarac <Pavle.Kotarac at amd.com>
Signed-off-by: Yao Wang1 <Yao.Wang1 at amd.com>
---
drivers/gpu/drm/amd/display/modules/color/color_gamma.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c
index 859ffd8725c5..04f7656906ca 100644
--- a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c
+++ b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c
@@ -1600,6 +1600,7 @@ static void interpolate_user_regamma(uint32_t hw_points_num,
struct fixed31_32 lut2;
struct fixed31_32 delta_lut;
struct fixed31_32 delta_index;
+ const struct fixed31_32 one = dc_fixpt_from_int(1);
i = 0;
/* fixed_pt library has problems handling too small values */
@@ -1628,6 +1629,9 @@ static void interpolate_user_regamma(uint32_t hw_points_num,
} else
hw_x = coordinates_x[i].x;
+ if (dc_fixpt_le(one, hw_x))
+ hw_x = one;
+
norm_x = dc_fixpt_mul(norm_factor, hw_x);
index = dc_fixpt_floor(norm_x);
if (index < 0 || index > 255)
--
2.34.1
More information about the amd-gfx
mailing list