Skip to content

Commit 02e6859

Browse files
Michel Dänzerairlied
authored andcommitted
drm/radeon: Set cursor x/y to 0 when x/yorigin > 0.
Apart from the obvious cleanup, this should make the line cursor_end = x - xorigin + w; correct now. Signed-off-by: Michel Dänzer <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
1 parent b8aee29 commit 02e6859

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

drivers/gpu/drm/radeon/radeon_cursor.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,14 @@ int radeon_crtc_cursor_move(struct drm_crtc *crtc,
215215
}
216216
DRM_DEBUG("x %d y %d c->x %d c->y %d\n", x, y, crtc->x, crtc->y);
217217

218-
if (x < 0)
218+
if (x < 0) {
219219
xorigin = min(-x, CURSOR_WIDTH - 1);
220-
if (y < 0)
220+
x = 0;
221+
}
222+
if (y < 0) {
221223
yorigin = min(-y, CURSOR_HEIGHT - 1);
224+
y = 0;
225+
}
222226

223227
if (ASIC_IS_AVIVO(rdev)) {
224228
int i = 0;
@@ -251,16 +255,12 @@ int radeon_crtc_cursor_move(struct drm_crtc *crtc,
251255

252256
radeon_lock_cursor(crtc, true);
253257
if (ASIC_IS_DCE4(rdev)) {
254-
WREG32(EVERGREEN_CUR_POSITION + radeon_crtc->crtc_offset,
255-
((xorigin ? 0 : x) << 16) |
256-
(yorigin ? 0 : y));
258+
WREG32(EVERGREEN_CUR_POSITION + radeon_crtc->crtc_offset, (x << 16) | y);
257259
WREG32(EVERGREEN_CUR_HOT_SPOT + radeon_crtc->crtc_offset, (xorigin << 16) | yorigin);
258260
WREG32(EVERGREEN_CUR_SIZE + radeon_crtc->crtc_offset,
259261
((w - 1) << 16) | (radeon_crtc->cursor_height - 1));
260262
} else if (ASIC_IS_AVIVO(rdev)) {
261-
WREG32(AVIVO_D1CUR_POSITION + radeon_crtc->crtc_offset,
262-
((xorigin ? 0 : x) << 16) |
263-
(yorigin ? 0 : y));
263+
WREG32(AVIVO_D1CUR_POSITION + radeon_crtc->crtc_offset, (x << 16) | y);
264264
WREG32(AVIVO_D1CUR_HOT_SPOT + radeon_crtc->crtc_offset, (xorigin << 16) | yorigin);
265265
WREG32(AVIVO_D1CUR_SIZE + radeon_crtc->crtc_offset,
266266
((w - 1) << 16) | (radeon_crtc->cursor_height - 1));
@@ -274,8 +274,8 @@ int radeon_crtc_cursor_move(struct drm_crtc *crtc,
274274
| yorigin));
275275
WREG32(RADEON_CUR_HORZ_VERT_POSN + radeon_crtc->crtc_offset,
276276
(RADEON_CUR_LOCK
277-
| ((xorigin ? 0 : x) << 16)
278-
| (yorigin ? 0 : y)));
277+
| (x << 16)
278+
| y));
279279
/* offset is from DISP(2)_BASE_ADDRESS */
280280
WREG32(RADEON_CUR_OFFSET + radeon_crtc->crtc_offset, (radeon_crtc->legacy_cursor_offset +
281281
(yorigin * 256)));

0 commit comments

Comments
 (0)