Commit 94a4ffd1 authored by Gloria Li's avatar Gloria Li Committed by Alex Deucher
Browse files

drm/amd/display: fix PIP bugs on Dal3



[Why]
There are outstanding bugs for PIP in Dal3:
-Crash when toggling PIP visibility
-Global Alpha is not working, Adjusting global alpha
 doesn’t have an effect
-Cursor is not working with pip plane and pipe splits
-One flash occurs when cursor enters PIP plane from
 top/bottom
-Crash when moving PIP plane off the screen

[How]
Resolve divide by 0 error
Implement global alpha
Program cursor on all pipes
Add dst rects' x and y offests into cursor position
Disable cursor when it is beyond bottom/top edge

Signed-off-by: default avatarGloria Li <geling.li@amd.com>
Reviewed-by: default avatarAric Cyr <Aric.Cyr@amd.com>
Acked-by: default avatarLeo Li <sunpeng.li@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent f1220c87
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1106,6 +1106,9 @@ static enum surface_update_type get_plane_info_update_type(const struct dc_surfa
	if (u->plane_info->per_pixel_alpha != u->surface->per_pixel_alpha)
		update_flags->bits.per_pixel_alpha_change = 1;

	if (u->plane_info->global_alpha_value != u->surface->global_alpha_value)
		update_flags->bits.global_alpha_change = 1;

	if (u->plane_info->dcc.enable != u->surface->dcc.enable
			|| u->plane_info->dcc.grph.independent_64b_blks != u->surface->dcc.grph.independent_64b_blks
			|| u->plane_info->dcc.grph.meta_pitch != u->surface->dcc.grph.meta_pitch)
+6 −3
Original line number Diff line number Diff line
@@ -589,7 +589,9 @@ static void calculate_viewport(struct pipe_ctx *pipe_ctx)
		data->viewport.width = (data->viewport.width + 1) / 2;
		data->viewport_c.width = (data->viewport_c.width + 1) / 2;
	} else if (pri_split) {
		if (data->viewport.width > 1)
			data->viewport.width /= 2;
		if (data->viewport_c.width > 1)
			data->viewport_c.width /= 2;
	}

@@ -670,6 +672,7 @@ static void calculate_recout(struct pipe_ctx *pipe_ctx, struct rect *recout_full
			pipe_ctx->plane_res.scl_data.recout.width =
					(pipe_ctx->plane_res.scl_data.recout.width + 1) / 2;
		} else {
			if (pipe_ctx->plane_res.scl_data.recout.width > 1)
				pipe_ctx->plane_res.scl_data.recout.width /= 2;
		}
	}
+0 −2
Original line number Diff line number Diff line
@@ -205,8 +205,6 @@ bool dc_stream_set_cursor_attributes(

		if (pipe_ctx->stream != stream)
			continue;
		if (pipe_ctx->top_pipe && pipe_ctx->plane_state != pipe_ctx->top_pipe->plane_state)
			continue;

		if (!pipe_to_program) {
			pipe_to_program = pipe_ctx;
+5 −0
Original line number Diff line number Diff line
@@ -442,6 +442,7 @@ union surface_update_flags {
		uint32_t color_space_change:1;
		uint32_t horizontal_mirror_change:1;
		uint32_t per_pixel_alpha_change:1;
		uint32_t global_alpha_change:1;
		uint32_t rotation_change:1;
		uint32_t swizzle_change:1;
		uint32_t scaling_change:1;
@@ -496,6 +497,8 @@ struct dc_plane_state {

	bool is_tiling_rotated;
	bool per_pixel_alpha;
	bool global_alpha;
	int  global_alpha_value;
	bool visible;
	bool flip_immediate;
	bool horizontal_mirror;
@@ -522,6 +525,8 @@ struct dc_plane_info {
	bool horizontal_mirror;
	bool visible;
	bool per_pixel_alpha;
	bool global_alpha;
	int  global_alpha_value;
	bool input_csc_enabled;
};

+9 −1
Original line number Diff line number Diff line
@@ -444,10 +444,12 @@ void dpp1_set_cursor_position(
		struct dpp *dpp_base,
		const struct dc_cursor_position *pos,
		const struct dc_cursor_mi_param *param,
		uint32_t width)
		uint32_t width,
		uint32_t height)
{
	struct dcn10_dpp *dpp = TO_DCN10_DPP(dpp_base);
	int src_x_offset = pos->x - pos->x_hotspot - param->viewport.x;
	int src_y_offset = pos->y - pos->y_hotspot - param->viewport.y;
	uint32_t cur_en = pos->enable ? 1 : 0;

	if (src_x_offset >= (int)param->viewport.width)
@@ -456,6 +458,12 @@ void dpp1_set_cursor_position(
	if (src_x_offset + (int)width <= 0)
		cur_en = 0;  /* not visible beyond left edge*/

	if (src_y_offset >= (int)param->viewport.height)
		cur_en = 0;  /* not visible beyond bottom edge*/

	if (src_y_offset < 0)
		cur_en = 0;  /* not visible beyond top edge*/

	REG_UPDATE(CURSOR0_CONTROL,
			CUR0_ENABLE, cur_en);

Loading