[PATCH 5/6] drm/amd/display: fix gamma for dpms usecase

Harry Wentland harry.wentland at amd.com
Wed Jan 4 21:30:51 UTC 2017


From: Roman Li <Roman.Li at amd.com>

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

Change-Id: Ic9bade55ef72e16222569d4e3a18bab610a4b011
Signed-off-by: Roman Li <Roman.Li at amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng at amd.com>
Acked-by: Harry Wentland <Harry.Wentland at 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 fd03e4f7231b..439dde24e792 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
@@ -513,7 +513,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;
@@ -534,16 +533,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(
@@ -554,6 +543,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(
@@ -562,6 +552,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.9.3



More information about the amd-gfx mailing list