]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/amd/display: fix missing writeback disablement if plane is removed
authorRoy Chan <roy.chan@amd.com>
Wed, 21 Jul 2021 23:33:26 +0000 (19:33 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 18 Sep 2021 11:42:10 +0000 (13:42 +0200)
[ Upstream commit 82367e7f22d085092728f45fd5fbb15e3fb997c0 ]

[Why]
If the plane has been removed, the writeback disablement logic
doesn't run

[How]
fix the logic order

Acked-by: Anson Jacob <Anson.Jacob@amd.com>
Signed-off-by: Roy Chan <roy.chan@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c

index 793554e61c52075a0149d643f94afd839b7fbe47..03b941e76de2a8cc540e68b02cfab4a706c9e4c0 100644 (file)
@@ -1703,13 +1703,15 @@ void dcn20_program_front_end_for_ctx(
                                dcn20_program_pipe(dc, pipe, context);
                                pipe = pipe->bottom_pipe;
                        }
-                       /* Program secondary blending tree and writeback pipes */
-                       pipe = &context->res_ctx.pipe_ctx[i];
-                       if (!pipe->prev_odm_pipe && pipe->stream->num_wb_info > 0
-                                       && (pipe->update_flags.raw || pipe->plane_state->update_flags.raw || pipe->stream->update_flags.raw)
-                                       && hws->funcs.program_all_writeback_pipes_in_tree)
-                               hws->funcs.program_all_writeback_pipes_in_tree(dc, pipe->stream, context);
                }
+               /* Program secondary blending tree and writeback pipes */
+               pipe = &context->res_ctx.pipe_ctx[i];
+               if (!pipe->top_pipe && !pipe->prev_odm_pipe
+                               && pipe->stream && pipe->stream->num_wb_info > 0
+                               && (pipe->update_flags.raw || (pipe->plane_state && pipe->plane_state->update_flags.raw)
+                                       || pipe->stream->update_flags.raw)
+                               && hws->funcs.program_all_writeback_pipes_in_tree)
+                       hws->funcs.program_all_writeback_pipes_in_tree(dc, pipe->stream, context);
        }
 }
 
index d53f8b39699b33abf375174d18ec1af42401ae3a..37944f94c693177bcacf2dfa875f2bafeb9caffb 100644 (file)
@@ -396,12 +396,22 @@ void dcn30_program_all_writeback_pipes_in_tree(
                        for (i_pipe = 0; i_pipe < dc->res_pool->pipe_count; i_pipe++) {
                                struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i_pipe];
 
+                               if (!pipe_ctx->plane_state)
+                                       continue;
+
                                if (pipe_ctx->plane_state == wb_info.writeback_source_plane) {
                                        wb_info.mpcc_inst = pipe_ctx->plane_res.mpcc_inst;
                                        break;
                                }
                        }
-                       ASSERT(wb_info.mpcc_inst != -1);
+
+                       if (wb_info.mpcc_inst == -1) {
+                               /* Disable writeback pipe and disconnect from MPCC
+                                * if source plane has been removed
+                                */
+                               dc->hwss.disable_writeback(dc, wb_info.dwb_pipe_inst);
+                               continue;
+                       }
 
                        ASSERT(wb_info.dwb_pipe_inst < dc->res_pool->res_cap->num_dwb);
                        dwb = dc->res_pool->dwbc[wb_info.dwb_pipe_inst];