[PATCH xserver] xfree86: Hold input_lock across SPRITE functions in VGA arbiter

Keith Packard keithp at keithp.com
Thu Aug 3 04:34:52 UTC 2017


Avoid scrambling the sprite functions wrapper.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101995
Signed-off-by: Keith Packard <keithp at keithp.com>
---
 hw/xfree86/common/xf86VGAarbiterPriv.h | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/hw/xfree86/common/xf86VGAarbiterPriv.h b/hw/xfree86/common/xf86VGAarbiterPriv.h
index 09be10aa3..03db55700 100644
--- a/hw/xfree86/common/xf86VGAarbiterPriv.h
+++ b/hw/xfree86/common/xf86VGAarbiterPriv.h
@@ -73,14 +73,20 @@
 
 #define UNWRAP_SCREEN_INFO(x) pScrn->x = pScreenPriv->x
 
-#define SPRITE_PROLOG miPointerScreenPtr PointPriv = \
-    (miPointerScreenPtr)dixLookupPrivate(&pScreen->devPrivates, \
-    miPointerScreenKey); VGAarbiterScreenPtr pScreenPriv = \
-    ((VGAarbiterScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, \
-    VGAarbiterScreenKey)); PointPriv->spriteFuncs = pScreenPriv->miSprite;
+#define SPRITE_PROLOG                                           \
+    miPointerScreenPtr PointPriv;                               \
+    VGAarbiterScreenPtr pScreenPriv;                            \
+    input_lock();                                               \
+    PointPriv = dixLookupPrivate(&pScreen->devPrivates,         \
+                                 miPointerScreenKey);           \
+    pScreenPriv = dixLookupPrivate(&(pScreen)->devPrivates,     \
+                                   VGAarbiterScreenKey);        \
+    PointPriv->spriteFuncs = pScreenPriv->miSprite;             \
 
-#define SPRITE_EPILOG pScreenPriv->miSprite = PointPriv->spriteFuncs;\
-    PointPriv->spriteFuncs  = &VGAarbiterSpriteFuncs;
+#define SPRITE_EPILOG                                   \
+    pScreenPriv->miSprite = PointPriv->spriteFuncs;     \
+    PointPriv->spriteFuncs  = &VGAarbiterSpriteFuncs;   \
+    input_unlock();
 
 #define WRAP_SPRITE do { pScreenPriv->miSprite = PointPriv->spriteFuncs;\
     	PointPriv->spriteFuncs  = &VGAarbiterSpriteFuncs; 		\
-- 
2.13.3



More information about the xorg-devel mailing list