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

2012-05-15 Thread Dave Airlie
This drops the index argument, its the same as pScreen->myNum,
and its the last major index abuse I can find.

v2: address Alan's review - update docs, fix xwin/xnest/darwin

Signed-off-by: Dave Airlie 
---
 dix/dispatch.c   |5 ++---
 doc/Xserver-spec.xml |   13 +
 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/xnest/Screen.c|2 +-
 hw/xnest/Screen.h|2 +-
 hw/xquartz/darwin.c  |6 +++---
 hw/xwin/win.h|2 +-
 hw/xwin/winscrinit.c |8 
 include/screenint.h  |1 -
 16 files changed, 34 insertions(+), 39 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/doc/Xserver-spec.xml b/doc/Xserver-spec.xml
index 2b11828..866701d 100644
--- a/doc/Xserver-spec.xml
+++ b/doc/Xserver-spec.xml
@@ -1942,18 +1942,15 @@ FALSE.
 The scrInitProc should be of the following form:
 
 
-   Bool scrInitProc(iScreen, pScreen, argc, argv)
-   int iScreen;
+   Bool scrInitProc(pScreen, argc, argv)
ScreenPtr pScreen;
int argc;
char **argv;
 
-iScreen is the index for this screen; 0 for the first one initialized,
-1 for the second, etc.  pScreen is the pointer to the screen's new
-ScreenRec.  argc and argv are as before.  Your screen initialize
-procedure should return TRUE upon success or FALSE if the screen
-cannot be initialized (for instance, if the screen hardware does not
-exist on this machine).
+pScreen is the pointer to the screen's new ScreenRec. argc and argv
+are as before.  Your screen initialize procedure should return TRUE
+upon success or FALSE if the screen cannot be initialized (for
+ instance, if the screen hardware does not exist on this machine).
 
 This procedure must determine what actual device it is supposed to initialize.
 If you have a different procedure for each screen, then it is no problem.
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,
 

Re: [PATCH] xserver: drop index argument to ScreenInit (ABI/API) (v2)

2012-05-18 Thread Alan Coopersmith
On 05/15/12 11:44 AM, Dave Airlie wrote:
> This drops the index argument, its the same as pScreen->myNum,
> and its the last major index abuse I can find.
> 
> v2: address Alan's review - update docs, fix xwin/xnest/darwin
> 
> Signed-off-by: Dave Airlie 

Reviewed-by: Alan Coopersmith 

-- 
-Alan Coopersmith-  alan.coopersm...@oracle.com
 Oracle Solaris Engineering - http://blogs.oracle.com/alanc
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel