aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/files/0604-drm-amd-dal-Fix-regamma-code-path.patch
blob: 6a99bbf128591e201eb437e10e1d4a2e9d61434c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
From dffc4ee3af58eb1f31ade966ec57232a27b4d653 Mon Sep 17 00:00:00 2001
From: Krunoslav Kovac <Krunoslav.Kovac@amd.com>
Date: Wed, 9 Dec 2015 11:19:01 -0500
Subject: [PATCH 0604/1110] drm/amd/dal: Fix regamma code path

[Description] Fix the logic in dal3 for enabling regamma, so that regamma can be applied correctly.

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Acked-by: Harry Wentland<harry.wentland@amd.com>
---
 drivers/gpu/drm/amd/dal/dc/core/dc_target.c        |  6 +-
 .../gpu/drm/amd/dal/dc/dce110/dce110_opp_regamma.c | 64 +++++++++++-----------
 2 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/drivers/gpu/drm/amd/dal/dc/core/dc_target.c b/drivers/gpu/drm/amd/dal/dc/core/dc_target.c
index 6e89050..9ae98c5 100644
--- a/drivers/gpu/drm/amd/dal/dc/core/dc_target.c
+++ b/drivers/gpu/drm/amd/dal/dc/core/dc_target.c
@@ -142,7 +142,7 @@ static void build_gamma_params(
 	gamma_param->regamma_adjust_type = GRAPHICS_REGAMMA_ADJUST_SW;
 	gamma_param->degamma_adjust_type = GRAPHICS_REGAMMA_ADJUST_SW;
 
-	gamma_param->selected_gamma_lut = GRAPHICS_GAMMA_LUT_LEGACY;
+	gamma_param->selected_gamma_lut = GRAPHICS_GAMMA_LUT_REGAMMA;
 
 	/* TODO support non-legacy gamma */
 	gamma_param->disable_adjustments = false;
@@ -151,8 +151,8 @@ static void build_gamma_params(
 	gamma_param->flag.bits.gamma_update = 1;
 
 	/* Set regamma */
-	gamma_param->regamma.features.bits.GRAPHICS_DEGAMMA_SRGB = 0;
-	gamma_param->regamma.features.bits.OVERLAY_DEGAMMA_SRGB = 0;
+	gamma_param->regamma.features.bits.GRAPHICS_DEGAMMA_SRGB = 1;
+	gamma_param->regamma.features.bits.OVERLAY_DEGAMMA_SRGB = 1;
 	gamma_param->regamma.features.bits.GAMMA_RAMP_ARRAY = 0;
 	gamma_param->regamma.features.bits.APPLY_DEGAMMA = 0;
 
diff --git a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_opp_regamma.c b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_opp_regamma.c
index 4cba172..cf116f1 100644
--- a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_opp_regamma.c
+++ b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_opp_regamma.c
@@ -1027,42 +1027,42 @@ static bool build_regamma_curve(
 
 	uint32_t i;
 
-	if (!params->regamma.features.bits.GAMMA_RAMP_ARRAY &&
-		params->regamma.features.bits.APPLY_DEGAMMA) {
-		struct gamma_coefficients coeff;
+	struct gamma_coefficients coeff;
 
-		struct hw_x_point *coord_x =
-				opp110->regamma.coordinates_x;
+	struct hw_x_point *coord_x =
+		opp110->regamma.coordinates_x;
 
-		build_regamma_coefficients(
-			&params->regamma,
-			params->regamma.features.bits.GRAPHICS_DEGAMMA_SRGB,
-			&coeff);
-
-		/* Use opp110->regamma.coordinates_x to retrieve
-		 * coordinates chosen base on given user curve (future task).
-		 * The x values are exponentially distributed and currently
-		 * it is hard-coded, the user curve shape is ignored.
-		 * The future task is to recalculate opp110-
-		 * regamma.coordinates_x based on input/user curve,
-		 * translation from 256/1025 to 128 pwl points.
-		 */
+	build_regamma_coefficients(
+		&params->regamma,
+		params->regamma.features.bits.GRAPHICS_DEGAMMA_SRGB,
+		&coeff);
 
-		i = 0;
+	/* Use opp110->regamma.coordinates_x to retrieve
+	 * coordinates chosen base on given user curve (future task).
+	 * The x values are exponentially distributed and currently
+	 * it is hard-coded, the user curve shape is ignored.
+	 * The future task is to recalculate opp110-
+	 * regamma.coordinates_x based on input/user curve,
+	 * translation from 256/1025 to 128 pwl points.
+	 */
 
-		while (i != opp110->regamma.hw_points_num + 1) {
-			rgb->r = translate_from_linear_space_ex(
-				coord_x->adjusted_x, &coeff, 0);
-			rgb->g = translate_from_linear_space_ex(
-				coord_x->adjusted_x, &coeff, 1);
-			rgb->b = translate_from_linear_space_ex(
-				coord_x->adjusted_x, &coeff, 2);
-
-			++coord_x;
-			++rgb;
-			++i;
-		}
-	} else {
+	i = 0;
+
+	while (i != opp110->regamma.hw_points_num + 1) {
+		rgb->r = translate_from_linear_space_ex(
+			coord_x->adjusted_x, &coeff, 0);
+		rgb->g = translate_from_linear_space_ex(
+			coord_x->adjusted_x, &coeff, 1);
+		rgb->b = translate_from_linear_space_ex(
+			coord_x->adjusted_x, &coeff, 2);
+
+		++coord_x;
+		++rgb;
+		++i;
+	}
+
+	if (params->regamma.features.bits.GAMMA_RAMP_ARRAY &&
+			!params->regamma.features.bits.APPLY_DEGAMMA) {
 		const uint32_t max_entries =
 			RGB_256X3X16 + opp110->regamma.extra_points - 1;
 
-- 
2.7.4