Skip to content

Commit 3601d62

Browse files
Yao Wang1alexdeucher
authored andcommitted
drm/amd/display: Limit user regamma to a valid value
[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. Tested-by: Daniel Wheeler <[email protected]> Reviewed-by: Krunoslav Kovac <[email protected]> Reviewed-by: Aric Cyr <[email protected]> Acked-by: Pavle Kotarac <[email protected]> Signed-off-by: Yao Wang1 <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent ceb7560 commit 3601d62

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/gpu/drm/amd/display/modules/color/color_gamma.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1600,6 +1600,7 @@ static void interpolate_user_regamma(uint32_t hw_points_num,
16001600
struct fixed31_32 lut2;
16011601
struct fixed31_32 delta_lut;
16021602
struct fixed31_32 delta_index;
1603+
const struct fixed31_32 one = dc_fixpt_from_int(1);
16031604

16041605
i = 0;
16051606
/* fixed_pt library has problems handling too small values */
@@ -1628,6 +1629,9 @@ static void interpolate_user_regamma(uint32_t hw_points_num,
16281629
} else
16291630
hw_x = coordinates_x[i].x;
16301631

1632+
if (dc_fixpt_le(one, hw_x))
1633+
hw_x = one;
1634+
16311635
norm_x = dc_fixpt_mul(norm_factor, hw_x);
16321636
index = dc_fixpt_floor(norm_x);
16331637
if (index < 0 || index > 255)

0 commit comments

Comments
 (0)