[PATCH 424/459] drm/amd/display: Integrate color transform3x4 with 3dlut tm

Alex Deucher alexdeucher at gmail.com
Mon Jun 17 19:49:13 UTC 2019


From: Vitaly Prosyak <vitaly.prosyak at amd.com>

[Why & How]
Reuse existent code path (dcn1+) and in order to do that apply de gamma
in 1D blender LUT and re use MPC OGAM.
Follow up is required.

Signed-off-by: Vitaly Prosyak <vitaly.prosyak at amd.com>
Reviewed-by: Aric Cyr <Aric.Cyr at amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha at amd.com>
Acked-by: Krunoslav Kovac <Krunoslav.Kovac at amd.com>
Acked-by: Vitaly Prosyak <Vitaly.Prosyak at amd.com>
Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
---
 drivers/gpu/drm/amd/display/dc/core/dc.c             |  7 +++++++
 drivers/gpu/drm/amd/display/dc/core/dc_surface.c     | 10 ++++++++++
 drivers/gpu/drm/amd/display/dc/dc.h                  |  1 +
 drivers/gpu/drm/amd/display/modules/inc/mod_shared.h |  7 ++++---
 4 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
index 6abf22aaf571..867a84c2bfbf 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -1669,6 +1669,13 @@ static void copy_surface_update_to_plane(
 			srf_update->lut3d_func))
 		memcpy(surface->lut3d_func, srf_update->lut3d_func,
 		sizeof(*surface->lut3d_func));
+
+	if (srf_update->blend_tf &&
+			(surface->blend_tf !=
+			srf_update->blend_tf))
+		memcpy(surface->blend_tf, srf_update->blend_tf,
+		sizeof(*surface->blend_tf));
+
 #endif
 	if (srf_update->input_csc_color_matrix)
 		surface->input_csc_color_matrix =
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_surface.c b/drivers/gpu/drm/amd/display/dc/core/dc_surface.c
index 60f20d96f9e0..394a87981614 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_surface.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_surface.c
@@ -60,6 +60,11 @@ static void construct(struct dc_context *ctx, struct dc_plane_state *plane_state
 		plane_state->lut3d_func->ctx = ctx;
 		plane_state->lut3d_func->initialized = false;
 	}
+	plane_state->blend_tf = dc_create_transfer_func();
+	if (plane_state->blend_tf != NULL) {
+		plane_state->blend_tf->type = TF_TYPE_BYPASS;
+		plane_state->blend_tf->ctx = ctx;
+	}
 
 #endif
 }
@@ -85,6 +90,11 @@ static void destruct(struct dc_plane_state *plane_state)
 				plane_state->lut3d_func);
 		plane_state->lut3d_func = NULL;
 	}
+	if (plane_state->blend_tf != NULL) {
+		dc_transfer_func_release(
+				plane_state->blend_tf);
+		plane_state->blend_tf = NULL;
+	}
 
 #endif
 }
diff --git a/drivers/gpu/drm/amd/display/dc/dc.h b/drivers/gpu/drm/amd/display/dc/dc.h
index 139ea7354910..53a3876841cc 100644
--- a/drivers/gpu/drm/amd/display/dc/dc.h
+++ b/drivers/gpu/drm/amd/display/dc/dc.h
@@ -761,6 +761,7 @@ struct dc_surface_update {
 #if defined(CONFIG_DRM_AMD_DC_DCN2_0)
 	const struct dc_transfer_func *func_shaper;
 	const struct dc_3dlut *lut3d_func;
+	const struct dc_transfer_func *blend_tf;
 #endif
 };
 
diff --git a/drivers/gpu/drm/amd/display/modules/inc/mod_shared.h b/drivers/gpu/drm/amd/display/modules/inc/mod_shared.h
index 6c877eeba429..b45f7d65e76a 100644
--- a/drivers/gpu/drm/amd/display/modules/inc/mod_shared.h
+++ b/drivers/gpu/drm/amd/display/modules/inc/mod_shared.h
@@ -64,7 +64,8 @@ union lut3d_control_flags {
 		unsigned int use_gamut_map_lib					:1;
 		unsigned int chromatic_adaptation_src				:1;
 		unsigned int chromatic_adaptation_dst				:1;
-		unsigned int reseved					:5;
+		unsigned int do_blender_lut_degamma		:1;
+		unsigned int reseved					:4;
 	} bits;
 };
 
@@ -78,8 +79,8 @@ enum lut3d_control_gamut_map {
 	lut3d_control_gamut_map_none = 0,
 	lut3d_control_gamut_map_tonemap,
 	lut3d_control_gamut_map_chto,
-	lut3d_control_gamut_map_chto_chso,
-	lut3d_control_gamut_map_chto_chci
+	lut3d_control_gamut_map_chso,
+	lut3d_control_gamut_map_chci
 };
 
 enum lut3d_control_rotation_mode {
-- 
2.20.1



More information about the amd-gfx mailing list