aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/0117-drm-amd-display-fix-gamma-for-dpms-usecase.patch
blob: 28595ba605f07323e01c6b3089e2ebb9e02ffe84 (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
From bf4f7579d5277cfc5425ba9675f490c02ea39ea9 Mon Sep 17 00:00:00 2001
From: Roman Li <Roman.Li@amd.com>
Date: Tue, 3 Jan 2017 13:46:45 -0500
Subject: [PATCH 0117/4131] drm/amd/display: fix gamma for dpms usecase

For dpms usecase we need to set surface transfer function
regardless of gamma set flag.

Signed-off-by: Roman Li <Roman.Li@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c    | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
index 66c72ca..ad29ef7 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
@@ -514,7 +514,6 @@ static void fill_gamma_from_crtc(
 {
 	int i;
 	struct dc_gamma *gamma;
-	struct dc_transfer_func *input_tf;
 	uint16_t *red, *green, *blue;
 	int end = (crtc->gamma_size > NUM_OF_RAW_GAMMA_RAMP_RGB_256) ?
 			NUM_OF_RAW_GAMMA_RAMP_RGB_256 : crtc->gamma_size;
@@ -535,16 +534,6 @@ static void fill_gamma_from_crtc(
 	}
 
 	dc_surface->gamma_correction = gamma;
-
-	input_tf = dc_create_transfer_func();
-
-	if (input_tf == NULL)
-		return;
-
-	input_tf->type = TF_TYPE_PREDEFINED;
-	input_tf->tf = TRANSFER_FUNCTION_SRGB;
-
-	dc_surface->in_transfer_func = input_tf;
 }
 
 static void fill_plane_attributes(
@@ -555,6 +544,7 @@ static void fill_plane_attributes(
 	const struct amdgpu_framebuffer *amdgpu_fb =
 		to_amdgpu_framebuffer(state->fb);
 	const struct drm_crtc *crtc = state->crtc;
+	struct dc_transfer_func *input_tf;
 
 	fill_rects_from_plane_state(state, surface);
 	fill_plane_attributes_from_fb(
@@ -563,6 +553,16 @@ static void fill_plane_attributes(
 		amdgpu_fb,
 		addrReq);
 
+	input_tf = dc_create_transfer_func();
+
+	if (input_tf == NULL)
+		return;
+
+	input_tf->type = TF_TYPE_PREDEFINED;
+	input_tf->tf = TRANSFER_FUNCTION_SRGB;
+
+	surface->in_transfer_func = input_tf;
+
 	/* In case of gamma set, update gamma value */
 	if (crtc->mode.private_flags &
 		AMDGPU_CRTC_MODE_PRIVATE_FLAGS_GAMMASET) {
-- 
2.7.4