summary refs log tree commit diff
path: root/drivers/gpu
diff options
context:
space:
mode:
authorMelissa Wen <mwen@igalia.com>2023-06-12 06:39:04 -0100
committerPierre-Loup A. Griffais <pgriffais@valvesoftware.com>2023-11-02 16:05:47 -0700
commit989fb7b07f02e984ad90a6650fa51b219be4136a (patch)
tree81a5f7f66c26f21b2f68a4364e37349440025587 /drivers/gpu
parentad210c1d1665cbabbe9b7a2ea3d5d379e7332c7d (diff)
downloadlinux-989fb7b07f02e984ad90a6650fa51b219be4136a.tar.gz
draft: drm/amd/display: switch priority for DPP gamut remap matrix
DCN2 family and older only support pre-blending DPP gamut remap matrix.
As DRM interface only exposes post-blending CTM property, the driver
maps DRM CRTC CTM to stream gamut remap matrix and applies it to DPP
color block. However, DCN3 and newer has gamut remap matrix on both DPP
and MPC blocks. Since we are exposing a driver-specific property for
plane CTM we want to prioritize plane gamut remap matrix programming
instead of the stream one on DPP block.

We still need to figure out how to detach stream gamut remap matrix from
DPP to MPC block in newer drivers. So that, we won't need to choose
between pre- and post-blending CTM, because we can have both.

Signed-off-by: Melissa Wen <mwen@igalia.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
index 838efccb210d..4da5192de5f7 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
@@ -2480,17 +2480,17 @@ void dcn10_program_gamut_remap(struct pipe_ctx *pipe_ctx)
 	adjust.gamut_adjust_type = GRAPHICS_GAMUT_ADJUST_TYPE_BYPASS;
 
 
-	if (pipe_ctx->stream->gamut_remap_matrix.enable_remap == true) {
+	if (pipe_ctx->plane_state &&
+	    pipe_ctx->plane_state->gamut_remap_matrix.enable_remap == true) {
 		adjust.gamut_adjust_type = GRAPHICS_GAMUT_ADJUST_TYPE_SW;
 		for (i = 0; i < CSC_TEMPERATURE_MATRIX_SIZE; i++)
 			adjust.temperature_matrix[i] =
-				pipe_ctx->stream->gamut_remap_matrix.matrix[i];
-	} else if (pipe_ctx->plane_state &&
-		   pipe_ctx->plane_state->gamut_remap_matrix.enable_remap == true) {
+				pipe_ctx->plane_state->gamut_remap_matrix.matrix[i];
+	} else if (pipe_ctx->stream->gamut_remap_matrix.enable_remap == true) {
 		adjust.gamut_adjust_type = GRAPHICS_GAMUT_ADJUST_TYPE_SW;
 		for (i = 0; i < CSC_TEMPERATURE_MATRIX_SIZE; i++)
 			adjust.temperature_matrix[i] =
-				pipe_ctx->plane_state->gamut_remap_matrix.matrix[i];
+				pipe_ctx->stream->gamut_remap_matrix.matrix[i];
 	}
 
 	pipe_ctx->plane_res.dpp->funcs->dpp_set_gamut_remap(pipe_ctx->plane_res.dpp, &adjust);
@@ -2936,8 +2936,8 @@ void dcn10_program_pipe(
 	hws->funcs.set_hdr_multiplier(pipe_ctx);
 
 	if (pipe_ctx->plane_state->update_flags.bits.full_update ||
-			pipe_ctx->plane_state->update_flags.bits.in_transfer_func_change ||
-			pipe_ctx->plane_state->update_flags.bits.gamma_change)
+	    pipe_ctx->plane_state->update_flags.bits.in_transfer_func_change ||
+	    pipe_ctx->plane_state->update_flags.bits.gamma_change)
 		hws->funcs.set_input_transfer_func(dc, pipe_ctx, pipe_ctx->plane_state);
 
 	/* dcn10_translate_regamma_to_hw_format takes 750us to finish