]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/amd/display: Skip to enable dsc if it has been off
authorZhikai Zhai <zhikai.zhai@amd.com>
Tue, 27 Aug 2024 06:06:01 +0000 (14:06 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 4 Oct 2024 14:33:29 +0000 (16:33 +0200)
commit 4bdc5b504af7de1f649004cfdd37445d36db6703 upstream.

[WHY]
It makes DSC enable when we commit the stream which need
keep power off, and then it will skip to disable DSC if
pipe reset at this situation as power has been off. It may
cause the DSC unexpected enable on the pipe with the
next new stream which doesn't support DSC.

[HOW]
Check the DSC used on current pipe status when update stream.
Skip to enable if it has been off. The operation enable
DSC should happen when set power on.

Cc: Mario Limonciello <mario.limonciello@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
Reviewed-by: Wenjing Liu <wenjing.liu@amd.com>
Signed-off-by: Zhikai Zhai <zhikai.zhai@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c
drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c

index b8e884368dc6e5580bfb740d8872d9a7e578b907..5fc377f51f5621b81d57d003b21b76f53f4c4a41 100644 (file)
@@ -991,6 +991,20 @@ static void update_dsc_on_stream(struct pipe_ctx *pipe_ctx, bool enable)
                struct dsc_config dsc_cfg;
                struct dsc_optc_config dsc_optc_cfg = {0};
                enum optc_dsc_mode optc_dsc_mode;
+               struct dcn_dsc_state dsc_state = {0};
+
+               if (!dsc) {
+                       DC_LOG_DSC("DSC is NULL for tg instance %d:", pipe_ctx->stream_res.tg->inst);
+                       return;
+               }
+
+               if (dsc->funcs->dsc_read_state) {
+                       dsc->funcs->dsc_read_state(dsc, &dsc_state);
+                       if (!dsc_state.dsc_fw_en) {
+                               DC_LOG_DSC("DSC has been disabled for tg instance %d:", pipe_ctx->stream_res.tg->inst);
+                               return;
+                       }
+               }
 
                /* Enable DSC hw block */
                dsc_cfg.pic_width = (stream->timing.h_addressable + stream->timing.h_border_left + stream->timing.h_border_right) / opp_cnt;
index 4f0e9e0f701dd23c83145a4cd787e341c1a37b53..900dfc0f27537303a5ab3781a44757321c0d38ec 100644 (file)
@@ -375,7 +375,20 @@ static void update_dsc_on_stream(struct pipe_ctx *pipe_ctx, bool enable)
                struct dsc_config dsc_cfg;
                struct dsc_optc_config dsc_optc_cfg = {0};
                enum optc_dsc_mode optc_dsc_mode;
+               struct dcn_dsc_state dsc_state = {0};
 
+               if (!dsc) {
+                       DC_LOG_DSC("DSC is NULL for tg instance %d:", pipe_ctx->stream_res.tg->inst);
+                       return;
+               }
+
+               if (dsc->funcs->dsc_read_state) {
+                       dsc->funcs->dsc_read_state(dsc, &dsc_state);
+                       if (!dsc_state.dsc_fw_en) {
+                               DC_LOG_DSC("DSC has been disabled for tg instance %d:", pipe_ctx->stream_res.tg->inst);
+                               return;
+                       }
+               }
                /* Enable DSC hw block */
                dsc_cfg.pic_width = (stream->timing.h_addressable + stream->timing.h_border_left + stream->timing.h_border_right) / opp_cnt;
                dsc_cfg.pic_height = stream->timing.v_addressable + stream->timing.v_border_top + stream->timing.v_border_bottom;