Skip to content

Commit 56b922c

Browse files
Nicholas Kazlauskasalexdeucher
authored andcommitted
drm/amd/display: Fix incorrect cursor pos on scaled primary plane
[Why] Cursor pos is correctly adjusted from DC side for source rect offset on DCN ASIC, but only on the overlay. This is because DM places offsets the cursor for primary planes only to workaround missing code in DCE for the adjustment we're now correctly doing in DC for DCN ASIC. [How] Drop the adjustment for source rect from the DM side of things and put the code where it actually belongs - in DC on the pipe level. This matches what we do for DCN now. Signed-off-by: Nicholas Kazlauskas <[email protected]> Reviewed-by: Zhan Liu <[email protected]> Acked-by: Rodrigo Siqueira <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent a754d13 commit 56b922c

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6274,12 +6274,6 @@ static int get_cursor_position(struct drm_plane *plane, struct drm_crtc *crtc,
62746274
y <= -amdgpu_crtc->max_cursor_height)
62756275
return 0;
62766276

6277-
if (crtc->primary->state) {
6278-
/* avivo cursor are offset into the total surface */
6279-
x += crtc->primary->state->src_x >> 16;
6280-
y += crtc->primary->state->src_y >> 16;
6281-
}
6282-
62836277
if (x < 0) {
62846278
xorigin = min(-x, amdgpu_crtc->max_cursor_width - 1);
62856279
x = 0;

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2685,6 +2685,17 @@ void dce110_set_cursor_position(struct pipe_ctx *pipe_ctx)
26852685
.mirror = pipe_ctx->plane_state->horizontal_mirror
26862686
};
26872687

2688+
/**
2689+
* If the cursor's source viewport is clipped then we need to
2690+
* translate the cursor to appear in the correct position on
2691+
* the screen.
2692+
*
2693+
* This translation isn't affected by scaling so it needs to be
2694+
* done *after* we adjust the position for the scale factor.
2695+
*/
2696+
pos_cpy.x += pipe_ctx->plane_state->src_rect.x;
2697+
pos_cpy.y += pipe_ctx->plane_state->src_rect.y;
2698+
26882699
if (pipe_ctx->plane_state->address.type
26892700
== PLN_ADDR_TYPE_VIDEO_PROGRESSIVE)
26902701
pos_cpy.enable = false;

0 commit comments

Comments
 (0)