[PATCH] xserver: drop index argument to ScreenInit (ABI/API) (v2)
Dave Airlie
airlied at gmail.com
Tue May 15 11:44:34 PDT 2012
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 <airlied at redhat.com>
---
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.</para>
The scrInitProc should be of the following form:
<blockquote><programlisting>
- Bool scrInitProc(iScreen, pScreen, argc, argv)
- int iScreen;
+ Bool scrInitProc(pScreen, argc, argv)
ScreenPtr pScreen;
int argc;
char **argv;
</programlisting></blockquote>
-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).</para>
+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).</para>
<para>
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,
&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/xnest/Screen.c b/hw/xnest/Screen.c
index fb58c88..f78dcd0 100644
--- a/hw/xnest/Screen.c
+++ b/hw/xnest/Screen.c
@@ -129,7 +129,7 @@ static miPointerSpriteFuncRec xnestPointerSpriteFuncs = {
};
Bool
-xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[])
+xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[])
{
VisualPtr visuals;
DepthPtr depths;
diff --git a/hw/xnest/Screen.h b/hw/xnest/Screen.h
index 5e58a1d..17c514a 100644
--- a/hw/xnest/Screen.h
+++ b/hw/xnest/Screen.h
@@ -19,7 +19,7 @@ extern Window xnestDefaultWindows[MAXSCREENS];
extern Window xnestScreenSaverWindows[MAXSCREENS];
ScreenPtr xnestScreen(Window window);
-Bool xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[]);
+Bool xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[]);
Bool xnestCloseScreen(ScreenPtr pScreen);
#endif /* XNESTSCREEN_H */
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index 41db72a..d26f18a 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -193,7 +193,7 @@ DarwinSaveScreen(ScreenPtr pScreen, int on)
* Initialize the screen and communicate information about it back to dix.
*/
static Bool
-DarwinScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
+DarwinScreenInit(ScreenPtr pScreen, int argc, char **argv)
{
int dpi;
static int foundIndex = 0;
@@ -204,7 +204,7 @@ DarwinScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
return FALSE;
// reset index of found screens for each server generation
- if (index == 0) {
+ if (pScreen->myNum == 0) {
foundIndex = 0;
// reset the visual list
@@ -275,7 +275,7 @@ DarwinScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
pScreen->SaveScreen = DarwinSaveScreen;
// finish mode dependent screen setup including cursor support
- if (!QuartzSetupScreen(index, pScreen)) {
+ if (!QuartzSetupScreen(pScreen->myNum, pScreen)) {
return FALSE;
}
diff --git a/hw/xwin/win.h b/hw/xwin/win.h
index 2bde18d..878419d 100644
--- a/hw/xwin/win.h
+++ b/hw/xwin/win.h
@@ -1070,7 +1070,7 @@ winPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable,
*/
Bool
- winScreenInit(int index, ScreenPtr pScreen, int argc, char **argv);
+ winScreenInit(ScreenPtr pScreen, int argc, char **argv);
Bool
winFinishScreenInitFB(int index, ScreenPtr pScreen, int argc, char **argv);
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