Skip to contentSkip to conversation

drm/radeon/kms: fix cursor image off-by-one error

PATCH In review Nicholas Miell 2 participants 2 messages Sep 30, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/radeon/kms: fix cursor image off-by-one error

The mouse cursor hotspot calculation when the cursor is partially off the top or left side of the screen was off by one.

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=41158

---
 drivers/gpu/drm/radeon/radeon_cursor.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/radeon_cursor.c +2 -2
index 3189a7e..c495575 100644
@@ -209,9 +209,9 @@ int radeon_crtc_cursor_move(struct drm_crtc *crtc,
 	int w = radeon_crtc->cursor_width;
 
 	if (x < 0)
-		xorigin = -x + 1;
+		xorigin = -x;
 	if (y < 0)
-		yorigin = -y + 1;
+		yorigin = -y;
 	if (xorigin >= CURSOR_WIDTH)
 		xorigin = CURSOR_WIDTH - 1;
 	if (yorigin >= CURSOR_HEIGHT)
Signature · 1 line
1.7.6.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 16 lines · Nicholas Miell

The mouse cursor hotspot calculation when the cursor is partially off the top or left side of the screen was off by one.

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=41158

---
 drivers/gpu/drm/radeon/radeon_cursor.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/radeon_cursor.c +0 -0
index 3189a7e..c495575 100644
@@ -209,9 +209,9 @@ int radeon_crtc_cursor_move(struct drm_crtc *crtc,
 	int w = radeon_crtc->cursor_width;

drivers/gpu/drm/radeon/radeon_cursor.c int radeon_crtc_cursor_move(struct drm_crtc *crtc, · line 217

Quoted 10 lines
drivers/gpu/drm/radeon/radeon_cursor.c +2 -2
 
 	if (x < 0)
-		xorigin = -x + 1;
+		xorigin = -x;
 	if (y < 0)
-		yorigin = -y + 1;
+		yorigin = -y;
 	if (xorigin >= CURSOR_WIDTH)
 		xorigin = CURSOR_WIDTH - 1;
 	if (yorigin >= CURSOR_HEIGHT)

While you're at it, might be worth combining with the lines below to something like

	if (x < 0)
		xorigin = min(-x, CURSOR_WIDTH - 1);
        if (y < 0)
                yorigin = min(-y, CURSOR_HEIGHT - 1);

Either way though,

.

Signature · 6 lines
Earthling Michel Dänzer           |                   http://www.amd.com
Libre software enthusiast         |          Debian, X and DRI developer
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel