Commit 799208dd authored by Adam Jackson's avatar Adam Jackson 🎧

Bug #377: Make lib{glx,GLcore,dri} work when compiled as dlloader modules.

parent f15f8817
......@@ -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);
......
/* $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 */
}
/************************************************************************/
......
......@@ -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.
*/
......
/* $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);
/************************************************************************/
......
......@@ -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_ */
......@@ -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;
......
......@@ -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);
......
......@@ -113,6 +113,8 @@ static const char *glcoreSymbols[] = {
"__glTexGeniv_size",
"__glTexParameterfv_size",
"__glTexParameteriv_size",
"__glXglDDXExtensionInfo",
"__glXglDDXScreenInfo",
"__glXActiveScreens",
"__glXAssociateContext",
"__glXBadContext",
......
......@@ -779,7 +779,7 @@ static Bool
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 @@ DRICreateContext(ScreenPtr pScreen, VisualPtr visual,
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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment