Skip to content

Commit b2f3f59

Browse files
leo-sunli1alexdeucher
authored andcommitted
drm/amd/display: Fix regamma not affecting full-intensity color values
Hardware understands the regamma LUT as a piecewise linear function, with points spaced exponentially along the range. We previously programmed the LUT for range [2^-10, 2^0). This causes (normalized) color values of 1 (=2^0) to miss the programmed LUT, and fall onto the end region. For DCE, the end region is extrapolated using a single (base, slope) pair, using the max y-value from the last point in the curve as base. This presents a problem, since this value affects all three color channels. Scaling down the intensity of say - the blue regamma curve - will not affect it's end region. This is especially noticiable when using RedShift. It scales down the blue and green channels, but leaves full-intensity colors unshifted. Therefore, extend the range to cover [2^-10, 2^1) by programming another hardware segment, containing only one point. That way, we won't be hitting the end region. Note that things are a bit different for DCN, since the end region can be set per-channel. Signed-off-by: Leo (Sunpeng) Li <[email protected]> Reviewed-by: Krunoslav Kovac <[email protected]> Acked-by: Harry Wentland <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 1409bc6 commit b2f3f59

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -453,10 +453,13 @@ dce110_translate_regamma_to_hw_format(const struct dc_transfer_func *output_tf,
453453

454454
} else {
455455
/* 10 segments
456-
* segment is from 2^-10 to 2^0
456+
* segment is from 2^-10 to 2^1
457+
* We include an extra segment for range [2^0, 2^1). This is to
458+
* ensure that colors with normalized values of 1 don't miss the
459+
* LUT.
457460
*/
458461
region_start = -10;
459-
region_end = 0;
462+
region_end = 1;
460463

461464
seg_distr[0] = 4;
462465
seg_distr[1] = 4;
@@ -468,7 +471,7 @@ dce110_translate_regamma_to_hw_format(const struct dc_transfer_func *output_tf,
468471
seg_distr[7] = 4;
469472
seg_distr[8] = 4;
470473
seg_distr[9] = 4;
471-
seg_distr[10] = -1;
474+
seg_distr[10] = 0;
472475
seg_distr[11] = -1;
473476
seg_distr[12] = -1;
474477
seg_distr[13] = -1;

0 commit comments

Comments
 (0)