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 21 Jul 2004 19:43:16 -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 21 Jul 2004 19:43:16 -0000 @@ -142,16 +142,16 @@ ; /* -** 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; @@ -273,6 +273,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/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 21 Jul 2004 19:43:16 -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 21 Jul 2004 19:43:16 -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;