From 79a2733005202af43821d8fd8e4c9fb77bf8f69e Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 18 Apr 2014 14:11:17 -0700 Subject: [PATCH] hw/xfree86: Fix VGA arbiter screen proc wrapping 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 Reviewed-by: Eric Anholt --- 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 ec21bc2f2..b832c9a5f 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;}