Patch "drm/amd/display: Limit user regamma to a valid value" has been added to the 4.19-stable tree

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

 



This is a note to let you know that I've just added the patch titled

    drm/amd/display: Limit user regamma to a valid value

to the 4.19-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     drm-amd-display-limit-user-regamma-to-a-valid-value.patch
and it can be found in the queue-4.19 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 692d5c83e8db0d714083d508a62a92648ed8c1d5
Author: Yao Wang1 <Yao.Wang1@xxxxxxx>
Date:   Mon Aug 22 18:30:31 2022 +0800

    drm/amd/display: Limit user regamma to a valid value
    
    [ Upstream commit 3601d620f22e37740cf73f8278eabf9f2aa19eb7 ]
    
    [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 <daniel.wheeler@xxxxxxx>
    Reviewed-by: Krunoslav Kovac <Krunoslav.Kovac@xxxxxxx>
    Reviewed-by: Aric Cyr <Aric.Cyr@xxxxxxx>
    Acked-by: Pavle Kotarac <Pavle.Kotarac@xxxxxxx>
    Signed-off-by: Yao Wang1 <Yao.Wang1@xxxxxxx>
    Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

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 11ea1a0e629b..4e866317ec25 100644
--- a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c
+++ b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c
@@ -1206,6 +1206,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 */
@@ -1234,6 +1235,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)



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux