[PATCH xserver 2/3] xf86Cursor: Use CursoreRec::bits->x/yhot in xf86SetCursor

Michel Dänzer michel at daenzer.net
Wed Oct 5 09:41:37 UTC 2016


From: Michel Dänzer <michel.daenzer at amd.com>

xf86CursorScreenRec::HotX/Y contain 0 for PRIME slave screens.

Fixes intermittent incorrect HW cursor position on PRIME slave screens
when switching between cursors with different hotspot positions.

Also hoist the hotspot translation out from xf86ScreenSetCursor to
xf86SetCursor, since the hotspot position is a property of the cursor,
not the screen.

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 hw/xfree86/ramdac/xf86HWCurs.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/hw/xfree86/ramdac/xf86HWCurs.c b/hw/xfree86/ramdac/xf86HWCurs.c
index 8feb767..ddfd7c4 100644
--- a/hw/xfree86/ramdac/xf86HWCurs.c
+++ b/hw/xfree86/ramdac/xf86HWCurs.c
@@ -179,8 +179,8 @@ xf86ScreenSetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y)
     bits =
         dixLookupScreenPrivate(&pCurs->devPrivates, CursorScreenKey, pScreen);
 
-    x -= infoPtr->pScrn->frameX0 + ScreenPriv->HotX;
-    y -= infoPtr->pScrn->frameY0 + ScreenPriv->HotY;
+    x -= infoPtr->pScrn->frameX0;
+    y -= infoPtr->pScrn->frameY0;
 
     if (!pCurs->bits->argb || !xf86DriverHasLoadCursorARGB(infoPtr))
         if (!bits) {
@@ -213,6 +213,9 @@ xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y)
 {
     ScreenPtr pSlave;
 
+    x -= pCurs->bits->xhot;
+    y -= pCurs->bits->yhot;
+
     if (!xf86ScreenSetCursor(pScreen, pCurs, x, y))
         return FALSE;
 
-- 
2.9.3



More information about the xorg-devel mailing list