Skip to content

Commit d243b6f

Browse files
Nicholas Kazlauskasalexdeucher
authored andcommitted
drm/amd/display: Make cursor source translation adjustment optional
[Why] In some usecases, like tiled display, the stream and plane configuration can be setup in a way where the caller expects DAL to perform the clipping, eg: P0: src_rect(0, 0, w, h) dst_rect(0, 0, w, h) P1: src_rect(w, 0, w, h) dst_rect(0, 0, w, h) Cursor is enabled on both streams with the same position. This can result in double cursor on tiled display, even though this behavior is technically correct from the DC interface point of view. We need a mechanism to control this dynamically. [How] This is something that should live in the DM layer based on detection of the specified configuration but it's not something that we really have enough information to deal with today. Add a flag to the cursor position state that specifies whether we want DC to do the translation or not and make it opt-in and let the DM decide when to do it. Signed-off-by: Nicholas Kazlauskas <[email protected]> Reviewed-by: Tony Cheng <[email protected]> Acked-by: Rodrigo Siqueira <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 3bae201 commit d243b6f

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6283,6 +6283,7 @@ static int get_cursor_position(struct drm_plane *plane, struct drm_crtc *crtc,
62836283
y = 0;
62846284
}
62856285
position->enable = true;
6286+
position->translate_by_source = true;
62866287
position->x = x;
62876288
position->y = y;
62886289
position->x_hotspot = xorigin;

drivers/gpu/drm/amd/display/dc/dc_hw_types.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,8 @@ struct dc_cursor_position {
385385
*/
386386
bool enable;
387387

388+
/* Translate cursor x/y by the source rectangle for each plane. */
389+
bool translate_by_source;
388390
};
389391

390392
struct dc_cursor_mi_param {

drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2692,9 +2692,15 @@ void dce110_set_cursor_position(struct pipe_ctx *pipe_ctx)
26922692
*
26932693
* This translation isn't affected by scaling so it needs to be
26942694
* done *after* we adjust the position for the scale factor.
2695+
*
2696+
* This is only done by opt-in for now since there are still
2697+
* some usecases like tiled display that might enable the
2698+
* cursor on both streams while expecting dc to clip it.
26952699
*/
2696-
pos_cpy.x += pipe_ctx->plane_state->src_rect.x;
2697-
pos_cpy.y += pipe_ctx->plane_state->src_rect.y;
2700+
if (pos_cpy.translate_by_source) {
2701+
pos_cpy.x += pipe_ctx->plane_state->src_rect.x;
2702+
pos_cpy.y += pipe_ctx->plane_state->src_rect.y;
2703+
}
26982704

26992705
if (pipe_ctx->plane_state->address.type
27002706
== PLN_ADDR_TYPE_VIDEO_PROGRESSIVE)

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3050,9 +3050,15 @@ void dcn10_set_cursor_position(struct pipe_ctx *pipe_ctx)
30503050
*
30513051
* This translation isn't affected by scaling so it needs to be
30523052
* done *after* we adjust the position for the scale factor.
3053+
*
3054+
* This is only done by opt-in for now since there are still
3055+
* some usecases like tiled display that might enable the
3056+
* cursor on both streams while expecting dc to clip it.
30533057
*/
3054-
x_pos += pipe_ctx->plane_state->src_rect.x;
3055-
y_pos += pipe_ctx->plane_state->src_rect.y;
3058+
if (pos_cpy.translate_by_source) {
3059+
x_pos += pipe_ctx->plane_state->src_rect.x;
3060+
y_pos += pipe_ctx->plane_state->src_rect.y;
3061+
}
30563062

30573063
/**
30583064
* If the position is negative then we need to add to the hotspot

0 commit comments

Comments
 (0)