[PATCH] drm/amd/display: Fix CSC remap matrix not being applied on dcn30

Lakha, Bhawanpreet Bhawanpreet.Lakha at amd.com
Wed Jul 8 20:41:56 UTC 2020


[AMD Official Use Only - Internal Distribution Only]

Reviewed-by: Bhawanpreet Lakha <Bhawanpreet.Lakha at amd.com>
________________________________
From: Nicholas Kazlauskas <nicholas.kazlauskas at amd.com>
Sent: July 8, 2020 4:34 PM
To: amd-gfx at lists.freedesktop.org <amd-gfx at lists.freedesktop.org>
Cc: Kazlauskas, Nicholas <Nicholas.Kazlauskas at amd.com>; Lakha, Bhawanpreet <Bhawanpreet.Lakha at amd.com>; Cyr, Aric <Aric.Cyr at amd.com>
Subject: [PATCH] drm/amd/display: Fix CSC remap matrix not being applied on dcn30

[Why]
DCN3 has two gamut remap matrices. When using CSC adjustment the CM
remap is set to bypass and MPCC remap is used. However to bypass CM
some state in the context is modified and not restored correctly
resulting in subsequent calls to disable MPCC remap as well.

[How]
Fix logic for save/restore of remap enable flag when programming MPCC
remap matrix.

Cc: Bhawanpreet Lakha <Bhawanpreet.Lakha at amd.com>
Signed-off-by: Aric Cyr <aric.cyr at amd.com>
Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas at amd.com>
---
 .../drm/amd/display/dc/dcn20/dcn20_hwseq.c    | 27 ++++++++++---------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c
index 5621c95177d2..7725a406c16e 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c
@@ -1482,22 +1482,23 @@ static void dcn20_update_dchubp_dpp(

                         memset(&adjust, 0, sizeof(adjust));
                         adjust.gamut_adjust_type = GRAPHICS_GAMUT_ADJUST_TYPE_BYPASS;
-                       /* save the enablement of gamut remap for dpp*/
+
+                       /* save the enablement of gamut remap for dpp */
                         enable_remap_dpp = pipe_ctx->stream->gamut_remap_matrix.enable_remap;
-                       /*force bypass gamut remap for dpp/cm*/
+
+                       /* force bypass gamut remap for dpp/cm */
                         pipe_ctx->stream->gamut_remap_matrix.enable_remap = false;
                         dc->hwss.program_gamut_remap(pipe_ctx);
-                       /*restore gamut remap flag for the top plane and use this remap into mpc*/
-                       if (pipe_ctx->top_pipe == NULL)
-                               pipe_ctx->stream->gamut_remap_matrix.enable_remap = enable_remap_dpp;
-                       else
-                               pipe_ctx->stream->gamut_remap_matrix.enable_remap = false;
-
-                       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->stream->gamut_remap_matrix.matrix[i];
+
+                       /* restore gamut remap flag and use this remap into mpc */
+                       pipe_ctx->stream->gamut_remap_matrix.enable_remap = enable_remap_dpp;
+
+                       /* build remap matrix for top plane if enabled */
+                       if (enable_remap_dpp && pipe_ctx->top_pipe == NULL) {
+                                       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];
                         }
                         mpc->funcs->set_gamut_remap(mpc, mpcc_id, &adjust);
                 } else
--
2.25.1

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20200708/a4a1b0d8/attachment-0001.htm>


More information about the amd-gfx mailing list