Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amd/display: fix wrong color value mapping on MCM shaper LUT

Some shimmer/colorful points appears when using the steamOS color
pipeline for HDR on gaming with DCN32. These points look like black
values being wrongly mapped to red/blue/green values. It was caused
because the number of hw points in regular LUTs and in a shaper LUT was
treated as the same.

DCN3+ regular LUTs have 257 bases and implicit deltas (i.e. HW
calculates them), but shaper LUT is a special case: it has 256 bases and
256 deltas, as in DCN1-2 regular LUTs, and outputs 14-bit values.

Fix that by setting by decreasing in 1 the number of HW points computed
in the LUT segmentation so that shaper LUT (i.e. fixpoint == true) keeps
the same DCN10 CM logic and regular LUTs go with `hw_points + 1`.

CC: Krunoslav Kovac <Krunoslav.Kovac@amd.com>
Fixes: 4d5fd3d08ea9 ("drm/amd/display: PQ tail accuracy")
Signed-off-by: Melissa Wen <mwen@igalia.com>
Reviewed-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 5006505b19a2119e71c008044d59f6d753c858b9)

authored by

Melissa Wen and committed by
Alex Deucher
8f959d37 243b467d

+5 -2
+5 -2
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_cm_common.c
··· 163 163 hw_points += (1 << seg_distr[k]); 164 164 } 165 165 166 + // DCN3+ have 257 pts in lieu of no separate slope registers 167 + // Prior HW had 256 base+slope pairs 168 + // Shaper LUT (i.e. fixpoint == true) is still 256 bases and 256 deltas 169 + hw_points = fixpoint ? (hw_points - 1) : hw_points; 170 + 166 171 j = 0; 167 172 for (k = 0; k < (region_end - region_start); k++) { 168 173 increment = NUMBER_SW_SEGMENTS / (1 << seg_distr[k]); ··· 228 223 corner_points[1].green.slope = dc_fixpt_zero; 229 224 corner_points[1].blue.slope = dc_fixpt_zero; 230 225 231 - // DCN3+ have 257 pts in lieu of no separate slope registers 232 - // Prior HW had 256 base+slope pairs 233 226 lut_params->hw_points_num = hw_points + 1; 234 227 235 228 k = 0;