summaryrefslogtreecommitdiff
path: root/xc/programs/Xserver/GL
diff options
context:
space:
mode:
authoridr <idr>2004-03-03 21:57:59 +0000
committeridr <idr>2004-03-03 21:57:59 +0000
commit21a4a851e63845e2929824be22c0773e89d0b9d5 (patch)
treeff041113efa5b5d5586c4aa60dd23342c7e5e9dd /xc/programs/Xserver/GL
parentbc3c2ce1456aae37ad1cb1f19096ab58776df6e2 (diff)
Merged driinterface-0-0-3driinterface-0-0-3-20040303-merge
Diffstat (limited to 'xc/programs/Xserver/GL')
-rw-r--r--xc/programs/Xserver/GL/dri/dri.c18
-rw-r--r--xc/programs/Xserver/GL/glx/Imakefile7
-rw-r--r--xc/programs/Xserver/GL/glx/g_disptab.c40
-rw-r--r--xc/programs/Xserver/GL/glx/g_disptab.h6
-rw-r--r--xc/programs/Xserver/GL/glx/glx-def.cpp1
-rw-r--r--xc/programs/Xserver/GL/glx/glxcmds.c374
-rw-r--r--xc/programs/Xserver/GL/glx/glxcmdsswap.c191
-rw-r--r--xc/programs/Xserver/GL/glx/glxcontext.h1
-rw-r--r--xc/programs/Xserver/GL/glx/glxdrawable.h5
-rw-r--r--xc/programs/Xserver/GL/glx/glxext.h14
-rw-r--r--xc/programs/Xserver/GL/glx/glxscreens.c84
-rw-r--r--xc/programs/Xserver/GL/glx/glxscreens.h6
-rw-r--r--xc/programs/Xserver/GL/glx/glxutil.c62
-rw-r--r--xc/programs/Xserver/GL/glx/glxutil.h1
-rw-r--r--xc/programs/Xserver/GL/glxmodule.c1
-rw-r--r--xc/programs/Xserver/GL/mesa/X/xf86glx.c216
-rw-r--r--xc/programs/Xserver/GL/mesa/X/xf86glxint.h7
17 files changed, 571 insertions, 463 deletions
diff --git a/xc/programs/Xserver/GL/dri/dri.c b/xc/programs/Xserver/GL/dri/dri.c
index 1575fea41..d41ff8439 100644
--- a/xc/programs/Xserver/GL/dri/dri.c
+++ b/xc/programs/Xserver/GL/dri/dri.c
@@ -780,7 +780,7 @@ DRICreateDummyContext(ScreenPtr pScreen, Bool needCtxPriv)
{
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
__GLXscreenInfo *pGLXScreen = &__glXActiveScreens[pScreen->myNum];
- __GLXvisualConfig *pGLXVis = pGLXScreen->pGlxVisual;
+ __GLcontextModes *modes = pGLXScreen->modes;
void **pVisualConfigPriv = pGLXScreen->pVisualPriv;
DRIContextPrivPtr pDRIContextPriv;
void *contextStore;
@@ -793,7 +793,7 @@ DRICreateDummyContext(ScreenPtr pScreen, Bool needCtxPriv)
for (visNum = 0;
visNum < pScreen->numVisuals;
visNum++, visual++) {
- if (pGLXVis->vid == visual->vid)
+ if (modes->visualID == visual->vid)
break;
}
if (visNum == pScreen->numVisuals) return FALSE;
@@ -844,11 +844,10 @@ DRICreateContext(ScreenPtr pScreen, VisualPtr visual,
{
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
__GLXscreenInfo *pGLXScreen = &__glXActiveScreens[pScreen->myNum];
- __GLXvisualConfig *pGLXVis = pGLXScreen->pGlxVisual;
+ __GLcontextModes *modes = pGLXScreen->modes;
void **pVisualConfigPriv = pGLXScreen->pVisualPriv;
DRIContextPrivPtr pDRIContextPriv;
void *contextStore;
- int visNum;
if (pDRIPriv->createDummyCtx && !pDRIPriv->dummyCtxPriv) {
if (!DRICreateDummyContext(pScreen, pDRIPriv->createDummyCtxPriv)) {
@@ -859,12 +858,13 @@ DRICreateContext(ScreenPtr pScreen, VisualPtr visual,
}
/* Find the GLX visual associated with the one requested */
- for (visNum = 0;
- visNum < pGLXScreen->numVisuals;
- visNum++, pGLXVis++, pVisualConfigPriv++)
- if (pGLXVis->vid == visual->vid)
+ for (modes = pGLXScreen->modes; modes != NULL; modes = modes->next) {
+ if (modes->visualID == visual->vid)
break;
- if (visNum == pGLXScreen->numVisuals) {
+ pVisualConfigPriv++;
+ }
+
+ if (modes == NULL) {
/* No matching GLX visual found */
return FALSE;
}
diff --git a/xc/programs/Xserver/GL/glx/Imakefile b/xc/programs/Xserver/GL/glx/Imakefile
index af7d1a118..a2e232b3d 100644
--- a/xc/programs/Xserver/GL/glx/Imakefile
+++ b/xc/programs/Xserver/GL/glx/Imakefile
@@ -11,6 +11,9 @@ SUBDIRS = module
#include <Server.tmpl>
+LinkSourceFile(glcontextmodes.c,$(LIBSRC)/GL/glx)
+LinkSourceFile(glcontextmodes.h,$(LIBSRC)/GL/glx)
+
SRCS = global.c glxbuf.c glxcmds.c glxcmdsswap.c glxext.c \
glxfb.c glximports.c glxmem.c glxpix.c glxscreens.c \
glxutil.c render2.c render2swap.c renderpix.c \
@@ -18,7 +21,7 @@ SUBDIRS = module
single2swap.c singlepix.c singlepixswap.c \
singlesize.c xfont.c g_disptab.c g_disptab_EXT.c \
g_render.c g_renderswap.c g_single.c g_singleswap.c \
- $(MSRCS)
+ glcontextmodes.c $(MSRCS)
OBJS = global.o glxbuf.o glxcmds.o glxcmdsswap.o glxext.o \
glxfb.o glximports.o glxmem.o glxpix.o glxscreens.o \
@@ -27,7 +30,7 @@ SUBDIRS = module
single2swap.o singlepix.o singlepixswap.o \
singlesize.o xfont.o g_disptab.o g_disptab_EXT.o \
g_render.o g_renderswap.o g_single.o g_singleswap.o \
- $(MOBJS)
+ glcontextmodes.o $(MOBJS)
INCLUDES = -I$(SERVERSRC)/GL/glx -I$(SERVERSRC)/GL/include -I$(SERVERSRC)/include -I$(INCLUDESRC) -I$(MESASRCDIR)/include \
-I$(XINCLUDESRC) -I$(SERVERSRC)/mi \
diff --git a/xc/programs/Xserver/GL/glx/g_disptab.c b/xc/programs/Xserver/GL/glx/g_disptab.c
index e4224ee67..85bca389a 100644
--- a/xc/programs/Xserver/GL/glx/g_disptab.c
+++ b/xc/programs/Xserver/GL/glx/g_disptab.c
@@ -54,18 +54,18 @@ __GLXdispatchSingleProcPtr __glXSingleTable[__GLX_SINGLE_TABLE_SIZE] = {
__glXQueryExtensionsString,
__glXQueryServerString,
__glXClientInfo,
- __glXNoSuchSingleOpcode, /* glXGetFBConfigs */
- __glXNoSuchSingleOpcode, /* glXCreatePixmap */
- __glXNoSuchSingleOpcode, /* glXDestroyPixmap */
- __glXNoSuchSingleOpcode, /* glXCreateNewContext */
+ __glXGetFBConfigs,
+ __glXCreatePixmap,
+ __glXDestroyGLXPixmap, /* glXDestroyPixmap */
+ __glXCreateNewContext,
__glXNoSuchSingleOpcode, /* glXQueryContext */
__glXMakeContextCurrent,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode, /* glXCreatePbuffer */
+ __glXNoSuchSingleOpcode, /* glXDestroyPbuffer */
+ __glXNoSuchSingleOpcode, /* glXGetDrawableAttributes */
+ __glXNoSuchSingleOpcode, /* glXChangeDrawableAttributes */
+ __glXNoSuchSingleOpcode, /* glXCreateWindow */
+ __glXNoSuchSingleOpcode, /* glXDestroyWindow */
__glXNoSuchSingleOpcode,
__glXNoSuchSingleOpcode,
__glXNoSuchSingleOpcode,
@@ -451,18 +451,18 @@ __GLXdispatchSingleProcPtr __glXSwapSingleTable[__GLX_SINGLE_TABLE_SIZE] = {
__glXSwapQueryExtensionsString,
__glXSwapQueryServerString,
__glXSwapClientInfo,
- __glXNoSuchSingleOpcode, /* glXGetFBConfigs */
- __glXNoSuchSingleOpcode, /* glXCreatePixmap */
- __glXNoSuchSingleOpcode, /* glXDestroyPixmap */
- __glXNoSuchSingleOpcode, /* glXCreateNewContext */
+ __glXSwapGetFBConfigs,
+ __glXSwapCreatePixmap,
+ __glXSwapDestroyGLXPixmap, /* glXDestroyPixmap */
+ __glXSwapCreateNewContext,
__glXNoSuchSingleOpcode, /* glXQueryContext */
__glXSwapMakeContextCurrent,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode, /* glXCreatePbuffer */
+ __glXNoSuchSingleOpcode, /* glXDestroyPbuffer */
+ __glXNoSuchSingleOpcode, /* glXGetDrawableAttributes */
+ __glXNoSuchSingleOpcode, /* glXChangeDrawableAttributes */
+ __glXNoSuchSingleOpcode, /* glXCreateWindow */
+ __glXNoSuchSingleOpcode, /* glXDestroyWindow */
__glXNoSuchSingleOpcode,
__glXNoSuchSingleOpcode,
__glXNoSuchSingleOpcode,
diff --git a/xc/programs/Xserver/GL/glx/g_disptab.h b/xc/programs/Xserver/GL/glx/g_disptab.h
index cd45c269a..6702980b9 100644
--- a/xc/programs/Xserver/GL/glx/g_disptab.h
+++ b/xc/programs/Xserver/GL/glx/g_disptab.h
@@ -52,6 +52,9 @@ extern int __glXQueryExtensionsString(__GLXclientState*, GLbyte*);
extern int __glXQueryServerString(__GLXclientState*, GLbyte*);
extern int __glXClientInfo(__GLXclientState*, GLbyte*);
extern int __glXMakeContextCurrent(__GLXclientState*, GLbyte*);
+extern int __glXGetFBConfigs(__GLXclientState*, GLbyte*);
+extern int __glXCreateNewContext(__GLXclientState*, GLbyte*);
+extern int __glXCreatePixmap(__GLXclientState*, GLbyte*);
extern int __glXDisp_NewList(__GLXclientState*, GLbyte*);
extern int __glXDisp_EndList(__GLXclientState*, GLbyte*);
@@ -349,6 +352,9 @@ extern int __glXSwapQueryExtensionsString(__GLXclientState*, GLbyte*);
extern int __glXSwapQueryServerString(__GLXclientState*, GLbyte*);
extern int __glXSwapClientInfo(__GLXclientState*, GLbyte*);
extern int __glXSwapMakeContextCurrent(__GLXclientState*, GLbyte*);
+extern int __glXSwapGetFBConfigs(__GLXclientState*, GLbyte*);
+extern int __glXSwapCreateNewContext(__GLXclientState*, GLbyte*);
+extern int __glXSwapCreatePixmap(__GLXclientState*, GLbyte*);
extern int __glXDispSwap_NewList(__GLXclientState*, GLbyte*);
extern int __glXDispSwap_EndList(__GLXclientState*, GLbyte*);
diff --git a/xc/programs/Xserver/GL/glx/glx-def.cpp b/xc/programs/Xserver/GL/glx/glx-def.cpp
index 9f31ecd04..2c1965ec2 100644
--- a/xc/programs/Xserver/GL/glx/glx-def.cpp
+++ b/xc/programs/Xserver/GL/glx/glx-def.cpp
@@ -92,7 +92,6 @@ __glXCreateDrawablePrivate
__glXDeassociateContext
__glXDestroyDrawablePrivate
__glXFindDrawablePrivate
-__glXFormatGLModes
__glXFree
__glXGetDrawablePrivate
__glXGetDrawableSize
diff --git a/xc/programs/Xserver/GL/glx/glxcmds.c b/xc/programs/Xserver/GL/glx/glxcmds.c
index edce34178..d3c9f2565 100644
--- a/xc/programs/Xserver/GL/glx/glxcmds.c
+++ b/xc/programs/Xserver/GL/glx/glxcmds.c
@@ -47,6 +47,7 @@
#include "glxutil.h"
#include "glxext.h"
#include "GL/glx_ansic.h"
+#include "glcontextmodes.h"
/************************************************************************/
@@ -68,29 +69,32 @@ static __GLimports imports = {
NULL
};
-static int DoMakeCurrent( __GLXclientState *cl, GLXDrawable drawId,
- GLXDrawable readId, GLXContextID contextId, GLXContextTag tag );
+static int __glXGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc);
+static int __glXCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc);
+static int __glXCreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc);
+static int __glXMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc);
/************************************************************************/
-/*
-** Create a GL context with the given properties.
-*/
-int __glXCreateContext(__GLXclientState *cl, GLbyte *pc)
+/**
+ * Create a GL context with the given properties. This routine is used
+ * to implement \c glXCreateContext, \c glXCreateNewContext, and
+ * \c glXCreateContextWithConfigSGIX. This works becuase of the hack way
+ * that GLXFBConfigs are implemented. Basically, the FBConfigID is the
+ * same as the VisualID.
+ */
+
+int DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
+ GLXContextID shareList, VisualID visual,
+ GLuint screen, GLboolean isDirect)
{
ClientPtr client = cl->client;
- xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc;
VisualPtr pVisual;
ScreenPtr pScreen;
__GLXcontext *glxc, *shareglxc;
- __GLXvisualConfig *pGlxVisual;
+ __GLcontextModes *modes;
__GLXscreenInfo *pGlxScreen;
__GLinterface *shareGC;
- GLXContextID gcId = req->context;
- GLXContextID shareList = req->shareList;
- VisualID visual = req->visual;
- GLuint screen = req->screen;
- GLboolean isDirect = req->isDirect;
GLint i;
/*
@@ -123,13 +127,9 @@ int __glXCreateContext(__GLXclientState *cl, GLbyte *pc)
** subset of Visuals that are supported by this implementation of the
** OpenGL.
*/
- pGlxVisual = pGlxScreen->pGlxVisual;
- for (i = 0; i < pGlxScreen->numVisuals; i++, pGlxVisual++) {
- if (pGlxVisual->vid == visual) {
- break;
- }
- }
- if (i == pGlxScreen->numVisuals) {
+
+ modes = _gl_context_modes_find_visual( pGlxScreen->modes, visual );
+ if (modes == NULL) {
/*
** Visual not support on this screen by this OpenGL implementation.
*/
@@ -192,22 +192,15 @@ int __glXCreateContext(__GLXclientState *cl, GLbyte *pc)
glxc->pScreen = pScreen;
glxc->pGlxScreen = pGlxScreen;
glxc->pVisual = pVisual;
- glxc->pGlxVisual = pGlxVisual;
+ glxc->modes = modes;
if (!isDirect) {
- __GLcontextModes *modes;
- /*
- ** first build __GLcontextModes from __GLXvisualConfig
- */
- modes = (__GLcontextModes *) __glXMalloc(sizeof(__GLcontextModes));
- glxc->modes = modes;
- __glXFormatGLModes(modes, pGlxVisual);
/*
** Allocate a GL context
*/
imports.other = (void *)glxc;
- glxc->gc = (*pGlxScreen->createContext)(&imports, modes, shareGC);
+ glxc->gc = (*pGlxScreen->createContext)(&imports, glxc->modes, shareGC);
if (!glxc->gc) {
__glXFree(glxc);
client->errorValue = gcId;
@@ -245,6 +238,31 @@ int __glXCreateContext(__GLXclientState *cl, GLbyte *pc)
return Success;
}
+
+int __glXCreateContext(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc;
+ return DoCreateContext( cl, req->context, req->shareList, req->visual,
+ req->screen, req->isDirect );
+}
+
+
+int __glXCreateNewContext(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc;
+ return DoCreateContext( cl, req->context, req->shareList, req->fbconfig,
+ req->screen, req->isDirect );
+}
+
+
+int __glXCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXCreateContextWithConfigSGIXReq *req =
+ (xGLXCreateContextWithConfigSGIXReq *) pc;
+ return DoCreateContext( cl, req->context, req->shareList, req->fbconfig,
+ req->screen, req->isDirect );
+}
+
/*
** Destroy a GL context as an X resource.
*/
@@ -370,24 +388,24 @@ int __glXMakeCurrent(__GLXclientState *cl, GLbyte *pc)
{
xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) pc;
- return DoMakeCurrent( cl, req->drawable, req->drawable,
- req->context, req->oldContextTag );
+ return DoMakeCurrent( cl, req->drawable, req->drawable,
+ req->context, req->oldContextTag );
}
int __glXMakeContextCurrent(__GLXclientState *cl, GLbyte *pc)
{
xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) pc;
- return DoMakeCurrent( cl, req->drawable, req->readdrawable,
- req->context, req->oldContextTag );
+ return DoMakeCurrent( cl, req->drawable, req->readdrawable,
+ req->context, req->oldContextTag );
}
int __glXMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc)
{
xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) pc;
- return DoMakeCurrent( cl, req->drawable, req->readable,
- req->context, req->oldContextTag );
+ return DoMakeCurrent( cl, req->drawable, req->readable,
+ req->context, req->oldContextTag );
}
@@ -449,7 +467,7 @@ static int GetDrawableOrPixmap( __GLXcontext *glxc, GLXDrawable drawId,
** Check if pixmap and context are similar.
*/
if (drawPixmap->pScreen != glxc->pScreen ||
- drawPixmap->pGlxVisual != glxc->pGlxVisual) {
+ drawPixmap->modes->visualID != glxc->modes->visualID) {
client->errorValue = drawId;
return BadMatch;
}
@@ -471,9 +489,9 @@ static int GetDrawableOrPixmap( __GLXcontext *glxc, GLXDrawable drawId,
}
-static int DoMakeCurrent( __GLXclientState *cl,
- GLXDrawable drawId, GLXDrawable readId,
- GLXContextID contextId, GLXContextTag tag )
+int DoMakeCurrent( __GLXclientState *cl,
+ GLXDrawable drawId, GLXDrawable readId,
+ GLXContextID contextId, GLXContextTag tag )
{
ClientPtr client = cl->client;
DrawablePtr pDraw;
@@ -879,18 +897,19 @@ int __glXCopyContext(__GLXclientState *cl, GLbyte *pc)
return Success;
}
-int __glXGetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
+
+int DoGetVisualConfigs(__GLXclientState *cl, unsigned screen,
+ GLboolean do_swap)
{
ClientPtr client = cl->client;
- xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc;
xGLXGetVisualConfigsReply reply;
__GLXscreenInfo *pGlxScreen;
- __GLXvisualConfig *pGlxVisual;
+ __GLcontextModes *modes;
CARD32 buf[__GLX_TOTAL_CONFIG];
- unsigned int screen;
- int i, p;
+ int p;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- screen = req->screen;
if (screen >= screenInfo.numScreens) {
/* The client library must send a valid screen number. */
client->errorValue = screen;
@@ -905,77 +924,206 @@ int __glXGetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
+ if ( do_swap ) {
+ __GLX_SWAP_SHORT(&reply.sequenceNumber);
+ __GLX_SWAP_INT(&reply.length);
+ __GLX_SWAP_INT(&reply.numVisuals);
+ __GLX_SWAP_INT(&reply.numProps);
+ }
+
WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *)&reply);
- for (i=0; i < pGlxScreen->numVisuals; i++) {
- pGlxVisual = &pGlxScreen->pGlxVisual[i];
- if (pGlxVisual->vid == 0) {
+ for ( modes = pGlxScreen->modes ; modes != NULL ; modes = modes->next ) {
+ if (modes->visualID == 0) {
/* not a usable visual */
continue;
}
p = 0;
- buf[p++] = pGlxVisual->vid;
- buf[p++] = pGlxVisual->class;
- buf[p++] = pGlxVisual->rgba;
-
- buf[p++] = pGlxVisual->redSize;
- buf[p++] = pGlxVisual->greenSize;
- buf[p++] = pGlxVisual->blueSize;
- buf[p++] = pGlxVisual->alphaSize;
- buf[p++] = pGlxVisual->accumRedSize;
- buf[p++] = pGlxVisual->accumGreenSize;
- buf[p++] = pGlxVisual->accumBlueSize;
- buf[p++] = pGlxVisual->accumAlphaSize;
-
- buf[p++] = pGlxVisual->doubleBuffer;
- buf[p++] = pGlxVisual->stereo;
-
- buf[p++] = pGlxVisual->bufferSize;
- buf[p++] = pGlxVisual->depthSize;
- buf[p++] = pGlxVisual->stencilSize;
- buf[p++] = pGlxVisual->auxBuffers;
- buf[p++] = pGlxVisual->level;
+ buf[p++] = modes->visualID;
+ buf[p++] = _gl_convert_to_x_visual_type( modes->visualType );
+ buf[p++] = modes->rgbMode;
+
+ buf[p++] = modes->redBits;
+ buf[p++] = modes->greenBits;
+ buf[p++] = modes->blueBits;
+ buf[p++] = modes->alphaBits;
+ buf[p++] = modes->accumRedBits;
+ buf[p++] = modes->accumGreenBits;
+ buf[p++] = modes->accumBlueBits;
+ buf[p++] = modes->accumAlphaBits;
+
+ buf[p++] = modes->doubleBufferMode;
+ buf[p++] = modes->stereoMode;
+
+ buf[p++] = modes->rgbBits;
+ buf[p++] = modes->depthBits;
+ buf[p++] = modes->stencilBits;
+ buf[p++] = modes->numAuxBuffers;
+ buf[p++] = modes->level;
/*
** Add token/value pairs for extensions.
*/
buf[p++] = GLX_VISUAL_CAVEAT_EXT;
- buf[p++] = pGlxVisual->visualRating;
- buf[p++] = GLX_TRANSPARENT_TYPE_EXT;
- buf[p++] = pGlxVisual->transparentPixel;
- buf[p++] = GLX_TRANSPARENT_RED_VALUE_EXT;
- buf[p++] = pGlxVisual->transparentRed;
- buf[p++] = GLX_TRANSPARENT_GREEN_VALUE_EXT;
- buf[p++] = pGlxVisual->transparentGreen;
- buf[p++] = GLX_TRANSPARENT_BLUE_VALUE_EXT;
- buf[p++] = pGlxVisual->transparentBlue;
- buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE_EXT;
- buf[p++] = pGlxVisual->transparentAlpha;
- buf[p++] = GLX_TRANSPARENT_INDEX_VALUE_EXT;
- buf[p++] = pGlxVisual->transparentIndex;
-
+ buf[p++] = modes->visualRating;
+ buf[p++] = GLX_TRANSPARENT_TYPE;
+ buf[p++] = modes->transparentPixel;
+ buf[p++] = GLX_TRANSPARENT_RED_VALUE;
+ buf[p++] = modes->transparentRed;
+ buf[p++] = GLX_TRANSPARENT_GREEN_VALUE;
+ buf[p++] = modes->transparentGreen;
+ buf[p++] = GLX_TRANSPARENT_BLUE_VALUE;
+ buf[p++] = modes->transparentBlue;
+ buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE;
+ buf[p++] = modes->transparentAlpha;
+ buf[p++] = GLX_TRANSPARENT_INDEX_VALUE;
+ buf[p++] = modes->transparentIndex;
+
+ if ( do_swap ) {
+ __GLX_SWAP_INT_ARRAY(buf, __GLX_TOTAL_CONFIG);
+ }
WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_TOTAL_CONFIG,
(char *)buf);
}
return Success;
}
+int __glXGetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc;
+ return DoGetVisualConfigs( cl, req->screen, GL_FALSE );
+}
+
+
+
+#define __GLX_TOTAL_FBCONFIG_ATTRIBS (28)
+
+/**
+ * Send the set of GLXFBConfigs to the client. There is not currently
+ * and interface into the driver on the server-side to get GLXFBConfigs,
+ * so we "invent" some based on the \c __GLXvisualConfig structures that
+ * the driver does supply.
+ *
+ * The reply format for both \c glXGetFBConfigs and \c glXGetFBConfigsSGIX
+ * is the same, so this routine pulls double duty.
+ */
+
+int DoGetFBConfigs(__GLXclientState *cl, unsigned screen, GLboolean do_swap)
+{
+ ClientPtr client = cl->client;
+ xGLXGetFBConfigsReply reply;
+ __GLXscreenInfo *pGlxScreen;
+ CARD32 buf[__GLX_TOTAL_FBCONFIG_ATTRIBS * 2];
+ int p;
+ __GLcontextModes *modes;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+
+ if (screen >= screenInfo.numScreens) {
+ /* The client library must send a valid screen number. */
+ client->errorValue = screen;
+ return BadValue;
+ }
+ pGlxScreen = &__glXActiveScreens[screen];
+
+ reply.numFBConfigs = pGlxScreen->numUsableVisuals;
+ reply.numAttribs = __GLX_TOTAL_FBCONFIG_ATTRIBS;
+ reply.length = (reply.numAttribs * reply.numFBConfigs);
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+
+ if ( do_swap ) {
+ __GLX_SWAP_SHORT(&reply.sequenceNumber);
+ __GLX_SWAP_INT(&reply.length);
+ __GLX_SWAP_INT(&reply.numFBConfigs);
+ __GLX_SWAP_INT(&reply.numAttribs);
+ }
+
+ WriteToClient(client, sz_xGLXGetFBConfigsReply, (char *)&reply);
+
+ for ( modes = pGlxScreen->modes ; modes != NULL ; modes = modes->next ) {
+ if (modes->visualID == 0) {
+ /* not a usable visual */
+ continue;
+ }
+ p = 0;
+
+#define WRITE_PAIR(tag,value) \
+ do { buf[p++] = tag ; buf[p++] = value ; } while( 0 )
+
+ WRITE_PAIR( GLX_VISUAL_ID, modes->visualID );
+ WRITE_PAIR( GLX_FBCONFIG_ID, modes->visualID );
+ WRITE_PAIR( GLX_X_RENDERABLE, GL_TRUE );
+
+ WRITE_PAIR( GLX_RGBA, modes->rgbMode );
+ WRITE_PAIR( GLX_DOUBLEBUFFER, modes->doubleBufferMode );
+ WRITE_PAIR( GLX_STEREO, modes->stereoMode );
+
+ WRITE_PAIR( GLX_BUFFER_SIZE, modes->rgbBits );
+ WRITE_PAIR( GLX_LEVEL, modes->level );
+ WRITE_PAIR( GLX_AUX_BUFFERS, modes->numAuxBuffers );
+ WRITE_PAIR( GLX_RED_SIZE, modes->redBits );
+ WRITE_PAIR( GLX_GREEN_SIZE, modes->greenBits );
+ WRITE_PAIR( GLX_BLUE_SIZE, modes->blueBits );
+ WRITE_PAIR( GLX_ALPHA_SIZE, modes->alphaBits );
+ WRITE_PAIR( GLX_ACCUM_RED_SIZE, modes->accumRedBits );
+ WRITE_PAIR( GLX_ACCUM_GREEN_SIZE, modes->accumGreenBits );
+ WRITE_PAIR( GLX_ACCUM_BLUE_SIZE, modes->accumBlueBits );
+ WRITE_PAIR( GLX_ACCUM_ALPHA_SIZE, modes->accumAlphaBits );
+ WRITE_PAIR( GLX_DEPTH_SIZE, modes->depthBits );
+ WRITE_PAIR( GLX_STENCIL_SIZE, modes->stencilBits );
+
+ WRITE_PAIR( GLX_X_VISUAL_TYPE, modes->visualType );
+
+ /*
+ ** Add token/value pairs for extensions.
+ */
+ WRITE_PAIR( GLX_CONFIG_CAVEAT, modes->visualRating );
+ WRITE_PAIR( GLX_TRANSPARENT_TYPE, modes->transparentPixel );
+ WRITE_PAIR( GLX_TRANSPARENT_RED_VALUE, modes->transparentRed );
+ WRITE_PAIR( GLX_TRANSPARENT_GREEN_VALUE, modes->transparentGreen );
+ WRITE_PAIR( GLX_TRANSPARENT_BLUE_VALUE, modes->transparentBlue );
+ WRITE_PAIR( GLX_TRANSPARENT_ALPHA_VALUE, modes->transparentAlpha );
+ WRITE_PAIR( GLX_TRANSPARENT_INDEX_VALUE, modes->transparentIndex );
+ WRITE_PAIR( GLX_SWAP_METHOD_OML, modes->swapMethod );
+
+ if ( do_swap ) {
+ __GLX_SWAP_INT_ARRAY(buf, __GLX_TOTAL_FBCONFIG_ATTRIBS * 2);
+ }
+ WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_TOTAL_FBCONFIG_ATTRIBS * 2,
+ (char *)buf);
+ }
+ return Success;
+}
+
+
+int __glXGetFBConfigs(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc;
+ return DoGetFBConfigs( cl, req->screen, GL_FALSE );
+}
+
+
+int __glXGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc;
+ return DoGetFBConfigs( cl, req->screen, GL_FALSE );
+}
+
+
/*
** Create a GLX Pixmap from an X Pixmap.
*/
-int __glXCreateGLXPixmap(__GLXclientState *cl, GLbyte *pc)
+int DoCreateGLXPixmap(__GLXclientState *cl, VisualID visual,
+ GLuint screenNum, XID pixmapId, XID glxpixmapId)
{
ClientPtr client = cl->client;
- xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc;
- VisualID visual = req->visual;
- GLuint screenNum = req->screen;
- XID pixmapId = req->pixmap;
- XID glxpixmapId = req->glxpixmap;
DrawablePtr pDraw;
ScreenPtr pScreen;
VisualPtr pVisual;
__GLXpixmap *pGlxPixmap;
__GLXscreenInfo *pGlxScreen;
- __GLXvisualConfig *pGlxVisual;
+ __GLcontextModes *modes;
int i;
pDraw = (DrawablePtr) LookupDrawable(pixmapId, client);
@@ -1016,13 +1164,8 @@ int __glXCreateGLXPixmap(__GLXclientState *cl, GLbyte *pc)
** Get configuration of the visual.
*/
pGlxScreen = &__glXActiveScreens[screenNum];
- pGlxVisual = pGlxScreen->pGlxVisual;
- for (i = 0; i < pGlxScreen->numVisuals; i++, pGlxVisual++) {
- if (pGlxVisual->vid == visual) {
- break;
- }
- }
- if (i == pGlxScreen->numVisuals) {
+ modes = _gl_context_modes_find_visual( pGlxScreen->modes, visual );
+ if (modes == NULL) {
/*
** Visual not support on this screen by this OpenGL implementation.
*/
@@ -1039,11 +1182,12 @@ int __glXCreateGLXPixmap(__GLXclientState *cl, GLbyte *pc)
}
pGlxPixmap->pDraw = pDraw;
pGlxPixmap->pGlxScreen = pGlxScreen;
- pGlxPixmap->pGlxVisual = pGlxVisual;
pGlxPixmap->pScreen = pScreen;
pGlxPixmap->idExists = True;
pGlxPixmap->refcnt = 0;
+ pGlxPixmap->modes = modes;
+
/*
** Bump the ref count on the X pixmap so it won't disappear.
*/
@@ -1052,6 +1196,34 @@ int __glXCreateGLXPixmap(__GLXclientState *cl, GLbyte *pc)
return Success;
}
+int __glXCreateGLXPixmap(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc;
+ return DoCreateGLXPixmap( cl, req->visual, req->screen,
+ req->pixmap, req->glxpixmap );
+}
+
+int __glXCreatePixmap(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc;
+ return DoCreateGLXPixmap( cl, req->fbconfig, req->screen,
+ req->pixmap, req->glxpixmap );
+}
+
+int __glXCreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXCreateGLXPixmapWithConfigSGIXReq *req =
+ (xGLXCreateGLXPixmapWithConfigSGIXReq *) pc;
+ return DoCreateGLXPixmap( cl, req->fbconfig, req->screen,
+ req->pixmap, req->glxpixmap );
+}
+
+
+/**
+ * Destroy a GLX pixmap. This function is used for both
+ * \c glXDestroyGLXPixmap and \c glXDestroyPixmap.
+ */
+
int __glXDestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc)
{
ClientPtr client = cl->client;
@@ -1589,6 +1761,12 @@ int __glXVendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc)
return __glXQueryContextInfoEXT(cl, pc);
case X_GLXvop_MakeCurrentReadSGI:
return __glXMakeCurrentReadSGI(cl, pc);
+ case X_GLXvop_GetFBConfigsSGIX:
+ return __glXGetFBConfigsSGIX(cl, pc);
+ case X_GLXvop_CreateContextWithConfigSGIX:
+ return __glXCreateContextWithConfigSGIX(cl, pc);
+ case X_GLXvop_CreateGLXPixmapWithConfigSGIX:
+ return __glXCreateGLXPixmapWithConfigSGIX(cl, pc);
default:
break;
}
diff --git a/xc/programs/Xserver/GL/glx/glxcmdsswap.c b/xc/programs/Xserver/GL/glx/glxcmdsswap.c
index f9d57b0b0..6e63fc580 100644
--- a/xc/programs/Xserver/GL/glx/glxcmdsswap.c
+++ b/xc/programs/Xserver/GL/glx/glxcmdsswap.c
@@ -47,6 +47,11 @@
#include "glxext.h"
#include "GL/glx_ansic.h"
+static int __glXSwapGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc);
+static int __glXSwapCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc);
+static int __glXSwapCreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc);
+static int __glXSwapMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc);
+
/************************************************************************/
/*
@@ -67,7 +72,41 @@ int __glXSwapCreateContext(__GLXclientState *cl, GLbyte *pc)
__GLX_SWAP_INT(&req->screen);
__GLX_SWAP_INT(&req->shareList);
- return __glXCreateContext(cl, pc);
+ return DoCreateContext( cl, req->context, req->shareList, req->visual,
+ req->screen, req->isDirect );
+}
+
+int __glXSwapCreateNewContext(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->context);
+ __GLX_SWAP_INT(&req->fbconfig);
+ __GLX_SWAP_INT(&req->screen);
+ __GLX_SWAP_INT(&req->renderType);
+ __GLX_SWAP_INT(&req->shareList);
+
+ return DoCreateContext( cl, req->context, req->shareList, req->fbconfig,
+ req->screen, req->isDirect );
+}
+
+int __glXSwapCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXCreateContextWithConfigSGIXReq *req =
+ (xGLXCreateContextWithConfigSGIXReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->context);
+ __GLX_SWAP_INT(&req->fbconfig);
+ __GLX_SWAP_INT(&req->screen);
+ __GLX_SWAP_INT(&req->renderType);
+ __GLX_SWAP_INT(&req->shareList);
+
+ return DoCreateContext( cl, req->context, req->shareList, req->fbconfig,
+ req->screen, req->isDirect );
}
int __glXSwapDestroyContext(__GLXclientState *cl, GLbyte *pc)
@@ -91,7 +130,8 @@ int __glXSwapMakeCurrent(__GLXclientState *cl, GLbyte *pc)
__GLX_SWAP_INT(&req->context);
__GLX_SWAP_INT(&req->oldContextTag);
- return __glXMakeCurrent(cl, pc);
+ return DoMakeCurrent( cl, req->drawable, req->drawable,
+ req->context, req->oldContextTag );
}
int __glXSwapMakeContextCurrent(__GLXclientState *cl, GLbyte *pc)
@@ -105,7 +145,8 @@ int __glXSwapMakeContextCurrent(__GLXclientState *cl, GLbyte *pc)
__GLX_SWAP_INT(&req->context);
__GLX_SWAP_INT(&req->oldContextTag);
- return __glXMakeContextCurrent(cl, pc);
+ return DoMakeCurrent( cl, req->drawable, req->readdrawable,
+ req->context, req->oldContextTag );
}
int __glXSwapMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc)
@@ -119,7 +160,8 @@ int __glXSwapMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc)
__GLX_SWAP_INT(&req->context);
__GLX_SWAP_INT(&req->oldContextTag);
- return __glXMakeCurrentReadSGI(cl, pc);
+ return DoMakeCurrent( cl, req->drawable, req->readable,
+ req->context, req->oldContextTag );
}
int __glXSwapIsDirect(__GLXclientState *cl, GLbyte *pc)
@@ -182,90 +224,29 @@ int __glXSwapCopyContext(__GLXclientState *cl, GLbyte *pc)
int __glXSwapGetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
{
- ClientPtr client = cl->client;
xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc;
- xGLXGetVisualConfigsReply reply;
- __GLXscreenInfo *pGlxScreen;
- __GLXvisualConfig *pGlxVisual;
- CARD32 buf[__GLX_TOTAL_CONFIG];
- unsigned int screen;
- int i, p;
__GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
__GLX_SWAP_INT(&req->screen);
- screen = req->screen;
- if (screen > screenInfo.numScreens) {
- /* The client library must send a valid screen number. */
- client->errorValue = screen;
- return BadValue;
- }
- pGlxScreen = &__glXActiveScreens[screen];
-
- reply.numVisuals = pGlxScreen->numUsableVisuals;
- reply.numProps = __GLX_TOTAL_CONFIG;
- reply.length = (pGlxScreen->numUsableVisuals * __GLX_SIZE_CARD32 *
- __GLX_TOTAL_CONFIG) >> 2;
- reply.type = X_Reply;
- reply.sequenceNumber = client->sequence;
-
- __GLX_SWAP_SHORT(&reply.sequenceNumber);
- __GLX_SWAP_INT(&reply.length);
- __GLX_SWAP_INT(&reply.numVisuals);
- __GLX_SWAP_INT(&reply.numProps);
- WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *)&reply);
-
- for (i=0; i < pGlxScreen->numVisuals; i++) {
- pGlxVisual = &pGlxScreen->pGlxVisual[i];
- if (pGlxVisual->vid == 0) {
- /* not a usable visual */
- continue;
- }
- p = 0;
- buf[p++] = pGlxVisual->vid;
- buf[p++] = pGlxVisual->class;
- buf[p++] = pGlxVisual->rgba;
-
- buf[p++] = pGlxVisual->redSize;
- buf[p++] = pGlxVisual->greenSize;
- buf[p++] = pGlxVisual->blueSize;
- buf[p++] = pGlxVisual->alphaSize;
- buf[p++] = pGlxVisual->accumRedSize;
- buf[p++] = pGlxVisual->accumGreenSize;
- buf[p++] = pGlxVisual->accumBlueSize;
- buf[p++] = pGlxVisual->accumAlphaSize;
-
- buf[p++] = pGlxVisual->doubleBuffer;
- buf[p++] = pGlxVisual->stereo;
-
- buf[p++] = pGlxVisual->bufferSize;
- buf[p++] = pGlxVisual->depthSize;
- buf[p++] = pGlxVisual->stencilSize;
- buf[p++] = pGlxVisual->auxBuffers;
- buf[p++] = pGlxVisual->level;
- /*
- ** Add token/value pairs for extensions.
- */
- buf[p++] = GLX_VISUAL_CAVEAT_EXT;
- buf[p++] = pGlxVisual->visualRating;
- buf[p++] = GLX_TRANSPARENT_TYPE_EXT;
- buf[p++] = pGlxVisual->transparentPixel;
- buf[p++] = GLX_TRANSPARENT_RED_VALUE_EXT;
- buf[p++] = pGlxVisual->transparentRed;
- buf[p++] = GLX_TRANSPARENT_GREEN_VALUE_EXT;
- buf[p++] = pGlxVisual->transparentGreen;
- buf[p++] = GLX_TRANSPARENT_BLUE_VALUE_EXT;
- buf[p++] = pGlxVisual->transparentBlue;
- buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE_EXT;
- buf[p++] = pGlxVisual->transparentAlpha;
- buf[p++] = GLX_TRANSPARENT_INDEX_VALUE_EXT;
- buf[p++] = pGlxVisual->transparentIndex;
-
- __GLX_SWAP_INT_ARRAY(buf, __GLX_TOTAL_CONFIG);
- WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_TOTAL_CONFIG,
- (char *)buf);
- }
- return Success;
+ return DoGetVisualConfigs( cl, req->screen, GL_TRUE );
+}
+
+int __glXSwapGetFBConfigs(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&req->screen);
+ return DoGetFBConfigs( cl, req->screen, GL_TRUE );
+}
+
+int __glXSwapGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&req->screen);
+ return DoGetFBConfigs( cl, req->screen, GL_TRUE );
}
int __glXSwapCreateGLXPixmap(__GLXclientState *cl, GLbyte *pc)
@@ -279,7 +260,39 @@ int __glXSwapCreateGLXPixmap(__GLXclientState *cl, GLbyte *pc)
__GLX_SWAP_INT(&req->pixmap);
__GLX_SWAP_INT(&req->glxpixmap);
- return __glXCreateGLXPixmap(cl, pc);
+ return DoCreateGLXPixmap( cl, req->visual, req->screen,
+ req->pixmap, req->glxpixmap );
+}
+
+int __glXSwapCreatePixmap(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->screen);
+ __GLX_SWAP_INT(&req->fbconfig);
+ __GLX_SWAP_INT(&req->pixmap);
+ __GLX_SWAP_INT(&req->glxpixmap);
+
+ return DoCreateGLXPixmap( cl, req->fbconfig, req->screen,
+ req->pixmap, req->glxpixmap );
+}
+
+int __glXSwapCreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXCreateGLXPixmapWithConfigSGIXReq *req =
+ (xGLXCreateGLXPixmapWithConfigSGIXReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->screen);
+ __GLX_SWAP_INT(&req->fbconfig);
+ __GLX_SWAP_INT(&req->pixmap);
+ __GLX_SWAP_INT(&req->glxpixmap);
+
+ return DoCreateGLXPixmap( cl, req->fbconfig, req->screen,
+ req->pixmap, req->glxpixmap );
}
int __glXSwapDestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc)
@@ -357,7 +370,7 @@ int __glXSwapClientInfo(__GLXclientState *cl, GLbyte *pc)
return __glXClientInfo(cl, pc);
}
-int __glXSwapQueryContextInfoEXT(__GLXclientState *cl, char *pc)
+int __glXSwapQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc)
{
xGLXQueryContextInfoEXTReq *req = (xGLXQueryContextInfoEXTReq *) pc;
__GLX_DECLARE_SWAP_VARIABLES;
@@ -832,6 +845,12 @@ int __glXSwapVendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc)
return __glXSwapQueryContextInfoEXT(cl, pc);
case X_GLXvop_MakeCurrentReadSGI:
return __glXSwapMakeCurrentReadSGI(cl, pc);
+ case X_GLXvop_GetFBConfigsSGIX:
+ return __glXSwapGetFBConfigsSGIX(cl, pc);
+ case X_GLXvop_CreateContextWithConfigSGIX:
+ return __glXSwapCreateContextWithConfigSGIX(cl, pc);
+ case X_GLXvop_CreateGLXPixmapWithConfigSGIX:
+ return __glXSwapCreateGLXPixmapWithConfigSGIX(cl, pc);
default:
break;
}
diff --git a/xc/programs/Xserver/GL/glx/glxcontext.h b/xc/programs/Xserver/GL/glx/glxcontext.h
index 5eb72177e..9a16851f0 100644
--- a/xc/programs/Xserver/GL/glx/glxcontext.h
+++ b/xc/programs/Xserver/GL/glx/glxcontext.h
@@ -80,7 +80,6 @@ struct __GLXcontextRec {
** This context is created with respect to this visual.
*/
VisualRec *pVisual;
- __GLXvisualConfig *pGlxVisual;
/*
** The XID of this context.
diff --git a/xc/programs/Xserver/GL/glx/glxdrawable.h b/xc/programs/Xserver/GL/glx/glxdrawable.h
index 972a6045f..1d7f44352 100644
--- a/xc/programs/Xserver/GL/glx/glxdrawable.h
+++ b/xc/programs/Xserver/GL/glx/glxdrawable.h
@@ -40,7 +40,7 @@
typedef struct {
DrawablePtr pDraw;
- __GLXvisualConfig *pGlxVisual;
+ __GLcontextModes *modes;
__GLXscreenInfo *pGlxScreen;
ScreenPtr pScreen;
Bool idExists;
@@ -69,11 +69,12 @@ struct __GLXdrawablePrivateRec {
/*
** Configuration of the visual to which this drawable was created.
*/
- __GLXvisualConfig *pGlxVisual;
+ __GLcontextModes *modes;
/*
** cached drawable size and origin
*/
+
GLint xorigin, yorigin;
GLint width, height;
diff --git a/xc/programs/Xserver/GL/glx/glxext.h b/xc/programs/Xserver/GL/glx/glxext.h
index 876449300..a5bf34d7f 100644
--- a/xc/programs/Xserver/GL/glx/glxext.h
+++ b/xc/programs/Xserver/GL/glx/glxext.h
@@ -71,10 +71,18 @@ extern GLboolean __glXErrorOccured(void);
extern void __glXResetLargeCommandStatus(__GLXclientState*);
extern int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc);
-extern int __glXSwapQueryContextInfoEXT(__GLXclientState *cl, char *pc);
+extern int __glXSwapQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc);
-extern int __glXMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc);
-extern int __glXSwapMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc);
+extern int DoMakeCurrent( __GLXclientState *cl, GLXDrawable drawId,
+ GLXDrawable readId, GLXContextID contextId, GLXContextTag tag );
+extern int DoGetVisualConfigs(__GLXclientState *cl, unsigned screen,
+ GLboolean do_swap);
+extern int DoGetFBConfigs(__GLXclientState *cl, unsigned screen,
+ GLboolean do_swap);
+extern int DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
+ GLXContextID shareList, VisualID visual, GLuint screen, GLboolean isDirect);
+extern int DoCreateGLXPixmap(__GLXclientState *cl, VisualID visual,
+ GLuint screenNum, XID pixmapId, XID glxpixmapId);
extern void GlxExtensionInit(void);
diff --git a/xc/programs/Xserver/GL/glx/glxscreens.c b/xc/programs/Xserver/GL/glx/glxscreens.c
index 8ec0e4768..04882098a 100644
--- a/xc/programs/Xserver/GL/glx/glxscreens.c
+++ b/xc/programs/Xserver/GL/glx/glxscreens.c
@@ -133,8 +133,10 @@ static char GLXServerExtensions[] =
"GLX_EXT_visual_info "
"GLX_EXT_visual_rating "
"GLX_EXT_import_context "
+ "GLX_OML_swap_method "
"GLX_SGI_make_current_read "
"GLX_SGIS_multisample "
+ "GLX_SGIX_fbconfig "
;
/*
@@ -154,81 +156,6 @@ GLint __glXNumActiveScreens;
RESTYPE __glXDrawableRes;
-#if 0
-static int
-CountBits(unsigned long mask)
-{
- int count = 0;
-
- while(mask) {
- count += (mask&1);
- mask >>= 1;
- }
-
- return count;
-}
-#endif
-
-#if 0
-/*
-** A typical implementation would not probably not run through the screen's
-** visuals to find ones that match the visual configs supplied by the DDX
-** Sample OpenGL as we do here; we have done this to make this code easy to
-** drop into an existing X server.
-*/
-static int matchVisuals(__GLXvisualConfig *pGlxVisual, int numVisuals,
- int screen)
-{
- int i, j;
- __GLXvisualConfig *pvis = pGlxVisual;
- ScreenPtr pScreen = screenInfo.screens[screen];
- VisualPtr pVisual;
- int numMatchingVisuals = 0;
- int *used;
-
- used = (int *)__glXMalloc(pScreen->numVisuals*sizeof(int));
- __glXMemset(used, 0, pScreen->numVisuals*sizeof(int));
-
- for (i=0; i < numVisuals; i++, pvis++) {
- /*
- ** Look through all the server's visuals to see which match.
- */
- pvis->vid = 0;
- pVisual = pScreen->visuals;
- for (j=0; j < pScreen->numVisuals; j++, pVisual++) {
- if (pvis->class == pVisual->class &&
- pvis->bufferSize == pVisual->nplanes &&
- !used[j]) {
- int rBits, gBits, bBits, aBits;
-
- /* count bits per rgb */
- rBits = CountBits(pVisual->redMask);
- gBits = CountBits(pVisual->greenMask);
- bBits = CountBits(pVisual->blueMask);
- aBits = 0;
- if ((pvis->redSize == rBits) &&
- (pvis->greenSize == gBits) &&
- (pvis->blueSize == bBits) &&
- (pvis->alphaSize == aBits)) {
- /*
- ** We'll consider this a match.
- */
- pvis->vid = pVisual->vid;
- pvis->redMask = pVisual->redMask;
- pvis->greenMask = pVisual->greenMask;
- pvis->blueMask = pVisual->blueMask;
- pvis->alphaMask = 0;
- numMatchingVisuals++;
- used[j] = 1;
- break;
- }
- }
- }
- }
- __glXFree(used);
- return numMatchingVisuals;
-}
-#endif
/*
** Destroy routine that gets called when a drawable is freed. A drawable
@@ -358,14 +285,7 @@ void __glXScreenInit(GLint numscreens)
if ((*__glXScreens[j]->screenProbe)(i)) {
__glXActiveScreens[i] = *__glXScreens[j];
-#if 0
- /* we don't use this since matchVisuals doesn't allow alpha */
- __glXActiveScreens[i].numUsableVisuals =
- matchVisuals(__glXActiveScreens[i].pGlxVisual,
- __glXActiveScreens[i].numVisuals, i);
-#else
__glXActiveScreens[i].numUsableVisuals = __glXActiveScreens[i].numVisuals;
-#endif
__glXActiveScreens[i].GLextensions = __glXStrdup(GLServerExtensions);
__glXActiveScreens[i].GLXvendor = __glXStrdup(GLXServerVendorName);
__glXActiveScreens[i].GLXversion = __glXStrdup(GLXServerVersion);
diff --git a/xc/programs/Xserver/GL/glx/glxscreens.h b/xc/programs/Xserver/GL/glx/glxscreens.h
index 99f76dc38..9ca166b74 100644
--- a/xc/programs/Xserver/GL/glx/glxscreens.h
+++ b/xc/programs/Xserver/GL/glx/glxscreens.h
@@ -70,7 +70,11 @@ typedef struct {
*/
void (*createBuffer)(__GLXdrawablePrivate *glxPriv);
- __GLXvisualConfig *pGlxVisual;
+ /**
+ * Linked list of valid context modes for this screen.
+ */
+ __GLcontextModes *modes;
+
void **pVisualPriv;
GLint numVisuals;
GLint numUsableVisuals;
diff --git a/xc/programs/Xserver/GL/glx/glxutil.c b/xc/programs/Xserver/GL/glx/glxutil.c
index 7aafd0065..4512aa5e9 100644
--- a/xc/programs/Xserver/GL/glx/glxutil.c
+++ b/xc/programs/Xserver/GL/glx/glxutil.c
@@ -44,6 +44,9 @@
#include "glxutil.h"
#include "glxbuf.h"
#include "GL/glx_ansic.h"
+#include "GL/internal/glcore.h"
+#include "GL/glxint.h"
+#include "glcontextmodes.h"
/************************************************************************/
@@ -214,53 +217,6 @@ __glXResizeDrawable(__GLdrawablePrivate *glPriv)
}
-/************************************************************************/
-
-void
-__glXFormatGLModes(__GLcontextModes *modes, __GLXvisualConfig *config)
-{
- __glXMemset(modes, 0, sizeof(__GLcontextModes));
-
- modes->rgbMode = (config->rgba != 0);
- modes->colorIndexMode = !(modes->rgbMode);
- modes->doubleBufferMode = (config->doubleBuffer != 0);
- modes->stereoMode = (config->stereo != 0);
-
- modes->haveAccumBuffer = ((config->accumRedSize +
- config->accumGreenSize +
- config->accumBlueSize +
- config->accumAlphaSize) > 0);
- modes->haveDepthBuffer = (config->depthSize > 0);
- modes->haveStencilBuffer = (config->stencilSize > 0);
-
- modes->redBits = config->redSize;
- modes->greenBits = config->greenSize;
- modes->blueBits = config->blueSize;
- modes->alphaBits = config->alphaSize;
- modes->redMask = config->redMask;
- modes->greenMask = config->greenMask;
- modes->blueMask = config->blueMask;
- modes->alphaMask = config->alphaMask;
-#if 0
- modes->rgbBits = modes->redBits + modes->greenBits +
- modes->blueBits + modes->alphaBits;
-#endif
- assert( !modes->rgbMode || ((config->bufferSize & 0x7) == 0) );
- modes->rgbBits = config->bufferSize;
- modes->indexBits = config->bufferSize;
-
- modes->accumRedBits = config->accumRedSize;
- modes->accumGreenBits = config->accumGreenSize;
- modes->accumBlueBits = config->accumBlueSize;
- modes->accumAlphaBits = config->accumAlphaSize;
- modes->depthBits = config->depthSize;
- modes->stencilBits = config->stencilSize;
-
- modes->numAuxBuffers = 0; /* XXX: should be picked up from the visual */
-
- modes->level = config->level;
-}
-
/*****************************************************************************/
/* accessing the drawable private */
@@ -382,21 +338,13 @@ __glXCreateDrawablePrivate(DrawablePtr pDraw, XID drawId,
pGlxScreen = &__glXActiveScreens[pDraw->pScreen->myNum];
- /* allocate the buffers */
if (glxPriv->type == DRAWABLE_WINDOW) {
- int i;
VisualID vid = wVisual((WindowPtr)pDraw);
- __GLXvisualConfig *pGlxVisual = pGlxScreen->pGlxVisual;
- for (i = 0; i < pGlxScreen->numVisuals; i++, pGlxVisual++) {
- if (pGlxVisual->vid == vid) {
- glxPriv->pGlxVisual = pGlxVisual;
- break;
- }
- }
+ glxPriv->modes = _gl_context_modes_find_visual( pGlxScreen->modes, vid );
__glXFBInitDrawable(glxPriv, modes);
} else {
- glxPriv->pGlxVisual = glxPriv->pGlxPixmap->pGlxVisual;
+ glxPriv->modes = glxPriv->pGlxPixmap->modes;
__glXPixInitDrawable(glxPriv, modes);
}
diff --git a/xc/programs/Xserver/GL/glx/glxutil.h b/xc/programs/Xserver/GL/glx/glxutil.h
index 67bfb06f9..970683cb1 100644
--- a/xc/programs/Xserver/GL/glx/glxutil.h
+++ b/xc/programs/Xserver/GL/glx/glxutil.h
@@ -55,7 +55,6 @@ extern void __glXGetDrawableSize(__GLdrawablePrivate *glPriv,
GLuint *width, GLuint *height);
extern GLboolean __glXResizeDrawable(__GLdrawablePrivate *glPriv);
extern GLboolean __glXResizeDrawableBuffers(__GLXdrawablePrivate *glxPriv);
-extern void __glXFormatGLModes(__GLcontextModes *modes, __GLXvisualConfig *config);
/* drawable management */
extern void __glXRefDrawablePrivate(__GLXdrawablePrivate *glxPriv);
diff --git a/xc/programs/Xserver/GL/glxmodule.c b/xc/programs/Xserver/GL/glxmodule.c
index eb8e54f26..d03ce6464 100644
--- a/xc/programs/Xserver/GL/glxmodule.c
+++ b/xc/programs/Xserver/GL/glxmodule.c
@@ -776,7 +776,6 @@ static const char *glcoreSymbols[] = {
"__glXFogfvReqSize",
"__glXFogivReqSize",
"__glXForceCurrent",
- "__glXFormatGLModes",
"__glXFree",
"__glXFreeBuffers",
"__glXFreeContext",
diff --git a/xc/programs/Xserver/GL/mesa/X/xf86glx.c b/xc/programs/Xserver/GL/mesa/X/xf86glx.c
index 19b8ba7c8..3947fb9d0 100644
--- a/xc/programs/Xserver/GL/mesa/X/xf86glx.c
+++ b/xc/programs/Xserver/GL/mesa/X/xf86glx.c
@@ -65,6 +65,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <GL/internal/glcore.h>
#endif
+#include "glcontextmodes.h"
/*
* This structure is statically allocated in the __glXScreens[]
@@ -79,7 +80,7 @@ __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 */
- NULL, /* Set up pGlxVisual in probe */
+ NULL, /* Set up modes in probe */
NULL, /* Set up pVisualPriv in probe */
0, /* Set up numVisuals in probe */
0, /* Set up numUsableVisuals in probe */
@@ -118,18 +119,19 @@ static int count_bits(unsigned int n)
static XMesaVisual find_mesa_visual(int screen, VisualID vid)
{
- XMesaVisual xm_vis = NULL;
- __MESA_screen *pMScr = &MESAScreens[screen];
- int i;
+ __MESA_screen * const pMScr = &MESAScreens[screen];
+ const __GLcontextModes *modes;
+ unsigned i = 0;
- for (i = 0; i < pMScr->num_vis; i++) {
- if (pMScr->glx_vis[i].vid == vid) {
- xm_vis = pMScr->xm_vis[i];
+ for ( modes = pMScr->modes ; modes != NULL ; modes = modes->next ) {
+ if ( modes->visualID == vid ) {
break;
}
+
+ i++;
}
- return xm_vis;
+ return (modes != NULL) ? pMScr->xm_vis[i] : NULL;
}
@@ -257,7 +259,7 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp,
VisualPtr pVisual = *visualp;
VisualPtr pVisualNew = NULL;
VisualID *orig_vid = NULL;
- __GLXvisualConfig *glXVisualPtr = NULL;
+ __GLcontextModes *modes;
__GLXvisualConfig *pNewVisualConfigs = NULL;
void **glXVisualPriv;
void **pNewVisualPriv;
@@ -331,9 +333,8 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp,
}
/* Alloc space for the list of glXVisuals */
- glXVisualPtr = (__GLXvisualConfig *)__glXMalloc(numNewVisuals *
- sizeof(__GLXvisualConfig));
- if (!glXVisualPtr) {
+ modes = _gl_context_modes_create(numNewVisuals, sizeof(__GLcontextModes));
+ if (modes == NULL) {
__glXFree(orig_vid);
__glXFree(pNewVisualPriv);
__glXFree(pNewVisualConfigs);
@@ -343,7 +344,7 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp,
/* Alloc space for the list of glXVisualPrivates */
glXVisualPriv = (void **)__glXMalloc(numNewVisuals * sizeof(void *));
if (!glXVisualPriv) {
- __glXFree(glXVisualPtr);
+ _gl_context_modes_destroy( modes );
__glXFree(orig_vid);
__glXFree(pNewVisualPriv);
__glXFree(pNewVisualConfigs);
@@ -354,7 +355,7 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp,
pVisualNew = (VisualPtr)__glXMalloc(numNewVisuals * sizeof(VisualRec));
if (!pVisualNew) {
__glXFree(glXVisualPriv);
- __glXFree(glXVisualPtr);
+ _gl_context_modes_destroy( modes );
__glXFree(orig_vid);
__glXFree(pNewVisualPriv);
__glXFree(pNewVisualConfigs);
@@ -363,6 +364,7 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp,
/* Initialize the new visuals */
found_default = FALSE;
+ MESAScreens[screenInfo.numScreens-1].modes = modes;
for (i = j = 0; i < numVisuals; i++) {
int is_rgb = (pVisual[i].class == TrueColor ||
pVisual[i].class == DirectColor);
@@ -371,6 +373,8 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp,
if (pNewVisualConfigs[k].rgba != is_rgb)
continue;
+ assert( modes != NULL );
+
/* Initialize the new visual */
pVisualNew[j] = pVisual[i];
pVisualNew[j].vid = FakeClientID(0);
@@ -385,8 +389,8 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp,
orig_vid[j] = pVisual[i].vid;
/* Initialize the glXVisual */
- glXVisualPtr[j] = pNewVisualConfigs[k];
- glXVisualPtr[j].vid = pVisualNew[j].vid;
+ _gl_copy_visual_to_context_mode( modes, & pNewVisualConfigs[k] );
+ modes->visualID = pVisualNew[j].vid;
/*
* If the class is -1, then assume the X visual information
@@ -394,30 +398,27 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp,
* visual. NOTE: if class != -1, then all other fields MUST
* be initialized.
*/
- if (glXVisualPtr[j].class == -1) {
- glXVisualPtr[j].class = pVisual[i].class;
- glXVisualPtr[j].redSize = count_bits(pVisual[i].redMask);
- glXVisualPtr[j].greenSize = count_bits(pVisual[i].greenMask);
- glXVisualPtr[j].blueSize = count_bits(pVisual[i].blueMask);
- glXVisualPtr[j].alphaSize = glXVisualPtr[j].alphaSize;
- glXVisualPtr[j].redMask = pVisual[i].redMask;
- glXVisualPtr[j].greenMask = pVisual[i].greenMask;
- glXVisualPtr[j].blueMask = pVisual[i].blueMask;
- glXVisualPtr[j].alphaMask = glXVisualPtr[j].alphaMask;
- if (is_rgb) {
- glXVisualPtr[j].bufferSize = glXVisualPtr[j].redSize +
- glXVisualPtr[j].greenSize +
- glXVisualPtr[j].blueSize +
- glXVisualPtr[j].alphaSize;
- } else {
- glXVisualPtr[j].bufferSize = rootDepth;
- }
+ if (modes->visualType == GLX_NONE) {
+ modes->visualType = _gl_convert_from_x_visual_type( pVisual[i].class );
+ modes->redBits = count_bits(pVisual[i].redMask);
+ modes->greenBits = count_bits(pVisual[i].greenMask);
+ modes->blueBits = count_bits(pVisual[i].blueMask);
+ modes->alphaBits = modes->alphaBits;
+ modes->redMask = pVisual[i].redMask;
+ modes->greenMask = pVisual[i].greenMask;
+ modes->blueMask = pVisual[i].blueMask;
+ modes->alphaMask = modes->alphaMask;
+ modes->rgbBits = (is_rgb)
+ ? (modes->redBits + modes->greenBits +
+ modes->blueBits + modes->alphaBits)
+ : rootDepth;
}
/* Save the device-dependent private for this visual */
glXVisualPriv[j] = pNewVisualPriv[k];
j++;
+ modes = modes->next;
}
}
@@ -425,7 +426,6 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp,
/* Save the GLX visuals in the screen structure */
MESAScreens[screenInfo.numScreens-1].num_vis = numNewVisuals;
- MESAScreens[screenInfo.numScreens-1].glx_vis = glXVisualPtr;
MESAScreens[screenInfo.numScreens-1].private = glXVisualPriv;
/* Set up depth's VisualIDs */
@@ -501,27 +501,28 @@ static void fixup_visuals(int screen)
{
ScreenPtr pScreen = screenInfo.screens[screen];
__MESA_screen *pMScr = &MESAScreens[screen];
- __GLXvisualConfig *pGLXVis = pMScr->glx_vis;
- VisualPtr pVis;
- int i, j;
+ int j;
+ __GLcontextModes *modes;
- for (i = 0; i < pMScr->num_vis; i++, pGLXVis++) {
- pVis = pScreen->visuals;
+ for ( modes = pMScr->modes ; modes != NULL ; modes = modes->next ) {
+ const int vis_class = _gl_convert_to_x_visual_type( modes->visualType );
+ const int nplanes = (modes->rgbBits - modes->alphaBits);
+ const VisualPtr pVis = pScreen->visuals;
/* Find a visual that matches the GLX visual's class and size */
- for (j = 0; j < pScreen->numVisuals; j++, pVis++) {
- if (pVis->class == pGLXVis->class &&
- pVis->nplanes == (pGLXVis->bufferSize - pGLXVis->alphaSize)) {
+ for (j = 0; j < pScreen->numVisuals; j++) {
+ if (pVis[j].class == vis_class &&
+ pVis[j].nplanes == nplanes) {
/* Fixup the masks */
- pGLXVis->redMask = pVis->redMask;
- pGLXVis->greenMask = pVis->greenMask;
- pGLXVis->blueMask = pVis->blueMask;
+ modes->redMask = pVis[j].redMask;
+ modes->greenMask = pVis[j].greenMask;
+ modes->blueMask = pVis[j].blueMask;
/* Recalc the sizes */
- pGLXVis->redSize = count_bits(pGLXVis->redMask);
- pGLXVis->greenSize = count_bits(pGLXVis->greenMask);
- pGLXVis->blueSize = count_bits(pGLXVis->blueMask);
+ modes->redBits = count_bits(modes->redMask);
+ modes->greenBits = count_bits(modes->greenMask);
+ modes->blueBits = count_bits(modes->blueMask);
}
}
}
@@ -530,9 +531,8 @@ static void fixup_visuals(int screen)
static void init_screen_visuals(int screen)
{
ScreenPtr pScreen = screenInfo.screens[screen];
- __GLXvisualConfig *pGLXVis = MESAScreens[screen].glx_vis;
+ __GLcontextModes *modes;
XMesaVisual *pXMesaVisual;
- VisualPtr pVis;
int *used;
int i, j;
@@ -542,49 +542,70 @@ static void init_screen_visuals(int screen)
__glXMemset(pXMesaVisual, 0,
MESAScreens[screen].num_vis * sizeof(XMesaVisual));
+ /* FIXME: Change 'used' to be a array of bits (rather than of ints),
+ * FIXME: create a stack array of 8 or 16 bytes. If 'numVisuals' is less
+ * FIXME: than 64 or 128 the stack array can be used instead of calling
+ * FIXME: __glXMalloc / __glXFree. If nothing else, convert 'used' to
+ * FIXME: array of bytes instead of ints!
+ */
used = (int *)__glXMalloc(pScreen->numVisuals * sizeof(int));
__glXMemset(used, 0, pScreen->numVisuals * sizeof(int));
- for (i = 0; i < MESAScreens[screen].num_vis; i++, pGLXVis++) {
-
- pVis = pScreen->visuals;
- for (j = 0; j < pScreen->numVisuals; j++, pVis++) {
-
- if (pVis->class == pGLXVis->class &&
- pVis->nplanes == (pGLXVis->bufferSize - pGLXVis->alphaSize) &&
+ i = 0;
+ for ( modes = MESAScreens[screen].modes
+ ; modes != NULL
+ ; modes = modes->next ) {
+ const int vis_class = _gl_convert_to_x_visual_type( modes->visualType );
+ const int nplanes = (modes->rgbBits - modes->alphaBits);
+ const VisualPtr pVis = pScreen->visuals;
+
+ for (j = 0; j < pScreen->numVisuals; j++) {
+ if (pVis[j].class == vis_class &&
+ pVis[j].nplanes == nplanes &&
+ pVis[j].redMask == modes->redMask &&
+ pVis[j].greenMask == modes->greenMask &&
+ pVis[j].blueMask == modes->blueMask &&
!used[j]) {
- if (pVis->redMask == pGLXVis->redMask &&
- pVis->greenMask == pGLXVis->greenMask &&
- pVis->blueMask == pGLXVis->blueMask) {
-
- /* Create the XMesa visual */
- pXMesaVisual[i] =
- XMesaCreateVisual(pScreen,
- pVis,
- pGLXVis->rgba,
- (pGLXVis->alphaSize > 0),
- pGLXVis->doubleBuffer,
- pGLXVis->stereo,
- GL_TRUE, /* ximage_flag */
- pGLXVis->depthSize,
- pGLXVis->stencilSize,
- pGLXVis->accumRedSize,
- pGLXVis->accumGreenSize,
- pGLXVis->accumBlueSize,
- pGLXVis->accumAlphaSize,
- 0, /* numSamples */
- pGLXVis->level,
- pGLXVis->visualRating );
- /* Set the VisualID */
- pGLXVis->vid = pVis->vid;
-
- /* Mark this visual used */
- used[j] = 1;
- break;
- }
+ /* Create the XMesa visual */
+ pXMesaVisual[i] =
+ XMesaCreateVisual(pScreen,
+ pVis,
+ modes->rgbMode,
+ (modes->alphaBits > 0),
+ modes->doubleBufferMode,
+ modes->stereoMode,
+ GL_TRUE, /* ximage_flag */
+ modes->depthBits,
+ modes->stencilBits,
+ modes->accumRedBits,
+ modes->accumGreenBits,
+ modes->accumBlueBits,
+ modes->accumAlphaBits,
+ modes->samples,
+ modes->level,
+ modes->visualRating);
+ /* Set the VisualID */
+ modes->visualID = pVis[j].vid;
+
+ /* Mark this visual used */
+ used[j] = 1;
+ break;
}
}
+
+ if ( j == pScreen->numVisuals ) {
+ ErrorF("No matching visual for __GLcontextMode with "
+ "visual class = %d (%d), nplanes = %u\n",
+ vis_class,
+ modes->visualType,
+ (modes->rgbBits - modes->alphaBits) );
+ }
+ else if ( modes->visualID == -1 ) {
+ FatalError( "Matching visual found, but visualID still -1!\n" );
+ }
+
+ i++;
}
__glXFree(used);
@@ -597,7 +618,7 @@ Bool __MESA_screenProbe(int screen)
/*
* Set up the current screen's visuals.
*/
- __glDDXScreenInfo.pGlxVisual = MESAScreens[screen].glx_vis;
+ __glDDXScreenInfo.modes = MESAScreens[screen].modes;
__glDDXScreenInfo.pVisualPriv = MESAScreens[screen].private;
__glDDXScreenInfo.numVisuals =
__glDDXScreenInfo.numUsableVisuals = MESAScreens[screen].num_vis;
@@ -636,15 +657,15 @@ extern void __MESA_resetExtension(void)
MESAScreens[i].xm_vis[j] = NULL;
}
}
- __glXFree(MESAScreens[i].glx_vis);
- MESAScreens[i].glx_vis = NULL;
+ _gl_context_modes_destroy( MESAScreens[i].modes );
+ MESAScreens[i].modes = NULL;
__glXFree(MESAScreens[i].private);
MESAScreens[i].private = NULL;
__glXFree(MESAScreens[i].xm_vis);
MESAScreens[i].xm_vis = NULL;
MESAScreens[i].num_vis = 0;
}
- __glDDXScreenInfo.pGlxVisual = NULL;
+ __glDDXScreenInfo.modes = NULL;
MESA_CC = NULL;
}
@@ -652,10 +673,14 @@ void __MESA_createBuffer(__GLXdrawablePrivate *glxPriv)
{
DrawablePtr pDraw = glxPriv->pDraw;
XMesaVisual xm_vis = find_mesa_visual(pDraw->pScreen->myNum,
- glxPriv->pGlxVisual->vid);
+ glxPriv->modes->visualID);
__GLdrawablePrivate *glPriv = &glxPriv->glPriv;
__MESA_buffer buf;
+ if (xm_vis == NULL) {
+ ErrorF("find_mesa_visual returned NULL for visualID = 0x%04x\n",
+ glxPriv->modes->visualID);
+ }
buf = (__MESA_buffer)__glXMalloc(sizeof(struct __MESA_bufferRec));
/* Create Mesa's buffers */
@@ -736,12 +761,17 @@ __GLinterface *__MESA_createContext(__GLimports *imports,
if (shareGC)
m_share = (__GLcontext *)shareGC;
- xm_vis = find_mesa_visual(glxc->pScreen->myNum, glxc->pGlxVisual->vid);
+ xm_vis = find_mesa_visual(glxc->pScreen->myNum, glxc->modes->visualID);
if (xm_vis) {
XMesaContext xmshare = m_share ? m_share->DriverCtx : 0;
XMesaContext xmctx = XMesaCreateContext(xm_vis, xmshare);
gl_ctx = xmctx ? &xmctx->mesa : 0;
}
+ else {
+ ErrorF("find_mesa_visual returned NULL for visualID = 0x%04x\n",
+ glxc->modes->visualID);
+ }
+
if (!gl_ctx)
return NULL;
diff --git a/xc/programs/Xserver/GL/mesa/X/xf86glxint.h b/xc/programs/Xserver/GL/mesa/X/xf86glxint.h
index 47c8e7608..3d7dcec6f 100644
--- a/xc/programs/Xserver/GL/mesa/X/xf86glxint.h
+++ b/xc/programs/Xserver/GL/mesa/X/xf86glxint.h
@@ -39,15 +39,10 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <GL/gl.h>
#include <GL/xmesa.h>
-/* struct __GLcontextRec { */
-/* __GLinterface iface; */
-/* XMesaContext xm_ctx; */
-/* }; */
-
typedef struct __MESA_screenRec __MESA_screen;
struct __MESA_screenRec {
int num_vis;
- __GLXvisualConfig *glx_vis;
+ __GLcontextModes *modes;
XMesaVisual *xm_vis;
void **private;
};