diff options
author | Adam Jackson <ajax@nwnk.net> | 2004-07-26 19:06:04 +0000 |
---|---|---|
committer | Adam Jackson <ajax@nwnk.net> | 2004-07-26 19:06:04 +0000 |
commit | 799208dd44a65b18dda97b4843a27a2628f955f4 (patch) | |
tree | 4cafbfde85bc8b90db60aad1b11caf097d9bb83c /GL | |
parent | f15f881727cee9a879bd43be8dc849320f8d3cbd (diff) |
Bug #377: Make lib{glx,GLcore,dri} work when compiled as dlloader modules.
Diffstat (limited to 'GL')
-rw-r--r-- | GL/apple/indirect.c | 12 | ||||
-rw-r--r-- | GL/glx/glxext.c | 7 | ||||
-rw-r--r-- | GL/glx/glxscreens.c | 21 | ||||
-rw-r--r-- | GL/glx/glxserver.h | 3 | ||||
-rw-r--r-- | GL/glx/glxutil.h | 3 | ||||
-rw-r--r-- | GL/mesa/X/xf86glx.c | 12 | ||||
-rwxr-xr-x | GL/windows/indirect.c | 12 |
7 files changed, 52 insertions, 18 deletions
diff --git a/GL/apple/indirect.c b/GL/apple/indirect.c index c4d235a47..3f6a5e6d2 100644 --- a/GL/apple/indirect.c +++ b/GL/apple/indirect.c @@ -109,7 +109,7 @@ static void glAquaResetExtension(void); * 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 @@ __GLXscreenInfo __glDDXScreenInfo = { 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); diff --git a/GL/glx/glxext.c b/GL/glx/glxext.c index 5e6801744..87c9e1448 100644 --- a/GL/glx/glxext.c +++ b/GL/glx/glxext.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxext.c,v 1.8 2001/08/23 18:25:40 alanh Exp $ +/* $XFree86: xc/programs/Xserver/GL/glx/glxext.c,v 1.9 2003/09/28 20:15:43 alanh Exp $ ** The contents of this file are subject to the GLX Public License Version 1.0 ** (the "License"). You may not use this file except in compliance with the ** License. You may obtain a copy of the License at Silicon Graphics, Inc., @@ -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 @@ GlxWrapInitVisuals(miInitVisualsProcPtr *initVisProc) { saveInitVisualsProc = *initVisProc; *initVisProc = GlxInitVisuals; + /* HACK: this shouldn't be done here but it's the earliest time */ + __glXExt = __glXglDDXExtensionInfo(); /* from GLcore */ } /************************************************************************/ diff --git a/GL/glx/glxscreens.c b/GL/glx/glxscreens.c index 0b985f06c..6ddbfcbd0 100644 --- a/GL/glx/glxscreens.c +++ b/GL/glx/glxscreens.c @@ -142,22 +142,25 @@ static char GLXServerExtensions[] = ; /* -** 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 @@ void __glXScreenInit(GLint numscreens) { GLint i,j; + __glXScreens[0] = __glXglDDXScreenInfo(); /* from GLcore */ + /* ** This alloc has to work or else the server might as well core dump. */ diff --git a/GL/glx/glxserver.h b/GL/glx/glxserver.h index 67f5e961f..66d681d2d 100644 --- a/GL/glx/glxserver.h +++ b/GL/glx/glxserver.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxserver.h,v 1.4 2001/08/23 18:25:40 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/glxserver.h,v 1.5 2003/09/28 20:15:43 alanh Exp $ */ #ifndef _GLX_server_h_ #define _GLX_server_h_ @@ -92,6 +92,7 @@ typedef struct __GLXclientStateRec __GLXclientState; extern __GLXscreenInfo *__glXActiveScreens; extern GLint __glXNumActiveScreens; +extern __GLXscreenInfo *__glXgetActiveScreen(int num); /************************************************************************/ diff --git a/GL/glx/glxutil.h b/GL/glx/glxutil.h index 970683cb1..dbf7084b5 100644 --- a/GL/glx/glxutil.h +++ b/GL/glx/glxutil.h @@ -72,6 +72,9 @@ extern void __glXCacheDrawableSize(__GLXdrawablePrivate *glxPriv); /* context helper routines */ extern __GLXcontext *__glXLookupContextByTag(__GLXclientState*, GLXContextTag); +/* init helper routines */ +extern void *__glXglDDXScreenInfo(void); +extern void *__glXglDDXExtensionInfo(void); #endif /* _glxcmds_h_ */ diff --git a/GL/mesa/X/xf86glx.c b/GL/mesa/X/xf86glx.c index 905e0cc15..bd8ff7fe0 100644 --- a/GL/mesa/X/xf86glx.c +++ b/GL/mesa/X/xf86glx.c @@ -76,7 +76,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * 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 @@ __GLXscreenInfo __glDDXScreenInfo = { 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; diff --git a/GL/windows/indirect.c b/GL/windows/indirect.c index cee9e6586..11dc0c092 100755 --- a/GL/windows/indirect.c +++ b/GL/windows/indirect.c @@ -172,7 +172,7 @@ static void glWinResetExtension(void); * 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 @@ __GLXscreenInfo __glDDXScreenInfo = { 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); |