Index: programs/Xserver/GL/apple/indirect.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/GL/apple/indirect.c,v retrieving revision 1.2 diff -u -r1.2 indirect.c --- programs/Xserver/GL/apple/indirect.c 23 Apr 2004 18:44:35 -0000 1.2 +++ programs/Xserver/GL/apple/indirect.c 23 Jul 2004 01:02:20 -0000 @@ -109,7 +109,7 @@ * struct. In particular, the contextCreate, pGlxVisual, numVisuals, * and numUsableVisuals fields must be initialized. */ -__GLXscreenInfo __glDDXScreenInfo = { +static __GLXscreenInfo __glDDXScreenInfo = { glAquaScreenProbe, /* Must be generic and handle all screens */ glAquaCreateContext, /* Substitute screen's createContext routine */ glAquaCreateBuffer, /* Substitute screen's createBuffer routine */ @@ -123,13 +123,21 @@ NULL /* WrappedPositionWindow is overwritten */ }; -__GLXextensionInfo __glDDXExtensionInfo = { +void *__glXglDDXScreenInfo(void) { + return &__glDDXScreenInfo; +} + +static __GLXextensionInfo __glDDXExtensionInfo = { GL_CORE_APPLE, glAquaResetExtension, glAquaInitVisuals, glAquaSetVisualConfigs }; +void *__glXglDDXExtensionInfo(void) { + return &__glDDXExtensionInfo; +} + // prototypes static GLboolean glAquaDestroyContext(__GLcontext *gc); Index: programs/Xserver/GL/dri/dri.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/GL/dri/dri.c,v retrieving revision 1.3 diff -u -r1.3 dri.c --- programs/Xserver/GL/dri/dri.c 16 Jun 2004 09:37:58 -0000 1.3 +++ programs/Xserver/GL/dri/dri.c 23 Jul 2004 01:02:21 -0000 @@ -779,7 +779,7 @@ DRICreateDummyContext(ScreenPtr pScreen, Bool needCtxPriv) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - __GLXscreenInfo *pGLXScreen = &__glXActiveScreens[pScreen->myNum]; + __GLXscreenInfo *pGLXScreen = __glXgetActiveScreen(pScreen->myNum); __GLcontextModes *modes = pGLXScreen->modes; void **pVisualConfigPriv = pGLXScreen->pVisualPriv; DRIContextPrivPtr pDRIContextPriv; @@ -843,7 +843,7 @@ XID context, drm_context_t * pHWContext) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - __GLXscreenInfo *pGLXScreen = &__glXActiveScreens[pScreen->myNum]; + __GLXscreenInfo *pGLXScreen = __glXgetActiveScreen(pScreen->myNum); __GLcontextModes *modes = pGLXScreen->modes; void **pVisualConfigPriv = pGLXScreen->pVisualPriv; DRIContextPrivPtr pDRIContextPriv; Index: programs/Xserver/GL/glx/glxext.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/GL/glx/glxext.c,v retrieving revision 1.2 diff -u -r1.2 glxext.c --- programs/Xserver/GL/glx/glxext.c 23 Apr 2004 18:44:36 -0000 1.2 +++ programs/Xserver/GL/glx/glxext.c 23 Jul 2004 01:02:22 -0000 @@ -30,12 +30,11 @@ #include "micmap.h" -extern __GLXextensionInfo __glDDXExtensionInfo; void GlxWrapInitVisuals(miInitVisualsProcPtr *); void GlxSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, void **privates); -__GLXextensionInfo *__glXExt = &__glDDXExtensionInfo; +static __GLXextensionInfo *__glXExt /* = &__glDDXExtensionInfo */; /* ** Forward declarations. @@ -314,6 +313,8 @@ { saveInitVisualsProc = *initVisProc; *initVisProc = GlxInitVisuals; + /* HACK: this shouldn't be done here but it's the earliest time */ + __glXExt = __glXglDDXExtensionInfo(); /* from GLcore */ } /************************************************************************/ Index: programs/Xserver/GL/glx/glxscreens.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/GL/glx/glxscreens.c,v retrieving revision 1.3 diff -u -r1.3 glxscreens.c --- programs/Xserver/GL/glx/glxscreens.c 16 Jun 2004 09:37:59 -0000 1.3 +++ programs/Xserver/GL/glx/glxscreens.c 23 Jul 2004 01:02:22 -0000 @@ -142,22 +142,25 @@ ; /* -** This comes from the GL library that the server will link with. Right -** now, that is the DDX Sample OpenGL. -*/ -extern __GLXscreenInfo __glDDXScreenInfo; - -__GLXscreenInfo *__glXScreens[] = { - &__glDDXScreenInfo, + * __glDDXScreenInfo comes from GLcore, so we can't resolve this symbol at + * module open time. Leave a placeholder, and fill this in when we first + * need it (in __glXScreenInit). XXX Why make this an array? + */ +static __GLXscreenInfo *__glXScreens[] = { + NULL /* &__glDDXScreenInfo */ , }; -GLint __glXNumStaticScreens = (sizeof __glXScreens / sizeof __glXScreens[0]); +static GLint __glXNumStaticScreens = + (sizeof __glXScreens / sizeof __glXScreens[0]); __GLXscreenInfo *__glXActiveScreens; GLint __glXNumActiveScreens; RESTYPE __glXDrawableRes; +__GLXscreenInfo *__glXgetActiveScreen(int num) { + return &__glXActiveScreens[num]; +} /* ** Destroy routine that gets called when a drawable is freed. A drawable @@ -273,6 +276,8 @@ { GLint i,j; + __glXScreens[0] = __glXglDDXScreenInfo(); /* from GLcore */ + /* ** This alloc has to work or else the server might as well core dump. */ Index: programs/Xserver/GL/glx/glxserver.h =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/GL/glx/glxserver.h,v retrieving revision 1.2 diff -u -r1.2 glxserver.h --- programs/Xserver/GL/glx/glxserver.h 23 Apr 2004 18:44:36 -0000 1.2 +++ programs/Xserver/GL/glx/glxserver.h 23 Jul 2004 01:02:22 -0000 @@ -92,6 +92,7 @@ extern __GLXscreenInfo *__glXActiveScreens; extern GLint __glXNumActiveScreens; +extern __GLXscreenInfo *__glXgetActiveScreen(int num); /************************************************************************/ Index: programs/Xserver/GL/glx/glxutil.h =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/GL/glx/glxutil.h,v retrieving revision 1.3 diff -u -r1.3 glxutil.h --- programs/Xserver/GL/glx/glxutil.h 16 Jun 2004 09:37:59 -0000 1.3 +++ programs/Xserver/GL/glx/glxutil.h 23 Jul 2004 01:02:22 -0000 @@ -72,6 +72,9 @@ /* context helper routines */ extern __GLXcontext *__glXLookupContextByTag(__GLXclientState*, GLXContextTag); +/* init helper routines */ +extern void *__glXglDDXScreenInfo(void); +extern void *__glXglDDXExtensionInfo(void); #endif /* _glxcmds_h_ */ Index: programs/Xserver/GL/mesa/X/xf86glx.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/GL/mesa/X/xf86glx.c,v retrieving revision 1.1.3.1 diff -u -r1.1.3.1 xf86glx.c --- programs/Xserver/GL/mesa/X/xf86glx.c 16 Jun 2004 09:25:15 -0000 1.1.3.1 +++ programs/Xserver/GL/mesa/X/xf86glx.c 23 Jul 2004 01:02:23 -0000 @@ -76,7 +76,7 @@ * struct. In particular, the contextCreate, pGlxVisual, numVisuals, * and numUsableVisuals fields must be initialized. */ -__GLXscreenInfo __glDDXScreenInfo = { +static __GLXscreenInfo __glDDXScreenInfo = { __MESA_screenProbe, /* Must be generic and handle all screens */ __MESA_createContext, /* Substitute screen's createContext routine */ __MESA_createBuffer, /* Substitute screen's createBuffer routine */ @@ -90,13 +90,21 @@ NULL /* WrappedPositionWindow is overwritten */ }; -__GLXextensionInfo __glDDXExtensionInfo = { +void *__glXglDDXScreenInfo(void) { + return &__glDDXScreenInfo; +} + +static __GLXextensionInfo __glDDXExtensionInfo = { GL_CORE_MESA, __MESA_resetExtension, __MESA_initVisuals, __MESA_setVisualConfigs }; +void *__glXglDDXExtensionInfo(void) { + return &__glDDXExtensionInfo; +} + static __MESA_screen MESAScreens[MAXSCREENS]; static __GLcontext *MESA_CC = NULL; Index: programs/Xserver/GL/windows/indirect.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/GL/windows/indirect.c,v retrieving revision 1.2 diff -u -r1.2 indirect.c --- programs/Xserver/GL/windows/indirect.c 21 Jun 2004 13:22:30 -0000 1.2 +++ programs/Xserver/GL/windows/indirect.c 23 Jul 2004 01:02:23 -0000 @@ -172,7 +172,7 @@ * struct. In particular, the contextCreate, pGlxVisual, numVisuals, * and numUsableVisuals fields must be initialized. */ -__GLXscreenInfo __glDDXScreenInfo = { +static __GLXscreenInfo __glDDXScreenInfo = { glWinScreenProbe, /* Must be generic and handle all screens */ glWinCreateContext, /* Substitute screen's createContext routine */ glWinCreateBuffer, /* Substitute screen's createBuffer routine */ @@ -186,13 +186,21 @@ NULL /* WrappedPositionWindow is overwritten */ }; -__GLXextensionInfo __glDDXExtensionInfo = { +void *__glXglDDXScreenInfo(void) { + return &__glDDXScreenInfo; +} + +static __GLXextensionInfo __glDDXExtensionInfo = { GL_CORE_WINDOWS, glWinResetExtension, glWinInitVisuals, glWinSetVisualConfigs }; +void *__glXglDDXExtensionInfo(void) { + return &__glDDXExtensionInfo; +} + /* prototypes */ static GLboolean glWinDestroyContext(__GLcontext *gc);