drm/amd/display: Fix SubVP control flow in the MPO context
authorRodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Tue, 20 Sep 2022 18:27:04 +0000 (14:27 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 6 Oct 2022 16:01:58 +0000 (12:01 -0400)
SubVP has some issues related to how we allocate and enable it. This
commit fixes this behavior by adding the proper check and configuration
to the SubVP code path.

Reviewed-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Signed-off-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc.c
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c

index 6216ceb790b4b0c283d567b2bdde5e48529347fa..40a34b600c8ee195f4d5acff427be381d94cc08a 100644 (file)
@@ -2946,6 +2946,12 @@ static bool update_planes_and_stream_state(struct dc *dc,
                dc_resource_state_copy_construct(
                                dc->current_state, context);
 
+               /* For each full update, remove all existing phantom pipes first.
+                * Ensures that we have enough pipes for newly added MPO planes
+                */
+               if (dc->res_pool->funcs->remove_phantom_pipes)
+                       dc->res_pool->funcs->remove_phantom_pipes(dc, context);
+
                /*remove old surfaces from context */
                if (!dc_rem_all_planes_for_stream(dc, stream, context)) {
 
@@ -3353,8 +3359,14 @@ static void commit_planes_for_stream(struct dc *dc,
                /* Since phantom pipe programming is moved to post_unlock_program_front_end,
                 * move the SubVP lock to after the phantom pipes have been setup
                 */
-               if (dc->hwss.subvp_pipe_control_lock)
-                       dc->hwss.subvp_pipe_control_lock(dc, context, false, should_lock_all_pipes, NULL, subvp_prev_use);
+               if (should_lock_all_pipes && dc->hwss.interdependent_update_lock) {
+                       if (dc->hwss.subvp_pipe_control_lock)
+                               dc->hwss.subvp_pipe_control_lock(dc, context, false, should_lock_all_pipes, NULL, subvp_prev_use);
+               } else {
+                       if (dc->hwss.subvp_pipe_control_lock)
+                               dc->hwss.subvp_pipe_control_lock(dc, context, false, should_lock_all_pipes, NULL, subvp_prev_use);
+               }
+
                return;
        }
 
index 7de511fd004b5ae5ba52234469a7c77d45d80f6f..d732b6f031a12a28e5cc859e6a6d9828a1636b93 100644 (file)
@@ -1860,24 +1860,6 @@ void dcn20_post_unlock_program_front_end(
                }
        }
 
-       for (i = 0; i < dc->res_pool->pipe_count; i++) {
-               struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i];
-               struct pipe_ctx *mpcc_pipe;
-
-               if (pipe->vtp_locked) {
-                       dc->hwseq->funcs.wait_for_blank_complete(pipe->stream_res.opp);
-                       pipe->plane_res.hubp->funcs->set_blank(pipe->plane_res.hubp, true);
-                       pipe->vtp_locked = false;
-
-                       for (mpcc_pipe = pipe->bottom_pipe; mpcc_pipe; mpcc_pipe = mpcc_pipe->bottom_pipe)
-                               mpcc_pipe->plane_res.hubp->funcs->set_blank(mpcc_pipe->plane_res.hubp, true);
-
-                       for (i = 0; i < dc->res_pool->pipe_count; i++)
-                               if (context->res_ctx.pipe_ctx[i].update_flags.bits.disable)
-                                       dc->hwss.disable_plane(dc, &dc->current_state->res_ctx.pipe_ctx[i]);
-               }
-       }
-
        for (i = 0; i < dc->res_pool->pipe_count; i++) {
                struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i];
                struct pipe_ctx *old_pipe = &dc->current_state->res_ctx.pipe_ctx[i];
index 752a4accb116d96869b4cda2671ecf9f69b6614c..9585b25f10e52e047e23a77f2977305f19f0e650 100644 (file)
@@ -1680,6 +1680,8 @@ static void dcn32_enable_phantom_plane(struct dc *dc,
                phantom_plane->clip_rect.y = 0;
                phantom_plane->clip_rect.height = phantom_stream->timing.v_addressable;
 
+               phantom_plane->is_phantom = true;
+
                dc_add_plane_to_context(dc, phantom_stream, phantom_plane, context);
 
                curr_pipe = curr_pipe->bottom_pipe;
@@ -1749,6 +1751,10 @@ bool dcn32_remove_phantom_pipes(struct dc *dc, struct dc_state *context)
                        pipe->stream->mall_stream_config.type = SUBVP_NONE;
                        pipe->stream->mall_stream_config.paired_stream = NULL;
                }
+
+               if (pipe->plane_state) {
+                       pipe->plane_state->is_phantom = false;
+               }
        }
        return removed_pipe;
 }