[PATCH 4/5] hw/xfree86: Fix VGA arbiter screen proc wrapping

Keith Packard keithp at keithp.com
Fri Apr 18 14:31:19 PDT 2014


Change the screen proc epilog code to re-fetch the current screen
function in case a nested proc changes how things work. This isn't a
problem with the current code as all of the wrapping layers that are
set up at server init time (like the VGA arbiter) leave themselves in
the screen proc chain forever. But, this makes the code conform with
the expected norms.

Signed-off-by: Keith Packard <keithp at keithp.com>
---
 hw/xfree86/common/xf86VGAarbiterPriv.h | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/hw/xfree86/common/xf86VGAarbiterPriv.h b/hw/xfree86/common/xf86VGAarbiterPriv.h
index ec21bc2..b832c9a 100644
--- a/hw/xfree86/common/xf86VGAarbiterPriv.h
+++ b/hw/xfree86/common/xf86VGAarbiterPriv.h
@@ -49,10 +49,14 @@
 
 #define UNWRAP_SCREEN(x) pScreen->x = pScreenPriv->x
 
-#define SCREEN_PROLOG(x) pScreen->x = ((VGAarbiterScreenPtr) \
-    dixLookupPrivate(&(pScreen)->devPrivates, VGAarbiterScreenKey))->x
+#define SCREEN_PRIV()   ((VGAarbiterScreenPtr) dixLookupPrivate(&(pScreen)->devPrivates, VGAarbiterScreenKey))
 
-#define SCREEN_EPILOG(x,y) pScreen->x = y;
+#define SCREEN_PROLOG(x) (pScreen->x = SCREEN_PRIV()->x)
+
+#define SCREEN_EPILOG(x,y) do {                 \
+        SCREEN_PRIV()->x = pScreen->x;          \
+        pScreen->x = y;                         \
+    } while (0)
 
 #define WRAP_PICT(x,y) if (ps) {pScreenPriv->x = ps->x;\
     ps->x = y;}
-- 
1.9.2



More information about the xorg-devel mailing list