Commit d9b20b45 authored by Aric Cyr's avatar Aric Cyr Committed by Alex Deucher
Browse files

drm/amd/display: Multiplane cursor position incorrect when plane rotated



[Why]
When video plane is rotate the cursor position is incorrect and not
matching the desktop location.

[How]
When a plane is rotated 90 or 270 degrees, the src_rect.width and height
should be swapped when determining the scaling factor compared to the
dst_rect.

Signed-off-by: default avatarAric Cyr <aric.cyr@amd.com>
Reviewed-by: default avatarJun Lei <Jun.Lei@amd.com>
Acked-by: default avatarBindu Ramamurthy <bindu.r@amd.com>
Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 962f2f1a
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -3245,10 +3245,17 @@ void dcn10_set_cursor_position(struct pipe_ctx *pipe_ctx)
	 * about the actual size being incorrect, that's a limitation of
	 * the hardware.
	 */
	if (param.rotation == ROTATION_ANGLE_90 || param.rotation == ROTATION_ANGLE_270) {
		x_pos = (x_pos - x_plane) * pipe_ctx->plane_state->src_rect.height /
				pipe_ctx->plane_state->dst_rect.width;
		y_pos = (y_pos - y_plane) * pipe_ctx->plane_state->src_rect.width /
				pipe_ctx->plane_state->dst_rect.height;
	} else {
		x_pos = (x_pos - x_plane) * pipe_ctx->plane_state->src_rect.width /
				pipe_ctx->plane_state->dst_rect.width;
		y_pos = (y_pos - y_plane) * pipe_ctx->plane_state->src_rect.height /
				pipe_ctx->plane_state->dst_rect.height;
	}

	/**
	 * If the cursor's source viewport is clipped then we need to