From: Piotr Maziarz <[email protected]>

[Why]
HWS_APPLY_UPDATE_FLAGS_FOR_PHANTOM and HWS_UPDATE_PHANTOM_VP_POSITION
program no hardware. They only mutate driver state: pipe update flags,
the phantom plane viewport and the phantom scaling params.

A block sequence is built first and executed later, so both ops ran only
after the builder had already inspected pipe_ctx->update_flags to decide
which steps to emit. The phantom pipe was therefore built from stale
flags.

[How]
Call apply_update_flags_for_phantom() and update_phantom_vp_position()
directly from hwss_build_post_unlock_full_sequence(), before
program_pipe_sequence(), matching the legacy
dcn401_post_unlock_program_front_end() ordering.

Reviewed-by: Alvin Lee <[email protected]>
Signed-off-by: Piotr Maziarz <[email protected]>
Signed-off-by: George Zhang <[email protected]>
---
 .../drm/amd/display/dc/core/dc_hw_sequencer.c | 46 ++-----------------
 .../drm/amd/display/dc/hwss/hw_sequencer.h    | 20 --------
 2 files changed, 5 insertions(+), 61 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c 
b/drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c
index b3270f5bb56e..2c13f76d764b 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c
@@ -1102,11 +1102,13 @@ void hwss_build_post_unlock_full_sequence(struct dc *dc,
                if (pipe->plane_state && !pipe->top_pipe) {
                        while (pipe) {
                                if (pipe->stream && 
dc_state_get_pipe_subvp_type(context, pipe) == SUBVP_PHANTOM) {
-                                       /* Apply update flags for phantom pipes 
using existing HWS functions */
+                                       /* Phantom SW state must be updated 
before the pipe sequence is built,
+                                        * since the build reads the update 
flags and scaling params.
+                                        */
                                        if 
(dc->hwss.apply_update_flags_for_phantom)
-                                               
hwss_add_hws_apply_update_flags_for_phantom(&seq_state, pipe);
+                                               
dc->hwss.apply_update_flags_for_phantom(pipe);
                                        if (dc->hwss.update_phantom_vp_position)
-                                               
hwss_add_hws_update_phantom_vp_position(&seq_state, dc, context, pipe);
+                                               
dc->hwss.update_phantom_vp_position(dc, context, pipe);
 
                                        /* Program the phantom pipe - use 
program_pipe_sequence if available */
                                        if (dc->hwseq && 
dc->hwseq->funcs.program_pipe_sequence)
@@ -1804,14 +1806,6 @@ void hwss_execute_sequence(struct dc *dc,
                        
params->hubp_wait_pipe_read_start_params.hubp->funcs->hubp_wait_pipe_read_start(
                                params->hubp_wait_pipe_read_start_params.hubp);
                        break;
-               case HWS_APPLY_UPDATE_FLAGS_FOR_PHANTOM:
-                       
dc->hwss.apply_update_flags_for_phantom(params->apply_update_flags_for_phantom_params.pipe_ctx);
-                       break;
-               case HWS_UPDATE_PHANTOM_VP_POSITION:
-                       
dc->hwss.update_phantom_vp_position(params->update_phantom_vp_position_params.dc,
-                               
params->update_phantom_vp_position_params.context,
-                               
params->update_phantom_vp_position_params.pipe_ctx);
-                       break;
                case OPTC_SET_ODM_COMBINE:
                        hwss_set_odm_combine(params);
                        break;
@@ -2590,36 +2584,6 @@ void hwss_add_hubp_wait_pipe_read_start(struct 
block_sequence_state *seq_state,
        }
 }
 
-/*
- * Helper function to add HWS apply update flags for phantom to block sequence
- */
-void hwss_add_hws_apply_update_flags_for_phantom(struct block_sequence_state 
*seq_state,
-               struct pipe_ctx *pipe_ctx)
-{
-       if (*seq_state->num_steps < MAX_HWSS_BLOCK_SEQUENCE_SIZE) {
-               
seq_state->steps[*seq_state->num_steps].params.apply_update_flags_for_phantom_params.pipe_ctx
 = pipe_ctx;
-               seq_state->steps[*seq_state->num_steps].func = 
HWS_APPLY_UPDATE_FLAGS_FOR_PHANTOM;
-               (*seq_state->num_steps)++;
-       }
-}
-
-/*
- * Helper function to add HWS update phantom VP position to block sequence
- */
-void hwss_add_hws_update_phantom_vp_position(struct block_sequence_state 
*seq_state,
-               struct dc *dc,
-               struct dc_state *context,
-               struct pipe_ctx *pipe_ctx)
-{
-       if (*seq_state->num_steps < MAX_HWSS_BLOCK_SEQUENCE_SIZE) {
-               
seq_state->steps[*seq_state->num_steps].params.update_phantom_vp_position_params.dc
 = dc;
-               
seq_state->steps[*seq_state->num_steps].params.update_phantom_vp_position_params.context
 = context;
-               
seq_state->steps[*seq_state->num_steps].params.update_phantom_vp_position_params.pipe_ctx
 = pipe_ctx;
-               seq_state->steps[*seq_state->num_steps].func = 
HWS_UPDATE_PHANTOM_VP_POSITION;
-               (*seq_state->num_steps)++;
-       }
-}
-
 /*
  * Helper function to add OPTC set ODM combine to block sequence
  */
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h 
b/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h
index 7d4310c0ef3f..cc1c54c46e25 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h
+++ b/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h
@@ -249,16 +249,6 @@ struct hubp_wait_pipe_read_start_params {
        struct hubp *hubp;
 };
 
-struct apply_update_flags_for_phantom_params {
-       struct pipe_ctx *pipe_ctx;
-};
-
-struct update_phantom_vp_position_params {
-       struct dc *dc;
-       struct pipe_ctx *pipe_ctx;
-       struct dc_state *context;
-};
-
 struct set_odm_combine_params {
        struct timing_generator *tg;
        int opp_inst[MAX_PIPES];
@@ -1098,8 +1088,6 @@ union block_sequence_params {
        struct control_cm_hist_params control_cm_hist_params;
        struct program_cursor_update_now_params 
program_cursor_update_now_params;
        struct hubp_wait_pipe_read_start_params 
hubp_wait_pipe_read_start_params;
-       struct apply_update_flags_for_phantom_params 
apply_update_flags_for_phantom_params;
-       struct update_phantom_vp_position_params 
update_phantom_vp_position_params;
        struct set_odm_combine_params set_odm_combine_params;
        struct set_odm_bypass_params set_odm_bypass_params;
        struct opp_pipe_clock_control_params opp_pipe_clock_control_params;
@@ -1278,8 +1266,6 @@ enum block_sequence_func {
        DPP_PROGRAM_CM_HIST,
        PROGRAM_CURSOR_UPDATE_NOW,
        HUBP_WAIT_PIPE_READ_START,
-       HWS_APPLY_UPDATE_FLAGS_FOR_PHANTOM,
-       HWS_UPDATE_PHANTOM_VP_POSITION,
        OPTC_SET_ODM_COMBINE,
        OPTC_SET_ODM_BYPASS,
        OPP_PIPE_CLOCK_CONTROL,
@@ -2248,12 +2234,6 @@ void hwss_add_lsdma_send_pio_copy(struct 
block_sequence_state *seq_state,
 void hwss_add_hubp_wait_pipe_read_start(struct block_sequence_state *seq_state,
                struct hubp *hubp);
 
-void hwss_add_hws_apply_update_flags_for_phantom(struct block_sequence_state 
*seq_state,
-               struct pipe_ctx *pipe_ctx);
-
-void hwss_add_hws_update_phantom_vp_position(struct block_sequence_state 
*seq_state,
-               struct dc *dc, struct dc_state *context, struct pipe_ctx 
*pipe_ctx);
-
 void hwss_add_optc_set_odm_combine(struct block_sequence_state *seq_state,
                struct timing_generator *tg, int opp_inst[MAX_PIPES], int 
opp_head_count,
                int odm_slice_width, int last_odm_slice_width);
-- 
2.55.0

Reply via email to