[PATCH 13/19] xserver: drop index argument to ScreenInit (ABI/API)

Dave Airlie airlied at gmail.com
Mon May 14 09:41:06 PDT 2012


This drops the index argument, its the same as pScreen->myNum,
and its the last major index abuse I can find.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 dix/dispatch.c               |    5 ++---
 hw/dmx/dmxextension.c        |    2 +-
 hw/dmx/dmxscrinit.c          |   16 ++++++++--------
 hw/dmx/dmxscrinit.h          |    4 ++--
 hw/kdrive/src/kdrive.c       |    2 +-
 hw/kdrive/src/kdrive.h       |    2 +-
 hw/vfb/InitOutput.c          |    4 ++--
 hw/xfree86/common/xf86str.h  |    2 +-
 hw/xfree86/doc/ddxDesign.xml |    2 +-
 hw/xwin/winscrinit.c         |    8 ++++----
 include/screenint.h          |    1 -
 11 files changed, 23 insertions(+), 25 deletions(-)

diff --git a/dix/dispatch.c b/dix/dispatch.c
index d971805..b88f974 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -3725,8 +3725,7 @@ with its screen number, a pointer to its ScreenRec, argc, and argv.
 */
 
 int
-AddScreen(Bool (*pfnInit) (int /*index */ ,
-                           ScreenPtr /*pScreen */ ,
+AddScreen(Bool (*pfnInit) (ScreenPtr /*pScreen */ ,
                            int /*argc */ ,
                            char **      /*argv */
           ), int argc, char **argv)
@@ -3794,7 +3793,7 @@ AddScreen(Bool (*pfnInit) (int /*index */ ,
      */
     screenInfo.screens[i] = pScreen;
     screenInfo.numScreens++;
-    if (!(*pfnInit) (i, pScreen, argc, argv)) {
+    if (!(*pfnInit) (pScreen, argc, argv)) {
         dixFreePrivates(pScreen->devPrivates, PRIVATE_SCREEN);
         free(pScreen);
         screenInfo.numScreens--;
diff --git a/hw/dmx/dmxextension.c b/hw/dmx/dmxextension.c
index faa28a5..d7296ae 100644
--- a/hw/dmx/dmxextension.c
+++ b/hw/dmx/dmxextension.c
@@ -1318,7 +1318,7 @@ dmxAttachScreen(int idx, DMXScreenAttributesPtr attr)
     }
 
     /* Initialize the BE screen resources */
-    dmxBEScreenInit(idx, screenInfo.screens[idx]);
+    dmxBEScreenInit(screenInfo.screens[idx]);
 
     /* TODO: Handle GLX visual initialization.  GLXProxy needs to be
      * updated to handle dynamic addition/removal of screens. */
diff --git a/hw/dmx/dmxscrinit.c b/hw/dmx/dmxscrinit.c
index 2a3a1ff..849ef16 100644
--- a/hw/dmx/dmxscrinit.c
+++ b/hw/dmx/dmxscrinit.c
@@ -77,9 +77,9 @@ DevPrivateKeyRec dmxGlyphSetPrivateKeyRec;
 /** Initialize the parts of screen \a idx that require access to the
  *  back-end server. */
 void
-dmxBEScreenInit(int idx, ScreenPtr pScreen)
+dmxBEScreenInit(ScreenPtr pScreen)
 {
-    DMXScreenInfo *dmxScreen = &dmxScreens[idx];
+    DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
     XSetWindowAttributes attribs;
     XGCValues gcvals;
     unsigned long mask;
@@ -192,11 +192,11 @@ dmxBEScreenInit(int idx, ScreenPtr pScreen)
     }
 }
 
-/** Initialize screen number \a idx. */
+/** Initialize screen number \a pScreen->myNum. */
 Bool
-dmxScreenInit(int idx, ScreenPtr pScreen, int argc, char *argv[])
+dmxScreenInit(ScreenPtr pScreen, int argc, char *argv[])
 {
-    DMXScreenInfo *dmxScreen = &dmxScreens[idx];
+    DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
     int i, j;
 
     if (!dixRegisterPrivateKey(&dmxScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
@@ -286,20 +286,20 @@ dmxScreenInit(int idx, ScreenPtr pScreen, int argc, char *argv[])
     }
     else {
         MAXSCREENSALLOC(dmxCursorGeneration);
-        if (dmxCursorGeneration[idx] != serverGeneration) {
+        if (dmxCursorGeneration[pScreen->myNum] != serverGeneration) {
             if (!(miPointerInitialize(pScreen,
                                       &dmxPointerSpriteFuncs,
                                       &dmxPointerCursorFuncs, FALSE)))
                 return FALSE;
 
-            dmxCursorGeneration[idx] = serverGeneration;
+            dmxCursorGeneration[pScreen->myNum] = serverGeneration;
         }
     }
 
     DMX_WRAP(CloseScreen, dmxCloseScreen, dmxScreen, pScreen);
     DMX_WRAP(SaveScreen, dmxSaveScreen, dmxScreen, pScreen);
 
-    dmxBEScreenInit(idx, pScreen);
+    dmxBEScreenInit(pScreen);
 
     if (!dmxShadowFB) {
         /* Wrap GC functions */
diff --git a/hw/dmx/dmxscrinit.h b/hw/dmx/dmxscrinit.h
index 5c0bfac..9fe9c98 100644
--- a/hw/dmx/dmxscrinit.h
+++ b/hw/dmx/dmxscrinit.h
@@ -40,9 +40,9 @@
 
 #include "scrnintstr.h"
 
-extern Bool dmxScreenInit(int idx, ScreenPtr pScreen, int argc, char *argv[]);
+extern Bool dmxScreenInit(ScreenPtr pScreen, int argc, char *argv[]);
 
-extern void dmxBEScreenInit(int idx, ScreenPtr pScreen);
+extern void dmxBEScreenInit(ScreenPtr pScreen);
 extern void dmxBECloseScreen(ScreenPtr pScreen);
 
 #endif                          /* DMXSCRINIT_H */
diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c
index 21715bb..a3b9434 100644
--- a/hw/kdrive/src/kdrive.c
+++ b/hw/kdrive/src/kdrive.c
@@ -776,7 +776,7 @@ KdSetSubpixelOrder(ScreenPtr pScreen, Rotation randr)
 static KdScreenInfo *kdCurrentScreen;
 
 Bool
-KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
+KdScreenInit(ScreenPtr pScreen, int argc, char **argv)
 {
     KdScreenInfo *screen = kdCurrentScreen;
     KdCardInfo *card = screen->card;
diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h
index 293f4e9..6b3410d 100644
--- a/hw/kdrive/src/kdrive.h
+++ b/hw/kdrive/src/kdrive.h
@@ -448,7 +448,7 @@ Bool
  KdSaveScreen(ScreenPtr pScreen, int on);
 
 Bool
- KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv);
+ KdScreenInit(ScreenPtr pScreen, int argc, char **argv);
 
 void
 
diff --git a/hw/vfb/InitOutput.c b/hw/vfb/InitOutput.c
index 55e554c..d777a85 100644
--- a/hw/vfb/InitOutput.c
+++ b/hw/vfb/InitOutput.c
@@ -778,9 +778,9 @@ vfbCloseScreen(ScreenPtr pScreen)
 }
 
 static Bool
-vfbScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
+vfbScreenInit(ScreenPtr pScreen, int argc, char **argv)
 {
-    vfbScreenInfoPtr pvfb = &vfbScreens[index];
+    vfbScreenInfoPtr pvfb = &vfbScreens[pScreen->myNum];
     int dpix = monitorResolution, dpiy = monitorResolution;
     int ret;
     char *pbits;
diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h
index b2410d1..16ce9ea 100644
--- a/hw/xfree86/common/xf86str.h
+++ b/hw/xfree86/common/xf86str.h
@@ -645,7 +645,7 @@ typedef struct {
 
 typedef Bool xf86ProbeProc(DriverPtr, int);
 typedef Bool xf86PreInitProc(ScrnInfoPtr, int);
-typedef Bool xf86ScreenInitProc(int, ScreenPtr, int, char **);
+typedef Bool xf86ScreenInitProc(ScreenPtr, int, char **);
 typedef Bool xf86SwitchModeProc(ScrnInfoPtr, DisplayModePtr, int);
 typedef void xf86AdjustFrameProc(ScrnInfoPtr, int, int, int);
 typedef Bool xf86EnterVTProc(ScrnInfoPtr, int);
diff --git a/hw/xfree86/doc/ddxDesign.xml b/hw/xfree86/doc/ddxDesign.xml
index 53aebd3..3fb6418 100644
--- a/hw/xfree86/doc/ddxDesign.xml
+++ b/hw/xfree86/doc/ddxDesign.xml
@@ -9058,7 +9058,7 @@ ZZZModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
 
 	<programlisting>
 static Bool
-ZZZScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+ZZZScreenInit(ScreenPtr pScreen, int argc, char **argv)
 {
     /* Get the ScrnInfoRec */
     pScrn = xf86ScreenToScrn(pScreen);
diff --git a/hw/xwin/winscrinit.c b/hw/xwin/winscrinit.c
index 42891c2..b534a0f 100644
--- a/hw/xwin/winscrinit.c
+++ b/hw/xwin/winscrinit.c
@@ -81,9 +81,9 @@ static Bool
  */
 
 Bool
-winScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
+winScreenInit(ScreenPtr pScreen, int argc, char **argv)
 {
-    winScreenInfoPtr pScreenInfo = &g_ScreenInfo[index];
+    winScreenInfoPtr pScreenInfo = &g_ScreenInfo[pScreen->myNum];
     winPrivScreenPtr pScreenPriv;
     HDC hdc;
     DWORD dwInitialBPP;
@@ -202,7 +202,7 @@ winScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
     miClearVisualTypes();
 
     /* Call the engine dependent screen initialization procedure */
-    if (!((*pScreenPriv->pwinFinishScreenInit) (index, pScreen, argc, argv))) {
+    if (!((*pScreenPriv->pwinFinishScreenInit) (pScreen->myNum, pScreen, argc, argv))) {
         ErrorF("winScreenInit - winFinishScreenInit () failed\n");
 
         /* call the engine dependent screen close procedure to clean up from a failure */
@@ -224,7 +224,7 @@ winScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
     pScreen->y = pScreenInfo->dwInitialY - GetSystemMetrics(SM_YVIRTUALSCREEN);
 
     ErrorF("Screen %d added at virtual desktop coordinate (%d,%d).\n",
-           index, pScreen->x, pScreen->y);
+           pScreen->myNum, pScreen->x, pScreen->y);
 
 #if CYGDEBUG || YES
     winDebug("winScreenInit - returning\n");
diff --git a/include/screenint.h b/include/screenint.h
index 8817471..6b0cc70 100644
--- a/include/screenint.h
+++ b/include/screenint.h
@@ -55,7 +55,6 @@ typedef struct _Depth *DepthPtr;
 typedef struct _Screen *ScreenPtr;
 
 extern _X_EXPORT int AddScreen(Bool (* /*pfnInit */ )(
-                                                         int /*index */ ,
                                                          ScreenPtr /*pScreen */
                                                          ,
                                                          int /*argc */ ,
-- 
1.7.6



More information about the xorg-devel mailing list