summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2016-10-05 18:28:45 +0900
committerMichel Dänzer <michel@daenzer.net>2016-10-13 18:31:23 +0900
commit9cf0bd4d4507dca6234024605b14724713f2109e (patch)
treeb1d00fabac840e9b07766f10f4e2eab472eb08ef
parent011ce3297d924e78ef0254b0451561946bd8be8d (diff)
xf86Cursor: Take the input lock in xf86Set/MoveCursor
Prevents the HW cursor from intermittently jumping around when the cursor image is changed while the cursor is being moved. This is hardly noticeable in normal operation but can be quite confusing when stepping through these codepaths in a debugger. Reviewed-by: Hans de Goede <hdegoede@redhat.com>
-rw-r--r--hw/xfree86/ramdac/xf86HWCurs.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/hw/xfree86/ramdac/xf86HWCurs.c b/hw/xfree86/ramdac/xf86HWCurs.c
index c45590229..da2b18101 100644
--- a/hw/xfree86/ramdac/xf86HWCurs.c
+++ b/hw/xfree86/ramdac/xf86HWCurs.c
@@ -215,12 +215,15 @@ xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y)
(xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
xf86CursorScreenKey);
ScreenPtr pSlave;
+ Bool ret = FALSE;
+
+ input_lock();
x -= ScreenPriv->HotX;
y -= ScreenPriv->HotY;
if (!xf86ScreenSetCursor(pScreen, pCurs, x, y))
- return FALSE;
+ goto out;
/* ask each slave driver to set the cursor. */
xorg_list_for_each_entry(pSlave, &pScreen->slave_list, slave_head) {
@@ -233,10 +236,14 @@ xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y)
* otherwise both the hw and sw cursor will show.
*/
xf86SetCursor(pScreen, NullCursor, x, y);
- return FALSE;
+ goto out;
}
}
- return TRUE;
+ ret = TRUE;
+
+ out:
+ input_unlock();
+ return ret;
}
void
@@ -283,6 +290,8 @@ xf86MoveCursor(ScreenPtr pScreen, int x, int y)
xf86CursorScreenKey);
ScreenPtr pSlave;
+ input_lock();
+
x -= ScreenPriv->HotX;
y -= ScreenPriv->HotY;
@@ -295,6 +304,8 @@ xf86MoveCursor(ScreenPtr pScreen, int x, int y)
xf86ScreenMoveCursor(pSlave, x, y);
}
+
+ input_unlock();
}
void