aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/linux-yocto-4.14.71/4203-drm-amd-display-Fix-regamma-not-affecting-full-inten.patch
diff options
context:
space:
mode:
Diffstat (limited to 'common/recipes-kernel/linux/linux-yocto-4.14.71/4203-drm-amd-display-Fix-regamma-not-affecting-full-inten.patch')
-rw-r--r--common/recipes-kernel/linux/linux-yocto-4.14.71/4203-drm-amd-display-Fix-regamma-not-affecting-full-inten.patch66
1 files changed, 66 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/linux-yocto-4.14.71/4203-drm-amd-display-Fix-regamma-not-affecting-full-inten.patch b/common/recipes-kernel/linux/linux-yocto-4.14.71/4203-drm-amd-display-Fix-regamma-not-affecting-full-inten.patch
new file mode 100644
index 00000000..566a23ce
--- /dev/null
+++ b/common/recipes-kernel/linux/linux-yocto-4.14.71/4203-drm-amd-display-Fix-regamma-not-affecting-full-inten.patch
@@ -0,0 +1,66 @@
+From f6c8e652bc51d783469d2c7a59e014b9af0b2396 Mon Sep 17 00:00:00 2001
+From: "Leo (Sunpeng) Li" <sunpeng.li@amd.com>
+Date: Tue, 3 Apr 2018 16:07:16 -0400
+Subject: [PATCH 4203/5725] 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 <sunpeng.li@amd.com>
+Reviewed-by: Krunoslav Kovac <Krunoslav.Kovac@amd.com>
+Acked-by: Harry Wentland <harry.wentland@amd.com>
+---
+ drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
+index 5bed5a3..b95dd9f 100644
+--- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
++++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
+@@ -456,10 +456,13 @@ dce110_translate_regamma_to_hw_format(const struct dc_transfer_func *output_tf,
+
+ } else {
+ /* 10 segments
+- * segment is from 2^-10 to 2^0
++ * segment is from 2^-10 to 2^1
++ * We include an extra segment for range [2^0, 2^1). This is to
++ * ensure that colors with normalized values of 1 don't miss the
++ * LUT.
+ */
+ region_start = -10;
+- region_end = 0;
++ region_end = 1;
+
+ seg_distr[0] = 4;
+ seg_distr[1] = 4;
+@@ -471,7 +474,7 @@ dce110_translate_regamma_to_hw_format(const struct dc_transfer_func *output_tf,
+ seg_distr[7] = 4;
+ seg_distr[8] = 4;
+ seg_distr[9] = 4;
+- seg_distr[10] = -1;
++ seg_distr[10] = 0;
+ seg_distr[11] = -1;
+ seg_distr[12] = -1;
+ seg_distr[13] = -1;
+--
+2.7.4
+