[PATCH 02/19] xserver: convert block/wakeup handlers to passing ScreenPtr (ABI/API break)

Dave Airlie airlied at gmail.com
Mon May 14 09:40:55 PDT 2012


Instead of passing an index, pass the actual ScreenPtr. This allows
more moving towards not abusing xf86Screens + screenInfo.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 composite/compalloc.c                  |    5 ++---
 dix/dixutils.c                         |    4 ++--
 exa/exa.c                              |   12 ++++--------
 hw/kdrive/src/kdrive.h                 |    4 ++--
 hw/kdrive/src/kinput.c                 |    4 ++--
 hw/xfree86/common/xf86VGAarbiter.c     |   12 ++++--------
 hw/xfree86/common/xf86VGAarbiterPriv.h |    4 ++--
 hw/xfree86/dri/dri.c                   |   10 ++++------
 hw/xfree86/dri/dri.h                   |    4 ++--
 hw/xfree86/modes/xf86Rotate.c          |    7 +++----
 hw/xwin/win.h                          |    4 ++--
 hw/xwin/winblock.c                     |    2 +-
 hw/xwin/winwakeup.c                    |    2 +-
 include/scrnintstr.h                   |    4 ++--
 mi/misprite.c                          |    7 +++----
 render/animcur.c                       |    5 ++---
 16 files changed, 38 insertions(+), 52 deletions(-)

diff --git a/composite/compalloc.c b/composite/compalloc.c
index 15a6cd2..ea8fa99 100644
--- a/composite/compalloc.c
+++ b/composite/compalloc.c
@@ -55,14 +55,13 @@ compScreenUpdate(ScreenPtr pScreen)
 }
 
 static void
-compBlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadmask)
+compBlockHandler(ScreenPtr pScreen, pointer blockData, pointer pTimeout, pointer pReadmask)
 {
-    ScreenPtr pScreen = screenInfo.screens[i];
     CompScreenPtr cs = GetCompScreen(pScreen);
 
     pScreen->BlockHandler = cs->BlockHandler;
     compScreenUpdate(pScreen);
-    (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask);
+    (*pScreen->BlockHandler) (pScreen, blockData, pTimeout, pReadmask);
 
     /* Next damage will restore the block handler */
     cs->BlockHandler = NULL;
diff --git a/dix/dixutils.c b/dix/dixutils.c
index 9eb5489..8abd398 100644
--- a/dix/dixutils.c
+++ b/dix/dixutils.c
@@ -384,7 +384,7 @@ BlockHandler(pointer pTimeout, pointer pReadmask)
 
     ++inHandler;
     for (i = 0; i < screenInfo.numScreens; i++)
-        (*screenInfo.screens[i]->BlockHandler) (i,
+        (*screenInfo.screens[i]->BlockHandler) (screenInfo.screens[i],
                                                 screenInfo.screens[i]->
                                                 blockData, pTimeout, pReadmask);
     for (i = 0; i < numHandlers; i++)
@@ -421,7 +421,7 @@ WakeupHandler(int result, pointer pReadmask)
             (*handlers[i].WakeupHandler) (handlers[i].blockData,
                                           result, pReadmask);
     for (i = 0; i < screenInfo.numScreens; i++)
-        (*screenInfo.screens[i]->WakeupHandler) (i,
+        (*screenInfo.screens[i]->WakeupHandler) (screenInfo.screens[i],
                                                  screenInfo.screens[i]->
                                                  wakeupData, result, pReadmask);
     if (handlerDeleted) {
diff --git a/exa/exa.c b/exa/exa.c
index b5eb44e..70ac896 100644
--- a/exa/exa.c
+++ b/exa/exa.c
@@ -707,11 +707,9 @@ exaCreateScreenResources(ScreenPtr pScreen)
 }
 
 static void
-ExaBlockHandler(int screenNum, pointer blockData, pointer pTimeout,
+ExaBlockHandler(ScreenPtr pScreen, pointer blockData, pointer pTimeout,
                 pointer pReadmask)
 {
-    ScreenPtr pScreen = screenInfo.screens[screenNum];
-
     ExaScreenPriv(pScreen);
 
     /* Move any deferred results from a software fallback to the driver pixmap */
@@ -719,7 +717,7 @@ ExaBlockHandler(int screenNum, pointer blockData, pointer pTimeout,
         exaMoveInPixmap_mixed(pExaScr->deferred_mixed_pixmap);
 
     unwrap(pExaScr, pScreen, BlockHandler);
-    (*pScreen->BlockHandler) (screenNum, blockData, pTimeout, pReadmask);
+    (*pScreen->BlockHandler) (pScreen, blockData, pTimeout, pReadmask);
     wrap(pExaScr, pScreen, BlockHandler, ExaBlockHandler);
 
     /* The rest only applies to classic EXA */
@@ -739,15 +737,13 @@ ExaBlockHandler(int screenNum, pointer blockData, pointer pTimeout,
 }
 
 static void
-ExaWakeupHandler(int screenNum, pointer wakeupData, unsigned long result,
+ExaWakeupHandler(ScreenPtr pScreen, pointer wakeupData, unsigned long result,
                  pointer pReadmask)
 {
-    ScreenPtr pScreen = screenInfo.screens[screenNum];
-
     ExaScreenPriv(pScreen);
 
     unwrap(pExaScr, pScreen, WakeupHandler);
-    (*pScreen->WakeupHandler) (screenNum, wakeupData, result, pReadmask);
+    (*pScreen->WakeupHandler) (pScreen, wakeupData, result, pReadmask);
     wrap(pExaScr, pScreen, WakeupHandler, ExaWakeupHandler);
 
     if (result == 0 && pExaScr->numOffscreenAvailable > 1) {
diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h
index 04a1cf7..293f4e9 100644
--- a/hw/kdrive/src/kdrive.h
+++ b/hw/kdrive/src/kdrive.h
@@ -537,12 +537,12 @@ void
 
 void
 
-KdBlockHandler(int screen,
+KdBlockHandler(ScreenPtr pScreen,
                pointer blockData, pointer timeout, pointer readmask);
 
 void
 
-KdWakeupHandler(int screen,
+KdWakeupHandler(ScreenPtr pScreen,
                 pointer data, unsigned long result, pointer readmask);
 
 void
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index e16fe78..aed5a6a 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -1974,7 +1974,7 @@ _KdEnqueuePointerEvent(KdPointerInfo * pi, int type, int x, int y, int z,
 }
 
 void
-KdBlockHandler(int screen, pointer blockData, pointer timeout, pointer readmask)
+KdBlockHandler(ScreenPtr pScreen, pointer blockData, pointer timeout, pointer readmask)
 {
     KdPointerInfo *pi;
     int myTimeout = 0;
@@ -2000,7 +2000,7 @@ KdBlockHandler(int screen, pointer blockData, pointer timeout, pointer readmask)
 }
 
 void
-KdWakeupHandler(int screen,
+KdWakeupHandler(ScreenPtr pScreen,
                 pointer data, unsigned long lresult, pointer readmask)
 {
     int result = (int) lresult;
diff --git a/hw/xfree86/common/xf86VGAarbiter.c b/hw/xfree86/common/xf86VGAarbiter.c
index ea40cd8..217016e 100644
--- a/hw/xfree86/common/xf86VGAarbiter.c
+++ b/hw/xfree86/common/xf86VGAarbiter.c
@@ -265,27 +265,23 @@ VGAarbiterCloseScreen(ScreenPtr pScreen)
 }
 
 static void
-VGAarbiterBlockHandler(int i,
+VGAarbiterBlockHandler(ScreenPtr pScreen,
                        pointer blockData, pointer pTimeout, pointer pReadmask)
 {
-    ScreenPtr pScreen = screenInfo.screens[i];
-
     SCREEN_PROLOG(BlockHandler);
     VGAGet(pScreen);
-    pScreen->BlockHandler(i, blockData, pTimeout, pReadmask);
+    pScreen->BlockHandler(pScreen, blockData, pTimeout, pReadmask);
     VGAPut();
     SCREEN_EPILOG(BlockHandler, VGAarbiterBlockHandler);
 }
 
 static void
-VGAarbiterWakeupHandler(int i, pointer blockData, unsigned long result,
+VGAarbiterWakeupHandler(ScreenPtr pScreen, pointer blockData, unsigned long result,
                         pointer pReadmask)
 {
-    ScreenPtr pScreen = screenInfo.screens[i];
-
     SCREEN_PROLOG(WakeupHandler);
     VGAGet(pScreen);
-    pScreen->WakeupHandler(i, blockData, result, pReadmask);
+    pScreen->WakeupHandler(pScreen, blockData, result, pReadmask);
     VGAPut();
     SCREEN_EPILOG(WakeupHandler, VGAarbiterWakeupHandler);
 }
diff --git a/hw/xfree86/common/xf86VGAarbiterPriv.h b/hw/xfree86/common/xf86VGAarbiterPriv.h
index 92a0cb6..e0f4e53 100644
--- a/hw/xfree86/common/xf86VGAarbiterPriv.h
+++ b/hw/xfree86/common/xf86VGAarbiterPriv.h
@@ -142,9 +142,9 @@ typedef struct _VGAarbiterGC {
 } VGAarbiterGCRec, *VGAarbiterGCPtr;
 
 /* Screen funcs */
-static void VGAarbiterBlockHandler(int i, pointer blockData, pointer pTimeout,
+static void VGAarbiterBlockHandler(ScreenPtr pScreen, pointer blockData, pointer pTimeout,
                                    pointer pReadmask);
-static void VGAarbiterWakeupHandler(int i, pointer blockData,
+static void VGAarbiterWakeupHandler(ScreenPtr pScreen, pointer blockData,
                                     unsigned long result, pointer pReadmask);
 static Bool VGAarbiterCloseScreen(ScreenPtr pScreen);
 static void VGAarbiterGetImage(DrawablePtr pDrawable, int sx, int sy, int w,
diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c
index 20eb683..ceb92c2 100644
--- a/hw/xfree86/dri/dri.c
+++ b/hw/xfree86/dri/dri.c
@@ -1618,7 +1618,7 @@ DRIWakeupHandler(pointer wakeupData, int result, pointer pReadmask)
         DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
 
         if (pDRIPriv && pDRIPriv->pDriverInfo->wrap.WakeupHandler)
-            (*pDRIPriv->pDriverInfo->wrap.WakeupHandler) (i, wakeupData,
+            (*pDRIPriv->pDriverInfo->wrap.WakeupHandler) (pScreen, wakeupData,
                                                           result, pReadmask);
     }
 }
@@ -1633,16 +1633,15 @@ DRIBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadmask)
         DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
 
         if (pDRIPriv && pDRIPriv->pDriverInfo->wrap.BlockHandler)
-            (*pDRIPriv->pDriverInfo->wrap.BlockHandler) (i, blockData,
+            (*pDRIPriv->pDriverInfo->wrap.BlockHandler) (pScreen, blockData,
                                                          pTimeout, pReadmask);
     }
 }
 
 void
-DRIDoWakeupHandler(int screenNum, pointer wakeupData,
+DRIDoWakeupHandler(ScreenPtr pScreen, pointer wakeupData,
                    unsigned long result, pointer pReadmask)
 {
-    ScreenPtr pScreen = screenInfo.screens[screenNum];
     DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
 
     DRILock(pScreen, 0);
@@ -1658,10 +1657,9 @@ DRIDoWakeupHandler(int screenNum, pointer wakeupData,
 }
 
 void
-DRIDoBlockHandler(int screenNum, pointer blockData,
+DRIDoBlockHandler(ScreenPtr pScreen, pointer blockData,
                   pointer pTimeout, pointer pReadmask)
 {
-    ScreenPtr pScreen = screenInfo.screens[screenNum];
     DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
 
     if (pDRIPriv->pDriverInfo->driverSwapMethod == DRI_HIDE_X_CONTEXT) {
diff --git a/hw/xfree86/dri/dri.h b/hw/xfree86/dri/dri.h
index 53458bb..664a50e 100644
--- a/hw/xfree86/dri/dri.h
+++ b/hw/xfree86/dri/dri.h
@@ -271,12 +271,12 @@ extern _X_EXPORT void DRIWakeupHandler(pointer wakeupData,
 extern _X_EXPORT void DRIBlockHandler(pointer blockData,
                                       OSTimePtr pTimeout, pointer pReadmask);
 
-extern _X_EXPORT void DRIDoWakeupHandler(int screenNum,
+extern _X_EXPORT void DRIDoWakeupHandler(ScreenPtr pScreen,
                                          pointer wakeupData,
                                          unsigned long result,
                                          pointer pReadmask);
 
-extern _X_EXPORT void DRIDoBlockHandler(int screenNum,
+extern _X_EXPORT void DRIDoBlockHandler(ScreenPtr pScreen,
                                         pointer blockData,
                                         pointer pTimeout, pointer pReadmask);
 
diff --git a/hw/xfree86/modes/xf86Rotate.c b/hw/xfree86/modes/xf86Rotate.c
index 26eefc8..d9a2e8d 100644
--- a/hw/xfree86/modes/xf86Rotate.c
+++ b/hw/xfree86/modes/xf86Rotate.c
@@ -250,17 +250,16 @@ xf86RotateRedisplay(ScreenPtr pScreen)
 }
 
 static void
-xf86RotateBlockHandler(int screenNum, pointer blockData,
+xf86RotateBlockHandler(ScreenPtr pScreen, pointer blockData,
                        pointer pTimeout, pointer pReadmask)
 {
-    ScreenPtr pScreen = screenInfo.screens[screenNum];
-    ScrnInfoPtr pScrn = xf86Screens[screenNum];
+    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
     xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
     Bool rotation_active;
 
     rotation_active = xf86RotateRedisplay(pScreen);
     pScreen->BlockHandler = xf86_config->BlockHandler;
-    (*pScreen->BlockHandler) (screenNum, blockData, pTimeout, pReadmask);
+    (*pScreen->BlockHandler) (pScreen, blockData, pTimeout, pReadmask);
     /* cannot avoid re-wrapping until all wrapping is audited */
     xf86_config->BlockHandler = pScreen->BlockHandler;
     pScreen->BlockHandler = xf86RotateBlockHandler;
diff --git a/hw/xwin/win.h b/hw/xwin/win.h
index 8d17128..2bde18d 100644
--- a/hw/xwin/win.h
+++ b/hw/xwin/win.h
@@ -779,7 +779,7 @@ void winSetAuthorization(void);
 
 void
 
-winBlockHandler(int nScreen,
+winBlockHandler(ScreenPtr pScreen,
                 pointer pBlockData, pointer pTimeout, pointer pReadMask);
 
 #ifdef XWIN_NATIVEGDI
@@ -1122,7 +1122,7 @@ Bool
 
 void
 
-winWakeupHandler(int nScreen,
+winWakeupHandler(ScreenPtr pScreen,
                  pointer pWakeupData,
                  unsigned long ulResult, pointer pReadmask);
 
diff --git a/hw/xwin/winblock.c b/hw/xwin/winblock.c
index c18d080..5faa113 100644
--- a/hw/xwin/winblock.c
+++ b/hw/xwin/winblock.c
@@ -36,7 +36,7 @@
 
 /* See Porting Layer Definition - p. 6 */
 void
-winBlockHandler(int nScreen,
+winBlockHandler(ScreenPtr pScreen,
                 pointer pBlockData, pointer pTimeout, pointer pReadMask)
 {
 #if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
diff --git a/hw/xwin/winwakeup.c b/hw/xwin/winwakeup.c
index 1d2bfed..8c9140b 100644
--- a/hw/xwin/winwakeup.c
+++ b/hw/xwin/winwakeup.c
@@ -38,7 +38,7 @@
 
 /* See Porting Layer Definition - p. 7 */
 void
-winWakeupHandler(int nScreen,
+winWakeupHandler(ScreenPtr pScreen,
                  pointer pWakeupData, unsigned long ulResult, pointer pReadmask)
 {
     MSG msg;
diff --git a/include/scrnintstr.h b/include/scrnintstr.h
index f77ace7..dae4a2e 100644
--- a/include/scrnintstr.h
+++ b/include/scrnintstr.h
@@ -257,12 +257,12 @@ typedef void (*SendGraphicsExposeProcPtr) (ClientPtr /*client */ ,
                                            int /*major */ ,
                                            int /*minor */ );
 
-typedef void (*ScreenBlockHandlerProcPtr) (int /*screenNum */ ,
+typedef void (*ScreenBlockHandlerProcPtr) (ScreenPtr /*pScreen*/ ,
                                            pointer /*blockData */ ,
                                            pointer /*pTimeout */ ,
                                            pointer /*pReadmask */ );
 
-typedef void (*ScreenWakeupHandlerProcPtr) (int /*screenNum */ ,
+typedef void (*ScreenWakeupHandlerProcPtr) (ScreenPtr /*pScreen*/ ,
                                             pointer /*wakeupData */ ,
                                             unsigned long /*result */ ,
                                             pointer /*pReadMask */ );
diff --git a/mi/misprite.c b/mi/misprite.c
index 92fbe97..3c91e67 100644
--- a/mi/misprite.c
+++ b/mi/misprite.c
@@ -203,7 +203,7 @@ static void miSpriteSourceValidate(DrawablePtr pDrawable, int x, int y,
                                    unsigned int subWindowMode);
 static void miSpriteCopyWindow(WindowPtr pWindow,
                                DDXPointRec ptOldOrg, RegionPtr prgnSrc);
-static void miSpriteBlockHandler(int i, pointer blockData,
+static void miSpriteBlockHandler(ScreenPtr pScreen, pointer blockData,
                                  pointer pTimeout, pointer pReadMask);
 static void miSpriteInstallColormap(ColormapPtr pMap);
 static void miSpriteStoreColors(ColormapPtr pMap, int ndef, xColorItem * pdef);
@@ -520,10 +520,9 @@ miSpriteCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
 }
 
 static void
-miSpriteBlockHandler(int i, pointer blockData, pointer pTimeout,
+miSpriteBlockHandler(ScreenPtr pScreen, pointer blockData, pointer pTimeout,
                      pointer pReadmask)
 {
-    ScreenPtr pScreen = screenInfo.screens[i];
     miSpriteScreenPtr pPriv = GetSpriteScreen(pScreen);
     DeviceIntPtr pDev;
     miCursorInfoPtr pCursorInfo;
@@ -554,7 +553,7 @@ miSpriteBlockHandler(int i, pointer blockData, pointer pTimeout,
 
     SCREEN_PROLOGUE(pPriv, pScreen, BlockHandler);
 
-    (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask);
+    (*pScreen->BlockHandler) (pScreen, blockData, pTimeout, pReadmask);
 
     if (WorkToDo)
         SCREEN_EPILOGUE(pPriv, pScreen, BlockHandler);
diff --git a/render/animcur.c b/render/animcur.c
index b664b07..6dc2c57 100644
--- a/render/animcur.c
+++ b/render/animcur.c
@@ -135,11 +135,10 @@ AnimCurCursorLimits(DeviceIntPtr pDev,
  */
 
 static void
-AnimCurScreenBlockHandler(int screenNum,
+AnimCurScreenBlockHandler(ScreenPtr pScreen,
                           pointer blockData,
                           pointer pTimeout, pointer pReadmask)
 {
-    ScreenPtr pScreen = screenInfo.screens[screenNum];
     AnimCurScreenPtr as = GetAnimCurScreen(pScreen);
     DeviceIntPtr dev;
     Bool activeDevice = FALSE;
@@ -183,7 +182,7 @@ AnimCurScreenBlockHandler(int screenNum,
         AdjustWaitForDelay(pTimeout, soonest - now);
 
     Unwrap(as, pScreen, BlockHandler);
-    (*pScreen->BlockHandler) (screenNum, blockData, pTimeout, pReadmask);
+    (*pScreen->BlockHandler) (pScreen, blockData, pTimeout, pReadmask);
     if (activeDevice)
         Wrap(as, pScreen, BlockHandler, AnimCurScreenBlockHandler);
     else
-- 
1.7.6



More information about the xorg-devel mailing list