Skip to content

Commit c2edec1

Browse files
Sridevialexdeucher
authored andcommitted
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: Rodrigo Siqueira <[email protected]> Signed-off-by: Sridevi <[email protected]> Acked-by: Harry Wentland <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 3c603b1 commit c2edec1

File tree

2 files changed

+34
-14
lines changed

2 files changed

+34
-14
lines changed

drivers/gpu/drm/amd/display/dc/dpp/dcn401/dcn401_dpp_cm.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -185,15 +185,23 @@ void dpp401_set_cursor_position(
185185
rec_y_offset = y_pos - (cursor_height - y_hotspot);
186186
}
187187

188-
if (rec_x_offset >= (int)param->recout.width)
189-
cur_en = 0; /* not visible beyond right edge*/
188+
if (param->rotation == ROTATION_ANGLE_0 && !param->mirror) {
189+
if (rec_x_offset >= (int)param->recout.width)
190+
cur_en = 0; /* not visible beyond right edge*/
191+
192+
if (rec_y_offset >= (int)param->recout.height)
193+
cur_en = 0; /* not visible beyond bottom edge*/
194+
} else {
195+
if (rec_x_offset > (int)param->recout.width)
196+
cur_en = 0; /* not visible beyond right edge*/
197+
198+
if (rec_y_offset > (int)param->recout.height)
199+
cur_en = 0; /* not visible beyond bottom edge*/
200+
}
190201

191202
if (rec_x_offset + cursor_width <= 0)
192203
cur_en = 0; /* not visible beyond left edge*/
193204

194-
if (rec_y_offset >= (int)param->recout.height)
195-
cur_en = 0; /* not visible beyond bottom edge*/
196-
197205
if (rec_y_offset + cursor_height <= 0)
198206
cur_en = 0; /* not visible beyond top edge*/
199207

drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,14 +1126,14 @@ void dcn401_set_cursor_position(struct pipe_ctx *pipe_ctx)
11261126
*/
11271127

11281128
if (param.rotation == ROTATION_ANGLE_90 || param.rotation == ROTATION_ANGLE_270) {
1129-
x_pos = x_pos * pipe_ctx->stream->dst.width /
1129+
x_pos = pipe_ctx->stream->dst.x + x_pos * pipe_ctx->stream->dst.width /
11301130
pipe_ctx->stream->src.height;
1131-
y_pos = y_pos * pipe_ctx->stream->dst.height /
1131+
y_pos = pipe_ctx->stream->dst.y + y_pos * pipe_ctx->stream->dst.height /
11321132
pipe_ctx->stream->src.width;
11331133
} else {
1134-
x_pos = x_pos * pipe_ctx->stream->dst.width /
1134+
x_pos = pipe_ctx->stream->dst.x + x_pos * pipe_ctx->stream->dst.width /
11351135
pipe_ctx->stream->src.width;
1136-
y_pos = y_pos * pipe_ctx->stream->dst.height /
1136+
y_pos = pipe_ctx->stream->dst.y + y_pos * pipe_ctx->stream->dst.height /
11371137
pipe_ctx->stream->src.height;
11381138
}
11391139

@@ -1225,10 +1225,15 @@ void dcn401_set_cursor_position(struct pipe_ctx *pipe_ctx)
12251225
}
12261226
}
12271227
} else if (param.rotation == ROTATION_ANGLE_90) {
1228-
uint32_t temp_y = pos_cpy.y;
1228+
if (!param.mirror) {
1229+
uint32_t temp_y = pos_cpy.y;
1230+
1231+
pos_cpy.y = pipe_ctx->plane_res.scl_data.recout.height - pos_cpy.x;
1232+
pos_cpy.x = temp_y - prev_odm_width;
1233+
} else {
1234+
swap(pos_cpy.x, pos_cpy.y);
1235+
}
12291236

1230-
pos_cpy.y = pipe_ctx->plane_res.scl_data.recout.height - pos_cpy.x;
1231-
pos_cpy.x = temp_y - prev_odm_width;
12321237
} else if (param.rotation == ROTATION_ANGLE_270) {
12331238
// Swap axis and mirror vertically
12341239
uint32_t temp_x = pos_cpy.x;
@@ -1279,8 +1284,15 @@ void dcn401_set_cursor_position(struct pipe_ctx *pipe_ctx)
12791284
pos_cpy.y = temp_x;
12801285
}
12811286
} else {
1282-
pos_cpy.x = pipe_ctx->plane_res.scl_data.recout.width - pos_cpy.y;
1283-
pos_cpy.y = temp_x;
1287+
if (param.mirror) {
1288+
swap(pos_cpy.x, pos_cpy.y);
1289+
1290+
pos_cpy.x = pipe_ctx->plane_res.scl_data.recout.width - pos_cpy.x + 2 * pipe_ctx->plane_res.scl_data.recout.x;
1291+
pos_cpy.y = (2 * pipe_ctx->plane_res.scl_data.recout.y) + pipe_ctx->plane_res.scl_data.recout.height - pos_cpy.y;
1292+
} else {
1293+
pos_cpy.x = pipe_ctx->plane_res.scl_data.recout.width - pos_cpy.y;
1294+
pos_cpy.y = temp_x;
1295+
}
12841296
}
12851297
} else if (param.rotation == ROTATION_ANGLE_180) {
12861298
// Mirror horizontally and vertically

0 commit comments

Comments
 (0)