Commit 43080c9b authored by Alvin Lee's avatar Alvin Lee Committed by Alex Deucher
Browse files

drm/amd/display: Update viewport position for phantom pipes



[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: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
Reviewed-by: default avatarJun Lei <Jun.Lei@amd.com>
Acked-by: default avatarPavle Kotarac <Pavle.Kotarac@amd.com>
Signed-off-by: default avatarAlvin Lee <Alvin.Lee2@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 39fc82b7
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -1898,10 +1898,13 @@ 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)
			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);
			}
		}
	}

	/* Only program the MALL registers after all the main and phantom pipes
	 * are done programming.
+32 −0
Original line number Diff line number Diff line
@@ -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;
			}
		}
	}
}
+4 −0
Original line number Diff line number Diff line
@@ -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__ */
+1 −0
Original line number Diff line number Diff line
@@ -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 = {
+5 −0
Original line number Diff line number Diff line
@@ -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,