OSDN Git Service

drm/amd/display: Update viewport position for phantom pipes
authorAlvin Lee <Alvin.Lee2@amd.com>
Thu, 25 Aug 2022 20:04:29 +0000 (16:04 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 13 Sep 2022 18:33:00 +0000 (14:33 -0400)
[Description]
In some cases the viewport position of the main pipes can change without
triggering a full update. In this case the subvp phantom viewports must
be updated accordingly.

Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Reviewed-by: Jun Lei <Jun.Lei@amd.com>
Acked-by: Pavle Kotarac <Pavle.Kotarac@amd.com>
Signed-off-by: Alvin Lee <Alvin.Lee2@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.h
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_init.c
drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h

index 6271cac..6f8c344 100644 (file)
@@ -1898,8 +1898,11 @@ void dcn20_post_unlock_program_front_end(
                         * can underflow due to HUBP_VTG_SEL programming if done in the regular front end
                         * programming sequence).
                         */
-                       if (pipe->stream && pipe->stream->mall_stream_config.type == SUBVP_PHANTOM)
-                                       dcn20_program_pipe(dc, pipe, context);
+                       if (pipe->stream && pipe->stream->mall_stream_config.type == SUBVP_PHANTOM) {
+                               if (dc->hwss.update_phantom_vp_position)
+                                       dc->hwss.update_phantom_vp_position(dc, context, pipe);
+                               dcn20_program_pipe(dc, pipe, context);
+                       }
                }
        }
 
index dbf2d7c..449459c 100644 (file)
@@ -1301,3 +1301,35 @@ void dcn32_update_phy_state(struct dc_state *state, struct pipe_ctx *pipe_ctx,
        } else
                BREAK_TO_DEBUGGER();
 }
+
+/* For SubVP the main pipe can have a viewport position change
+ * without a full update. In this case we must also update the
+ * viewport positions for the phantom pipe accordingly.
+ */
+void dcn32_update_phantom_vp_position(struct dc *dc,
+               struct dc_state *context,
+               struct pipe_ctx *phantom_pipe)
+{
+       uint8_t i;
+       struct dc_plane_state *phantom_plane = phantom_pipe->plane_state;
+
+       for (i = 0; i < dc->res_pool->pipe_count; i++) {
+               struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i];
+
+               if (pipe->stream && pipe->stream->mall_stream_config.type == SUBVP_MAIN &&
+                               pipe->stream->mall_stream_config.paired_stream == phantom_pipe->stream) {
+                       if (pipe->plane_state && pipe->plane_state->update_flags.bits.position_change) {
+
+                               phantom_plane->src_rect.x = pipe->plane_state->src_rect.x;
+                               phantom_plane->src_rect.y = pipe->plane_state->src_rect.y;
+                               phantom_plane->clip_rect.x = pipe->plane_state->clip_rect.x;
+                               phantom_plane->dst_rect.x = pipe->plane_state->dst_rect.x;
+                               phantom_plane->dst_rect.y = pipe->plane_state->dst_rect.y;
+
+                               phantom_pipe->plane_state->update_flags.bits.position_change = 1;
+                               resource_build_scaling_params(phantom_pipe);
+                               return;
+                       }
+               }
+       }
+}
index 221e311..150d541 100644 (file)
@@ -87,4 +87,8 @@ bool dcn32_is_dp_dig_pixel_rate_div_policy(struct pipe_ctx *pipe_ctx);
 void dcn32_update_phy_state(struct dc_state *state, struct pipe_ctx *pipe_ctx,
                enum phy_state target_state);
 
+void dcn32_update_phantom_vp_position(struct dc *dc,
+               struct dc_state *context,
+               struct pipe_ctx *phantom_pipe);
+
 #endif /* __DC_HWSS_DCN32_H__ */
index 28d2202..c554929 100644 (file)
@@ -105,6 +105,7 @@ static const struct hw_sequencer_funcs dcn32_funcs = {
        .subvp_pipe_control_lock = dcn32_subvp_pipe_control_lock,
        .update_visual_confirm_color = dcn20_update_visual_confirm_color,
        .update_phy_state = dcn32_update_phy_state,
+       .update_phantom_vp_position = dcn32_update_phantom_vp_position,
 };
 
 static const struct hwseq_private_funcs dcn32_private_funcs = {
index 52b4350..d7a7b27 100644 (file)
@@ -247,6 +247,11 @@ struct hw_sequencer_funcs {
 
        void (*update_phy_state)(struct dc_state *state, struct pipe_ctx *pipe_ctx, enum phy_state target_state);
 
+
+       void (*update_phantom_vp_position)(struct dc *dc,
+                       struct dc_state *context,
+                       struct pipe_ctx *phantom_pipe);
+
        void (*commit_subvp_config)(struct dc *dc, struct dc_state *context);
        void (*subvp_pipe_control_lock)(struct dc *dc,
                        struct dc_state *context,