drm/amd/display: Program SubVP in dc_commit_state_no_check
authorDillon Varone <Dillon.Varone@amd.com>
Mon, 19 Sep 2022 14:29:24 +0000 (10:29 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 6 Oct 2022 15:57:36 +0000 (11:57 -0400)
[Why?]
Currently SubVP programming is only done in commit_planes_for_stream, as
it was expected only this call would add/remove planes from a
display.

[How?]
Add SubVP programming to dc_commit_state_no_check.

Reviewed-by: Alvin Lee <Alvin.Lee2@amd.com>
Acked-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
Signed-off-by: Dillon Varone <Dillon.Varone@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc.c

index ccaa43d071cf349566666b7c1fdb93d8310eef90..4ba2c1f95dcbd3ead15062f05118284dfdb3214d 100644 (file)
@@ -1734,10 +1734,20 @@ static enum dc_status dc_commit_state_no_check(struct dc *dc, struct dc_state *c
        int i, k, l;
        struct dc_stream_state *dc_streams[MAX_STREAMS] = {0};
        struct dc_state *old_state;
+       bool subvp_prev_use = false;
 
        dc_z10_restore(dc);
        dc_allow_idle_optimizations(dc, false);
 
+       for (i = 0; i < dc->res_pool->pipe_count; i++) {
+               struct pipe_ctx *old_pipe = &dc->current_state->res_ctx.pipe_ctx[i];
+
+               /* Check old context for SubVP */
+               subvp_prev_use |= (old_pipe->stream && old_pipe->stream->mall_stream_config.type == SUBVP_PHANTOM);
+               if (subvp_prev_use)
+                       break;
+       }
+
        for (i = 0; i < context->stream_count; i++)
                dc_streams[i] =  context->streams[i];
 
@@ -1777,6 +1787,9 @@ static enum dc_status dc_commit_state_no_check(struct dc *dc, struct dc_state *c
                dc->hwss.wait_for_mpcc_disconnect(dc, dc->res_pool, pipe);
        }
 
+       if (dc->hwss.subvp_pipe_control_lock)
+               dc->hwss.subvp_pipe_control_lock(dc, context, true, true, NULL, subvp_prev_use);
+
        result = dc->hwss.apply_ctx_to_hw(dc, context);
 
        if (result != DC_OK) {
@@ -1794,6 +1807,12 @@ static enum dc_status dc_commit_state_no_check(struct dc *dc, struct dc_state *c
                dc->hwss.interdependent_update_lock(dc, context, false);
                dc->hwss.post_unlock_program_front_end(dc, context);
        }
+
+       if (dc->hwss.commit_subvp_config)
+               dc->hwss.commit_subvp_config(dc, context);
+       if (dc->hwss.subvp_pipe_control_lock)
+               dc->hwss.subvp_pipe_control_lock(dc, context, false, true, NULL, subvp_prev_use);
+
        for (i = 0; i < context->stream_count; i++) {
                const struct dc_link *link = context->streams[i]->link;