Commit c2edec16 authored by Sridevi's avatar Sridevi Committed by Alex Deucher

drm/amd/display: Fix incorrect cursor position for dcn401

[Why]
Incorrect cursor position calculation in some scenarios.  Also for
mirror and rotation cases.

[How]
Fix for incorrect cursor position.  Added new test scenarios for diags
cursor test.  Updated CRC for few of the diags cursor test scenarios.
Reviewed-by: default avatarRodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: default avatarSridevi <sarvinde@amd.com>
Acked-by: default avatarHarry Wentland <harry.wentland@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 3c603b1f
...@@ -185,15 +185,23 @@ void dpp401_set_cursor_position( ...@@ -185,15 +185,23 @@ void dpp401_set_cursor_position(
rec_y_offset = y_pos - (cursor_height - y_hotspot); rec_y_offset = y_pos - (cursor_height - y_hotspot);
} }
if (rec_x_offset >= (int)param->recout.width) if (param->rotation == ROTATION_ANGLE_0 && !param->mirror) {
cur_en = 0; /* not visible beyond right edge*/ if (rec_x_offset >= (int)param->recout.width)
cur_en = 0; /* not visible beyond right edge*/
if (rec_y_offset >= (int)param->recout.height)
cur_en = 0; /* not visible beyond bottom edge*/
} else {
if (rec_x_offset > (int)param->recout.width)
cur_en = 0; /* not visible beyond right edge*/
if (rec_y_offset > (int)param->recout.height)
cur_en = 0; /* not visible beyond bottom edge*/
}
if (rec_x_offset + cursor_width <= 0) if (rec_x_offset + cursor_width <= 0)
cur_en = 0; /* not visible beyond left edge*/ cur_en = 0; /* not visible beyond left edge*/
if (rec_y_offset >= (int)param->recout.height)
cur_en = 0; /* not visible beyond bottom edge*/
if (rec_y_offset + cursor_height <= 0) if (rec_y_offset + cursor_height <= 0)
cur_en = 0; /* not visible beyond top edge*/ cur_en = 0; /* not visible beyond top edge*/
......
...@@ -1126,14 +1126,14 @@ void dcn401_set_cursor_position(struct pipe_ctx *pipe_ctx) ...@@ -1126,14 +1126,14 @@ void dcn401_set_cursor_position(struct pipe_ctx *pipe_ctx)
*/ */
if (param.rotation == ROTATION_ANGLE_90 || param.rotation == ROTATION_ANGLE_270) { if (param.rotation == ROTATION_ANGLE_90 || param.rotation == ROTATION_ANGLE_270) {
x_pos = x_pos * pipe_ctx->stream->dst.width / x_pos = pipe_ctx->stream->dst.x + x_pos * pipe_ctx->stream->dst.width /
pipe_ctx->stream->src.height; pipe_ctx->stream->src.height;
y_pos = y_pos * pipe_ctx->stream->dst.height / y_pos = pipe_ctx->stream->dst.y + y_pos * pipe_ctx->stream->dst.height /
pipe_ctx->stream->src.width; pipe_ctx->stream->src.width;
} else { } else {
x_pos = x_pos * pipe_ctx->stream->dst.width / x_pos = pipe_ctx->stream->dst.x + x_pos * pipe_ctx->stream->dst.width /
pipe_ctx->stream->src.width; pipe_ctx->stream->src.width;
y_pos = y_pos * pipe_ctx->stream->dst.height / y_pos = pipe_ctx->stream->dst.y + y_pos * pipe_ctx->stream->dst.height /
pipe_ctx->stream->src.height; pipe_ctx->stream->src.height;
} }
...@@ -1225,10 +1225,15 @@ void dcn401_set_cursor_position(struct pipe_ctx *pipe_ctx) ...@@ -1225,10 +1225,15 @@ void dcn401_set_cursor_position(struct pipe_ctx *pipe_ctx)
} }
} }
} else if (param.rotation == ROTATION_ANGLE_90) { } else if (param.rotation == ROTATION_ANGLE_90) {
uint32_t temp_y = pos_cpy.y; if (!param.mirror) {
uint32_t temp_y = pos_cpy.y;
pos_cpy.y = pipe_ctx->plane_res.scl_data.recout.height - pos_cpy.x;
pos_cpy.x = temp_y - prev_odm_width;
} else {
swap(pos_cpy.x, pos_cpy.y);
}
pos_cpy.y = pipe_ctx->plane_res.scl_data.recout.height - pos_cpy.x;
pos_cpy.x = temp_y - prev_odm_width;
} else if (param.rotation == ROTATION_ANGLE_270) { } else if (param.rotation == ROTATION_ANGLE_270) {
// Swap axis and mirror vertically // Swap axis and mirror vertically
uint32_t temp_x = pos_cpy.x; uint32_t temp_x = pos_cpy.x;
...@@ -1279,8 +1284,15 @@ void dcn401_set_cursor_position(struct pipe_ctx *pipe_ctx) ...@@ -1279,8 +1284,15 @@ void dcn401_set_cursor_position(struct pipe_ctx *pipe_ctx)
pos_cpy.y = temp_x; pos_cpy.y = temp_x;
} }
} else { } else {
pos_cpy.x = pipe_ctx->plane_res.scl_data.recout.width - pos_cpy.y; if (param.mirror) {
pos_cpy.y = temp_x; swap(pos_cpy.x, pos_cpy.y);
pos_cpy.x = pipe_ctx->plane_res.scl_data.recout.width - pos_cpy.x + 2 * pipe_ctx->plane_res.scl_data.recout.x;
pos_cpy.y = (2 * pipe_ctx->plane_res.scl_data.recout.y) + pipe_ctx->plane_res.scl_data.recout.height - pos_cpy.y;
} else {
pos_cpy.x = pipe_ctx->plane_res.scl_data.recout.width - pos_cpy.y;
pos_cpy.y = temp_x;
}
} }
} else if (param.rotation == ROTATION_ANGLE_180) { } else if (param.rotation == ROTATION_ANGLE_180) {
// Mirror horizontally and vertically // Mirror horizontally and vertically
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment