summaryrefslogtreecommitdiff
path: root/glx
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2018-01-10 13:05:45 -0500
committerAdam Jackson <ajax@redhat.com>2018-02-14 17:04:44 -0500
commitd8ec33fe0542141aed1d9016d2ecaf52da944b4b (patch)
treeb970ad23c4bf15f9750947b98cb43199af50a278 /glx
parent8753218beae641e5c5ac2c2ba598cfb99a893cf4 (diff)
glx: Use vnd layer for dispatch (v4)
The big change here is MakeCurrent and context tag tracking. We now delegate context tags entirely to the vnd layer, and simply store a pointer to the context state as the tag data. If a context is deleted while it's current, we allocate a fake ID for the context and move the context state there, so the tag data still points to a real context. As a result we can stop trying so hard to detach the client from contexts at disconnect time and just let resource destruction handle it. Since vnd handles all the MakeCurrent protocol now, our request handlers for it can just be return BadImplementation. We also remove a bunch of LEGAL_NEW_RESOURCE, because now by the time we're called vnd has already allocated its tracking resource on that XID. v2: Update to match v2 of the vnd import, and remove more redundant work like request length checks. v3: Add/remove the XID map from the vendor private thunk, not the backend. (Kyle Brenneman) v4: Fix deletion of ghost contexts (Kyle Brenneman) Signed-off-by: Adam Jackson <ajax@redhat.com>
Diffstat (limited to 'glx')
-rw-r--r--glx/createcontext.c2
-rw-r--r--glx/glxcmds.c213
-rw-r--r--glx/glxcmdsswap.c98
-rw-r--r--glx/glxext.c341
-rw-r--r--glx/glxext.h4
-rw-r--r--glx/glxscreens.h1
-rw-r--r--glx/glxserver.h5
-rw-r--r--glx/xfont.c2
8 files changed, 297 insertions, 369 deletions
diff --git a/glx/createcontext.c b/glx/createcontext.c
index 76316db67..00c23fcdd 100644
--- a/glx/createcontext.c
+++ b/glx/createcontext.c
@@ -123,8 +123,6 @@ __glXDisp_CreateContextAttribsARB(__GLXclientState * cl, GLbyte * pc)
if (req->length != expected_size)
return BadLength;
- LEGAL_NEW_RESOURCE(req->context, client);
-
/* The GLX_ARB_create_context spec says:
*
* "* If <config> is not a valid GLXFBConfig, GLXBadFBConfig is
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index f4820d8e4..c5d6324d3 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -47,6 +47,7 @@
#include "indirect_table.h"
#include "indirect_util.h"
#include "protocol-versions.h"
+#include "glxvndabi.h"
static char GLXServerVendorName[] = "SGI";
@@ -135,6 +136,10 @@ _X_HIDDEN int
validGlxContext(ClientPtr client, XID id, int access_mode,
__GLXcontext ** context, int *err)
{
+ /* no ghost contexts */
+ if (id & SERVER_BIT)
+ return FALSE;
+
*err = dixLookupResourceByType((void **) context, id,
__glXContextRes, client, access_mode);
if (*err != Success || (*context)->idExists == GL_FALSE) {
@@ -240,8 +245,6 @@ DoCreateContext(__GLXclientState * cl, GLXContextID gcId,
__GLXcontext *glxc, *shareglxc;
int err;
- LEGAL_NEW_RESOURCE(gcId, client);
-
/*
** Find the display list space that we want to share.
**
@@ -356,14 +359,11 @@ DoCreateContext(__GLXclientState * cl, GLXContextID gcId,
int
__glXDisp_CreateContext(__GLXclientState * cl, GLbyte * pc)
{
- ClientPtr client = cl->client;
xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc;
__GLXconfig *config;
__GLXscreen *pGlxScreen;
int err;
- REQUEST_SIZE_MATCH(xGLXCreateContextReq);
-
if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
return err;
if (!validGlxVisual(cl->client, pGlxScreen, req->visual, &config, &err))
@@ -376,14 +376,11 @@ __glXDisp_CreateContext(__GLXclientState * cl, GLbyte * pc)
int
__glXDisp_CreateNewContext(__GLXclientState * cl, GLbyte * pc)
{
- ClientPtr client = cl->client;
xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc;
__GLXconfig *config;
__GLXscreen *pGlxScreen;
int err;
- REQUEST_SIZE_MATCH(xGLXCreateNewContextReq);
-
if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
return err;
if (!validGlxFBConfig(cl->client, pGlxScreen, req->fbconfig, &config, &err))
@@ -417,62 +414,33 @@ __glXDisp_CreateContextWithConfigSGIX(__GLXclientState * cl, GLbyte * pc)
int
__glXDisp_DestroyContext(__GLXclientState * cl, GLbyte * pc)
{
- ClientPtr client = cl->client;
xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) pc;
__GLXcontext *glxc;
int err;
- REQUEST_SIZE_MATCH(xGLXDestroyContextReq);
-
if (!validGlxContext(cl->client, req->context, DixDestroyAccess,
&glxc, &err))
return err;
glxc->idExists = GL_FALSE;
- if (!glxc->currentClient)
- FreeResourceByType(req->context, __glXContextRes, FALSE);
+ if (glxc->currentClient) {
+ XID ghost = FakeClientID(glxc->currentClient->index);
+
+ if (!AddResource(ghost, __glXContextRes, glxc))
+ return BadAlloc;
+ ChangeResourceValue(glxc->id, __glXContextRes, NULL);
+ glxc->id = ghost;
+ }
+
+ FreeResourceByType(req->context, __glXContextRes, FALSE);
return Success;
}
-/*
- * This will return "deleted" contexts, ie, where idExists is GL_FALSE.
- * Contrast validGlxContext, which will not. We're cheating here and
- * using the XID as the context tag, which is fine as long as we defer
- * actually destroying the context until it's no longer referenced, and
- * block clients from trying to MakeCurrent on contexts that are on the
- * way to destruction. Notice that DoMakeCurrent calls validGlxContext
- * for new contexts but __glXLookupContextByTag for previous contexts.
- */
__GLXcontext *
__glXLookupContextByTag(__GLXclientState * cl, GLXContextTag tag)
{
- __GLXcontext *ret;
-
- if (dixLookupResourceByType((void **) &ret, tag, __glXContextRes,
- cl->client, DixUseAccess) == Success)
- return ret;
-
- return NULL;
-}
-
-/*****************************************************************************/
-
-static void
-StopUsingContext(__GLXcontext * glxc)
-{
- if (glxc) {
- glxc->currentClient = NULL;
- if (!glxc->idExists) {
- FreeResourceByType(glxc->id, __glXContextRes, FALSE);
- }
- }
-}
-
-static void
-StartUsingContext(__GLXclientState * cl, __GLXcontext * glxc)
-{
- glxc->currentClient = cl->client;
+ return glxServer.getContextTagPrivate(cl->client, tag);
}
static __GLXconfig *
@@ -583,14 +551,12 @@ __glXGetDrawable(__GLXcontext * glxc, GLXDrawable drawId, ClientPtr client,
** Make an OpenGL context and drawable current.
*/
-static int
-DoMakeCurrent(__GLXclientState * cl,
- GLXDrawable drawId, GLXDrawable readId,
- GLXContextID contextId, GLXContextTag tag)
+int
+xorgGlxMakeCurrent(ClientPtr client, GLXContextTag tag, XID drawId, XID readId,
+ XID contextId, GLXContextTag newContextTag)
{
- ClientPtr client = cl->client;
- xGLXMakeCurrentReply reply;
- __GLXcontext *glxc, *prevglxc;
+ __GLXclientState *cl = glxGetClient(client);
+ __GLXcontext *glxc = NULL, *prevglxc = NULL;
__GLXdrawable *drawPriv = NULL;
__GLXdrawable *readPriv = NULL;
int error;
@@ -603,39 +569,28 @@ DoMakeCurrent(__GLXclientState * cl,
if ((drawId == None) != (readId == None))
return BadMatch;
- /*
- ** Lookup old context. If we have one, it must be in a usable state.
- */
+ /* Look up old context. If we have one, it must be in a usable state. */
if (tag != 0) {
- prevglxc = __glXLookupContextByTag(cl, tag);
- if (!prevglxc) {
- /*
- ** Tag for previous context is invalid.
- */
+ prevglxc = glxServer.getContextTagPrivate(client, tag);
+ if (!prevglxc)
return __glXError(GLXBadContextTag);
- }
+
if (prevglxc->renderMode != GL_RENDER) {
/* Oops. Not in render mode render. */
client->errorValue = prevglxc->id;
return __glXError(GLXBadContextState);
}
}
- else {
- prevglxc = 0;
- }
- /*
- ** Lookup new context. It must not be current for someone else.
- */
+ /* Look up new context. It must not be current for someone else. */
if (contextId != None) {
int status;
if (!validGlxContext(client, contextId, DixUseAccess, &glxc, &error))
return error;
- if ((glxc != prevglxc) && glxc->currentClient) {
- /* Context is current to somebody else */
+
+ if ((glxc != prevglxc) && glxc->currentClient)
return BadAccess;
- }
if (drawId) {
drawPriv = __glXGetDrawable(glxc, drawId, client, &status);
@@ -648,38 +603,25 @@ DoMakeCurrent(__GLXclientState * cl,
if (readPriv == NULL)
return status;
}
- } else {
- /* Switching to no context. Ignore new drawable. */
-
- glxc = 0;
- drawPriv = 0;
- readPriv = 0;
}
if (prevglxc) {
- /*
- ** Flush the previous context if needed.
- */
+ /* Flush the previous context if needed. */
Bool need_flush = !prevglxc->isDirect;
#ifdef GLX_CONTEXT_RELEASE_BEHAVIOR_ARB
if (prevglxc->releaseBehavior == GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB)
need_flush = GL_FALSE;
#endif
if (need_flush) {
- if (__glXForceCurrent(cl, tag, (int *) &error)) {
- glFlush();
- }
- else {
+ if (!__glXForceCurrent(cl, tag, (int *) &error))
return error;
- }
+ glFlush();
}
- /*
- ** Make the previous context not current.
- */
- if (!(*prevglxc->loseCurrent) (prevglxc)) {
+ /* Make the previous context not current. */
+ if (!(*prevglxc->loseCurrent) (prevglxc))
return __glXError(GLXBadContext);
- }
+
lastGLContext = NULL;
if (!prevglxc->isDirect) {
prevglxc->drawPriv = NULL;
@@ -687,8 +629,7 @@ DoMakeCurrent(__GLXclientState * cl,
}
}
- if ((glxc != 0) && !glxc->isDirect) {
-
+ if (glxc && !glxc->isDirect) {
glxc->drawPriv = drawPriv;
glxc->readPriv = readPriv;
@@ -702,66 +643,35 @@ DoMakeCurrent(__GLXclientState * cl,
}
glxc->currentClient = client;
+ glxServer.setContextTagPrivate(client, newContextTag, glxc);
}
- StopUsingContext(prevglxc);
-
- reply = (xGLXMakeCurrentReply) {
- .type = X_Reply,
- .sequenceNumber = client->sequence,
- .length = 0,
- .contextTag = 0
- };
-
- if (glxc) {
- StartUsingContext(cl, glxc);
- reply.contextTag = glxc->id;
+ if (prevglxc) {
+ prevglxc->currentClient = NULL;
+ if (!prevglxc->idExists) {
+ FreeResourceByType(prevglxc->id, __glXContextRes, FALSE);
+ }
}
- if (client->swapped) {
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_SHORT(&reply.sequenceNumber);
- __GLX_SWAP_INT(&reply.length);
- __GLX_SWAP_INT(&reply.contextTag);
- }
- WriteToClient(client, sz_xGLXMakeCurrentReply, &reply);
return Success;
}
int
__glXDisp_MakeCurrent(__GLXclientState * cl, GLbyte * pc)
{
- ClientPtr client = cl->client;
- xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) pc;
-
- REQUEST_SIZE_MATCH(xGLXMakeCurrentReq);
-
- return DoMakeCurrent(cl, req->drawable, req->drawable,
- req->context, req->oldContextTag);
+ return BadImplementation;
}
int
__glXDisp_MakeContextCurrent(__GLXclientState * cl, GLbyte * pc)
{
- ClientPtr client = cl->client;
- xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) pc;
-
- REQUEST_SIZE_MATCH(xGLXMakeContextCurrentReq);
-
- return DoMakeCurrent(cl, req->drawable, req->readdrawable,
- req->context, req->oldContextTag);
+ return BadImplementation;
}
int
__glXDisp_MakeCurrentReadSGI(__GLXclientState * cl, GLbyte * pc)
{
- ClientPtr client = cl->client;
- xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) pc;
-
- REQUEST_SIZE_MATCH(xGLXMakeCurrentReadSGIReq);
-
- return DoMakeCurrent(cl, req->drawable, req->readable,
- req->context, req->oldContextTag);
+ return BadImplementation;
}
int
@@ -773,8 +683,6 @@ __glXDisp_IsDirect(__GLXclientState * cl, GLbyte * pc)
__GLXcontext *glxc;
int err;
- REQUEST_SIZE_MATCH(xGLXIsDirectReq);
-
if (!validGlxContext(cl->client, req->context, DixReadAccess, &glxc, &err))
return err;
@@ -838,14 +746,11 @@ __glXDisp_QueryVersion(__GLXclientState * cl, GLbyte * pc)
int
__glXDisp_WaitGL(__GLXclientState * cl, GLbyte * pc)
{
- ClientPtr client = cl->client;
xGLXWaitGLReq *req = (xGLXWaitGLReq *) pc;
GLXContextTag tag;
__GLXcontext *glxc = NULL;
int error;
- REQUEST_SIZE_MATCH(xGLXWaitGLReq);
-
tag = req->contextTag;
if (tag) {
glxc = __glXLookupContextByTag(cl, tag);
@@ -867,14 +772,11 @@ __glXDisp_WaitGL(__GLXclientState * cl, GLbyte * pc)
int
__glXDisp_WaitX(__GLXclientState * cl, GLbyte * pc)
{
- ClientPtr client = cl->client;
xGLXWaitXReq *req = (xGLXWaitXReq *) pc;
GLXContextTag tag;
__GLXcontext *glxc = NULL;
int error;
- REQUEST_SIZE_MATCH(xGLXWaitXReq);
-
tag = req->contextTag;
if (tag) {
glxc = __glXLookupContextByTag(cl, tag);
@@ -903,8 +805,6 @@ __glXDisp_CopyContext(__GLXclientState * cl, GLbyte * pc)
__GLXcontext *src, *dst;
int error;
- REQUEST_SIZE_MATCH(xGLXCopyContextReq);
-
source = req->source;
dest = req->dest;
tag = req->contextTag;
@@ -992,8 +892,6 @@ __glXDisp_GetVisualConfigs(__GLXclientState * cl, GLbyte * pc)
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- REQUEST_SIZE_MATCH(xGLXGetVisualConfigsReq);
-
if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
return err;
@@ -1213,10 +1111,8 @@ DoGetFBConfigs(__GLXclientState * cl, unsigned screen)
int
__glXDisp_GetFBConfigs(__GLXclientState * cl, GLbyte * pc)
{
- ClientPtr client = cl->client;
xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc;
- REQUEST_SIZE_MATCH(xGLXGetFBConfigsReq);
return DoGetFBConfigs(cl, req->screen);
}
@@ -1287,8 +1183,6 @@ DoCreateGLXPixmap(ClientPtr client, __GLXscreen * pGlxScreen,
DrawablePtr pDraw;
int err;
- LEGAL_NEW_RESOURCE(glxDrawableId, client);
-
err = dixLookupDrawable(&pDraw, drawableId, client, 0, DixAddAccess);
if (err != Success) {
client->errorValue = drawableId;
@@ -1354,14 +1248,11 @@ determineTextureTarget(ClientPtr client, XID glxDrawableID,
int
__glXDisp_CreateGLXPixmap(__GLXclientState * cl, GLbyte * pc)
{
- ClientPtr client = cl->client;
xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc;
__GLXconfig *config;
__GLXscreen *pGlxScreen;
int err;
- REQUEST_SIZE_MATCH(xGLXCreateGLXPixmapReq);
-
if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
return err;
if (!validGlxVisual(cl->client, pGlxScreen, req->visual, &config, &err))
@@ -1442,11 +1333,8 @@ DoDestroyDrawable(__GLXclientState * cl, XID glxdrawable, int type)
int
__glXDisp_DestroyGLXPixmap(__GLXclientState * cl, GLbyte * pc)
{
- ClientPtr client = cl->client;
xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc;
- REQUEST_SIZE_MATCH(xGLXDestroyGLXPixmapReq);
-
return DoDestroyDrawable(cl, req->glxpixmap, GLX_DRAWABLE_PIXMAP);
}
@@ -1472,8 +1360,6 @@ DoCreatePbuffer(ClientPtr client, int screenNum, XID fbconfigId,
PixmapPtr pPixmap;
int err;
- LEGAL_NEW_RESOURCE(glxDrawableId, client);
-
if (!validGlxScreen(client, screenNum, &pGlxScreen, &err))
return err;
if (!validGlxFBConfig(client, pGlxScreen, fbconfigId, &config, &err))
@@ -1658,8 +1544,6 @@ __glXDisp_CreateWindow(__GLXclientState * cl, GLbyte * pc)
}
REQUEST_FIXED_SIZE(xGLXCreateWindowReq, req->numAttribs << 3);
- LEGAL_NEW_RESOURCE(req->glxwindow, client);
-
if (!validGlxScreen(client, req->screen, &pGlxScreen, &err))
return err;
if (!validGlxFBConfig(client, pGlxScreen, req->fbconfig, &config, &err))
@@ -1709,8 +1593,6 @@ __glXDisp_SwapBuffers(__GLXclientState * cl, GLbyte * pc)
__GLXdrawable *pGlxDraw;
int error;
- REQUEST_SIZE_MATCH(xGLXSwapBuffersReq);
-
tag = req->contextTag;
drawId = req->drawable;
if (tag) {
@@ -1813,11 +1695,8 @@ __glXDisp_QueryContextInfoEXT(__GLXclientState * cl, GLbyte * pc)
int
__glXDisp_QueryContext(__GLXclientState * cl, GLbyte * pc)
{
- ClientPtr client = cl->client;
xGLXQueryContextReq *req = (xGLXQueryContextReq *) pc;
- REQUEST_SIZE_MATCH(xGLXQueryContextReq);
-
return DoQueryContext(cl, req->context);
}
@@ -2453,8 +2332,6 @@ __glXDisp_QueryExtensionsString(__GLXclientState * cl, GLbyte * pc)
char *buf;
int err;
- REQUEST_SIZE_MATCH(xGLXQueryExtensionsStringReq);
-
if (!validGlxScreen(client, req->screen, &pGlxScreen, &err))
return err;
@@ -2508,8 +2385,6 @@ __glXDisp_QueryServerString(__GLXclientState * cl, GLbyte * pc)
__GLXscreen *pGlxScreen;
int err;
- REQUEST_SIZE_MATCH(xGLXQueryServerStringReq);
-
if (!validGlxScreen(client, req->screen, &pGlxScreen, &err))
return err;
diff --git a/glx/glxcmdsswap.c b/glx/glxcmdsswap.c
index 10d84062e..7d6674470 100644
--- a/glx/glxcmdsswap.c
+++ b/glx/glxcmdsswap.c
@@ -56,13 +56,10 @@
int
__glXDispSwap_CreateContext(__GLXclientState * cl, GLbyte * pc)
{
- ClientPtr client = cl->client;
xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc;
__GLX_DECLARE_SWAP_VARIABLES;
- REQUEST_SIZE_MATCH(xGLXCreateContextReq);
-
__GLX_SWAP_SHORT(&req->length);
__GLX_SWAP_INT(&req->context);
__GLX_SWAP_INT(&req->visual);
@@ -75,13 +72,10 @@ __glXDispSwap_CreateContext(__GLXclientState * cl, GLbyte * pc)
int
__glXDispSwap_CreateNewContext(__GLXclientState * cl, GLbyte * pc)
{
- ClientPtr client = cl->client;
xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc;
__GLX_DECLARE_SWAP_VARIABLES;
- REQUEST_SIZE_MATCH(xGLXCreateNewContextReq);
-
__GLX_SWAP_SHORT(&req->length);
__GLX_SWAP_INT(&req->context);
__GLX_SWAP_INT(&req->fbconfig);
@@ -115,13 +109,10 @@ __glXDispSwap_CreateContextWithConfigSGIX(__GLXclientState * cl, GLbyte * pc)
int
__glXDispSwap_DestroyContext(__GLXclientState * cl, GLbyte * pc)
{
- ClientPtr client = cl->client;
xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) pc;
__GLX_DECLARE_SWAP_VARIABLES;
- REQUEST_SIZE_MATCH(xGLXDestroyContextReq);
-
__GLX_SWAP_SHORT(&req->length);
__GLX_SWAP_INT(&req->context);
@@ -131,69 +122,28 @@ __glXDispSwap_DestroyContext(__GLXclientState * cl, GLbyte * pc)
int
__glXDispSwap_MakeCurrent(__GLXclientState * cl, GLbyte * pc)
{
- ClientPtr client = cl->client;
- xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) pc;
-
- __GLX_DECLARE_SWAP_VARIABLES;
-
- REQUEST_SIZE_MATCH(xGLXMakeCurrentReq);
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->drawable);
- __GLX_SWAP_INT(&req->context);
- __GLX_SWAP_INT(&req->oldContextTag);
-
- return __glXDisp_MakeCurrent(cl, pc);
+ return BadImplementation;
}
int
__glXDispSwap_MakeContextCurrent(__GLXclientState * cl, GLbyte * pc)
{
- ClientPtr client = cl->client;
- xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) pc;
-
- __GLX_DECLARE_SWAP_VARIABLES;
-
- REQUEST_SIZE_MATCH(xGLXMakeContextCurrentReq);
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->drawable);
- __GLX_SWAP_INT(&req->readdrawable);
- __GLX_SWAP_INT(&req->context);
- __GLX_SWAP_INT(&req->oldContextTag);
-
- return __glXDisp_MakeContextCurrent(cl, pc);
+ return BadImplementation;
}
int
__glXDispSwap_MakeCurrentReadSGI(__GLXclientState * cl, GLbyte * pc)
{
- ClientPtr client = cl->client;
- xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) pc;
-
- __GLX_DECLARE_SWAP_VARIABLES;
-
- REQUEST_SIZE_MATCH(xGLXMakeCurrentReadSGIReq);
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->drawable);
- __GLX_SWAP_INT(&req->readable);
- __GLX_SWAP_INT(&req->context);
- __GLX_SWAP_INT(&req->oldContextTag);
-
- return __glXDisp_MakeCurrentReadSGI(cl, pc);
+ return BadImplementation;
}
int
__glXDispSwap_IsDirect(__GLXclientState * cl, GLbyte * pc)
{
- ClientPtr client = cl->client;
xGLXIsDirectReq *req = (xGLXIsDirectReq *) pc;
__GLX_DECLARE_SWAP_VARIABLES;
- REQUEST_SIZE_MATCH(xGLXIsDirectReq);
-
__GLX_SWAP_SHORT(&req->length);
__GLX_SWAP_INT(&req->context);
@@ -203,13 +153,10 @@ __glXDispSwap_IsDirect(__GLXclientState * cl, GLbyte * pc)
int
__glXDispSwap_QueryVersion(__GLXclientState * cl, GLbyte * pc)
{
- ClientPtr client = cl->client;
xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) pc;
__GLX_DECLARE_SWAP_VARIABLES;
- REQUEST_SIZE_MATCH(xGLXQueryVersionReq);
-
__GLX_SWAP_SHORT(&req->length);
__GLX_SWAP_INT(&req->majorVersion);
__GLX_SWAP_INT(&req->minorVersion);
@@ -220,13 +167,10 @@ __glXDispSwap_QueryVersion(__GLXclientState * cl, GLbyte * pc)
int
__glXDispSwap_WaitGL(__GLXclientState * cl, GLbyte * pc)
{
- ClientPtr client = cl->client;
xGLXWaitGLReq *req = (xGLXWaitGLReq *) pc;
__GLX_DECLARE_SWAP_VARIABLES;
- REQUEST_SIZE_MATCH(xGLXWaitGLReq);
-
__GLX_SWAP_SHORT(&req->length);
__GLX_SWAP_INT(&req->contextTag);
@@ -236,13 +180,10 @@ __glXDispSwap_WaitGL(__GLXclientState * cl, GLbyte * pc)
int
__glXDispSwap_WaitX(__GLXclientState * cl, GLbyte * pc)
{
- ClientPtr client = cl->client;
xGLXWaitXReq *req = (xGLXWaitXReq *) pc;
__GLX_DECLARE_SWAP_VARIABLES;
- REQUEST_SIZE_MATCH(xGLXWaitXReq);
-
__GLX_SWAP_SHORT(&req->length);
__GLX_SWAP_INT(&req->contextTag);
@@ -252,13 +193,10 @@ __glXDispSwap_WaitX(__GLXclientState * cl, GLbyte * pc)
int
__glXDispSwap_CopyContext(__GLXclientState * cl, GLbyte * pc)
{
- ClientPtr client = cl->client;
xGLXCopyContextReq *req = (xGLXCopyContextReq *) pc;
__GLX_DECLARE_SWAP_VARIABLES;
- REQUEST_SIZE_MATCH(xGLXCopyContextReq);
-
__GLX_SWAP_SHORT(&req->length);
__GLX_SWAP_INT(&req->source);
__GLX_SWAP_INT(&req->dest);
@@ -270,13 +208,10 @@ __glXDispSwap_CopyContext(__GLXclientState * cl, GLbyte * pc)
int
__glXDispSwap_GetVisualConfigs(__GLXclientState * cl, GLbyte * pc)
{
- ClientPtr client = cl->client;
xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc;
__GLX_DECLARE_SWAP_VARIABLES;
- REQUEST_SIZE_MATCH(xGLXGetVisualConfigsReq);
-
__GLX_SWAP_INT(&req->screen);
return __glXDisp_GetVisualConfigs(cl, pc);
}
@@ -284,13 +219,10 @@ __glXDispSwap_GetVisualConfigs(__GLXclientState * cl, GLbyte * pc)
int
__glXDispSwap_GetFBConfigs(__GLXclientState * cl, GLbyte * pc)
{
- ClientPtr client = cl->client;
xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc;
__GLX_DECLARE_SWAP_VARIABLES;
- REQUEST_SIZE_MATCH(xGLXGetFBConfigsReq);
-
__GLX_SWAP_INT(&req->screen);
return __glXDisp_GetFBConfigs(cl, pc);
}
@@ -312,13 +244,10 @@ __glXDispSwap_GetFBConfigsSGIX(__GLXclientState * cl, GLbyte * pc)
int
__glXDispSwap_CreateGLXPixmap(__GLXclientState * cl, GLbyte * pc)
{
- ClientPtr client = cl->client;
xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc;
__GLX_DECLARE_SWAP_VARIABLES;
- REQUEST_SIZE_MATCH(xGLXCreateGLXPixmapReq);
-
__GLX_SWAP_SHORT(&req->length);
__GLX_SWAP_INT(&req->screen);
__GLX_SWAP_INT(&req->visual);
@@ -380,13 +309,10 @@ __glXDispSwap_CreateGLXPixmapWithConfigSGIX(__GLXclientState * cl, GLbyte * pc)
int
__glXDispSwap_DestroyGLXPixmap(__GLXclientState * cl, GLbyte * pc)
{
- ClientPtr client = cl->client;
xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc;
__GLX_DECLARE_SWAP_VARIABLES;
- REQUEST_SIZE_MATCH(xGLXDestroyGLXPixmapReq);
-
__GLX_SWAP_SHORT(&req->length);
__GLX_SWAP_INT(&req->glxpixmap);
@@ -412,13 +338,10 @@ __glXDispSwap_DestroyPixmap(__GLXclientState * cl, GLbyte * pc)
int
__glXDispSwap_QueryContext(__GLXclientState * cl, GLbyte * pc)
{
- ClientPtr client = cl->client;
xGLXQueryContextReq *req = (xGLXQueryContextReq *) pc;
__GLX_DECLARE_SWAP_VARIABLES;
- REQUEST_SIZE_MATCH(xGLXQueryContextReq);
-
__GLX_SWAP_INT(&req->context);
return __glXDisp_QueryContext(cl, pc);
@@ -474,13 +397,10 @@ __glXDispSwap_CreateGLXPbufferSGIX(__GLXclientState * cl, GLbyte * pc)
int
__glXDispSwap_DestroyPbuffer(__GLXclientState * cl, GLbyte * pc)
{
- ClientPtr client = cl->client;
xGLXDestroyPbufferReq *req = (xGLXDestroyPbufferReq *) pc;
__GLX_DECLARE_SWAP_VARIABLES;
- REQUEST_SIZE_MATCH(xGLXDestroyPbufferReq);
-
__GLX_SWAP_INT(&req->pbuffer);
return __glXDisp_DestroyPbuffer(cl, pc);
@@ -604,13 +524,10 @@ __glXDispSwap_DestroyWindow(__GLXclientState * cl, GLbyte * pc)
int
__glXDispSwap_SwapBuffers(__GLXclientState * cl, GLbyte * pc)
{
- ClientPtr client = cl->client;
xGLXSwapBuffersReq *req = (xGLXSwapBuffersReq *) pc;
__GLX_DECLARE_SWAP_VARIABLES;
- REQUEST_SIZE_MATCH(xGLXSwapBuffersReq);
-
__GLX_SWAP_SHORT(&req->length);
__GLX_SWAP_INT(&req->contextTag);
__GLX_SWAP_INT(&req->drawable);
@@ -621,13 +538,10 @@ __glXDispSwap_SwapBuffers(__GLXclientState * cl, GLbyte * pc)
int
__glXDispSwap_UseXFont(__GLXclientState * cl, GLbyte * pc)
{
- ClientPtr client = cl->client;
xGLXUseXFontReq *req = (xGLXUseXFontReq *) pc;
__GLX_DECLARE_SWAP_VARIABLES;
- REQUEST_SIZE_MATCH(xGLXUseXFontReq);
-
__GLX_SWAP_SHORT(&req->length);
__GLX_SWAP_INT(&req->contextTag);
__GLX_SWAP_INT(&req->font);
@@ -641,13 +555,10 @@ __glXDispSwap_UseXFont(__GLXclientState * cl, GLbyte * pc)
int
__glXDispSwap_QueryExtensionsString(__GLXclientState * cl, GLbyte * pc)
{
- ClientPtr client = cl->client;
xGLXQueryExtensionsStringReq *req = (xGLXQueryExtensionsStringReq *) pc;
__GLX_DECLARE_SWAP_VARIABLES;
- REQUEST_SIZE_MATCH(xGLXQueryExtensionsStringReq);
-
__GLX_SWAP_SHORT(&req->length);
__GLX_SWAP_INT(&req->screen);
@@ -657,13 +568,10 @@ __glXDispSwap_QueryExtensionsString(__GLXclientState * cl, GLbyte * pc)
int
__glXDispSwap_QueryServerString(__GLXclientState * cl, GLbyte * pc)
{
- ClientPtr client = cl->client;
xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *) pc;
__GLX_DECLARE_SWAP_VARIABLES;
- REQUEST_SIZE_MATCH(xGLXQueryServerStringReq);
-
__GLX_SWAP_SHORT(&req->length);
__GLX_SWAP_INT(&req->screen);
__GLX_SWAP_INT(&req->name);
diff --git a/glx/glxext.c b/glx/glxext.c
index d39fe6d8e..a345c437a 100644
--- a/glx/glxext.c
+++ b/glx/glxext.c
@@ -46,10 +46,12 @@
#include "glxext.h"
#include "indirect_table.h"
#include "indirect_util.h"
+#include "glxvndabi.h"
/*
** X resources.
*/
+static int glxGeneration;
RESTYPE __glXContextRes;
RESTYPE __glXDrawableRes;
@@ -64,15 +66,6 @@ static int __glXDispatch(ClientPtr);
static GLboolean __glXFreeContext(__GLXcontext * cx);
/*
-** Called when the extension is reset.
-*/
-static void
-ResetExtension(ExtensionEntry * extEntry)
-{
- lastGLContext = NULL;
-}
-
-/*
** Reset state used to keep track of large (multi-request) commands.
*/
void
@@ -86,16 +79,18 @@ __glXResetLargeCommandStatus(__GLXclientState * cl)
/*
* This procedure is called when the client who created the context goes away
- * OR when glXDestroyContext is called. In either case, all we do is flag that
- * the ID is no longer valid, and (maybe) free the context.
+ * OR when glXDestroyContext is called. If the context is current for a client
+ * the dispatch layer will have moved the context struct to a fake resource ID
+ * and cx here will be NULL. Otherwise we really free the context.
*/
static int
ContextGone(__GLXcontext * cx, XID id)
{
- cx->idExists = GL_FALSE;
- if (!cx->currentClient) {
+ if (!cx)
+ return TRUE;
+
+ if (!cx->currentClient)
__glXFreeContext(cx);
- }
return TRUE;
}
@@ -271,29 +266,14 @@ glxClientCallback(CallbackListPtr *list, void *closure, void *data)
NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
ClientPtr pClient = clientinfo->client;
__GLXclientState *cl = glxGetClient(pClient);
- __GLXcontext *c, *next;
switch (pClient->clientState) {
- case ClientStateRunning:
- cl->client = pClient;
- break;
-
case ClientStateGone:
- /* detach from all current contexts */
- for (c = glxAllContexts; c; c = next) {
- next = c->next;
- if (c->currentClient == pClient) {
- c->loseCurrent(c);
- lastGLContext = NULL;
- c->currentClient = NULL;
- FreeResourceByType(c->id, __glXContextRes, FALSE);
- }
- }
-
free(cl->returnBuf);
free(cl->largeCmdBuf);
free(cl->GLClientextensions);
- memset(cl, 0, sizeof(*cl));
+ cl->returnBuf = NULL;
+ cl->GLClientextensions = NULL;
break;
default:
@@ -303,7 +283,7 @@ glxClientCallback(CallbackListPtr *list, void *closure, void *data)
/************************************************************************/
-static __GLXprovider *__glXProviderStack;
+static __GLXprovider *__glXProviderStack = &__glXDRISWRastProvider;
void
GlxPushProvider(__GLXprovider * provider)
@@ -346,50 +326,236 @@ GetGLXDrawableBytes(void *value, XID id, ResourceSizePtr size)
}
}
-/*
-** Initialize the GLX extension.
-*/
-void
-GlxExtensionInit(void)
+static void
+xorgGlxCloseExtension(const ExtensionEntry *extEntry)
{
- ExtensionEntry *extEntry;
- ScreenPtr pScreen;
- int i;
- __GLXprovider *p, **stack;
- Bool glx_provided = FALSE;
+ lastGLContext = NULL;
+}
+
+static int
+xorgGlxHandleRequest(ClientPtr client)
+{
+ return __glXDispatch(client);
+}
+
+static ScreenPtr
+screenNumToScreen(int screen)
+{
+ if (screen < 0 || screen >= screenInfo.numScreens)
+ return NULL;
+
+ return screenInfo.screens[screen];
+}
+
+static int
+maybe_swap32(ClientPtr client, int x)
+{
+ return client->swapped ? bswap_32(x) : x;
+}
+
+static GlxServerVendor *
+vendorForScreen(ClientPtr client, int screen)
+{
+ screen = maybe_swap32(client, screen);
+
+ return glxServer.getVendorForScreen(client, screenNumToScreen(screen));
+}
+
+/* this ought to be generated */
+static int
+xorgGlxThunkRequest(ClientPtr client)
+{
+ REQUEST(xGLXVendorPrivateReq);
+ CARD32 vendorCode = maybe_swap32(client, stuff->vendorCode);
+ GlxServerVendor *vendor = NULL;
+ XID resource = 0;
+ int ret;
+
+ switch (vendorCode) {
+ case X_GLXvop_QueryContextInfoEXT: {
+ xGLXQueryContextInfoEXTReq *req = (void *)stuff;
+ REQUEST_AT_LEAST_SIZE(*req);
+ if (!(vendor = glxServer.getXIDMap(maybe_swap32(client, req->context))))
+ return __glXError(GLXBadContext);
+ break;
+ }
+
+ case X_GLXvop_GetFBConfigsSGIX: {
+ xGLXGetFBConfigsSGIXReq *req = (void *)stuff;
+ REQUEST_AT_LEAST_SIZE(*req);
+ if (!(vendor = vendorForScreen(client, req->screen)))
+ return BadValue;
+ break;
+ }
+
+ case X_GLXvop_CreateContextWithConfigSGIX: {
+ xGLXCreateContextWithConfigSGIXReq *req = (void *)stuff;
+ REQUEST_AT_LEAST_SIZE(*req);
+ resource = maybe_swap32(client, req->context);
+ if (!(vendor = vendorForScreen(client, req->screen)))
+ return BadValue;
+ break;
+ }
+
+ case X_GLXvop_CreateGLXPixmapWithConfigSGIX: {
+ xGLXCreateGLXPixmapWithConfigSGIXReq *req = (void *)stuff;
+ REQUEST_AT_LEAST_SIZE(*req);
+ resource = maybe_swap32(client, req->glxpixmap);
+ if (!(vendor = vendorForScreen(client, req->screen)))
+ return BadValue;
+ break;
+ }
+
+ case X_GLXvop_CreateGLXPbufferSGIX: {
+ xGLXCreateGLXPbufferSGIXReq *req = (void *)stuff;
+ REQUEST_AT_LEAST_SIZE(*req);
+ resource = maybe_swap32(client, req->pbuffer);
+ if (!(vendor = vendorForScreen(client, req->screen)))
+ return BadValue;
+ break;
+ }
+
+ /* same offset for the drawable for these three */
+ case X_GLXvop_DestroyGLXPbufferSGIX:
+ case X_GLXvop_ChangeDrawableAttributesSGIX:
+ case X_GLXvop_GetDrawableAttributesSGIX: {
+ xGLXGetDrawableAttributesSGIXReq *req = (void *)stuff;
+ REQUEST_AT_LEAST_SIZE(*req);
+ if (!(vendor = glxServer.getXIDMap(maybe_swap32(client,
+ req->drawable))))
+ return __glXError(GLXBadDrawable);
+ break;
+ }
- if (serverGeneration == 1) {
- for (stack = &__glXProviderStack; *stack; stack = &(*stack)->next)
- ;
- *stack = &__glXDRISWRastProvider;
+ /* most things just use the standard context tag */
+ default: {
+ /* size checked by vnd layer already */
+ GLXContextTag tag = maybe_swap32(client, stuff->contextTag);
+ vendor = glxServer.getContextTag(client, tag);
+ if (!vendor)
+ return __glXError(GLXBadContextTag);
+ break;
+ }
}
- /* Mesa requires at least one True/DirectColor visual */
- if (!checkScreenVisuals())
- return;
+ /* If we're creating a resource, add the map now */
+ if (resource) {
+ LEGAL_NEW_RESOURCE(resource, client);
+ if (!glxServer.addXIDMap(resource, vendor))
+ return BadAlloc;
+ }
- __glXContextRes = CreateNewResourceType((DeleteType) ContextGone,
- "GLXContext");
- __glXDrawableRes = CreateNewResourceType((DeleteType) DrawableGone,
- "GLXDrawable");
- if (!__glXContextRes || !__glXDrawableRes)
- return;
+ ret = glxServer.forwardRequest(vendor, client);
+
+ if (ret == Success && vendorCode == X_GLXvop_DestroyGLXPbufferSGIX) {
+ xGLXDestroyGLXPbufferSGIXReq *req = (void *)stuff;
+ glxServer.removeXIDMap(maybe_swap32(client, req->pbuffer));
+ }
+
+ if (ret != Success)
+ glxServer.removeXIDMap(resource);
+
+ return ret;
+}
+
+static GlxServerDispatchProc
+xorgGlxGetDispatchAddress(CARD8 minorOpcode, CARD32 vendorCode)
+{
+ /* we don't support any other GLX opcodes */
+ if (minorOpcode != X_GLXVendorPrivate &&
+ minorOpcode != X_GLXVendorPrivateWithReply)
+ return NULL;
+
+ /* we only support some vendor private requests */
+ if (!__glXGetProtocolDecodeFunction(&VendorPriv_dispatch_info, vendorCode,
+ FALSE))
+ return NULL;
+
+ return xorgGlxThunkRequest;
+}
+
+static Bool
+xorgGlxServerPreInit(const ExtensionEntry *extEntry)
+{
+ if (glxGeneration != serverGeneration) {
+ /* Mesa requires at least one True/DirectColor visual */
+ if (!checkScreenVisuals())
+ return FALSE;
+
+ __glXContextRes = CreateNewResourceType((DeleteType) ContextGone,
+ "GLXContext");
+ __glXDrawableRes = CreateNewResourceType((DeleteType) DrawableGone,
+ "GLXDrawable");
+ if (!__glXContextRes || !__glXDrawableRes)
+ return FALSE;
+
+ if (!dixRegisterPrivateKey
+ (&glxClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(__GLXclientState)))
+ return FALSE;
+ if (!AddCallback(&ClientStateCallback, glxClientCallback, 0))
+ return FALSE;
+
+ __glXErrorBase = extEntry->errorBase;
+ __glXEventBase = extEntry->eventBase;
+
+ SetResourceTypeSizeFunc(__glXDrawableRes, GetGLXDrawableBytes);
+#if PRESENT
+ __glXregisterPresentCompleteNotify();
+#endif
+
+ glxGeneration = serverGeneration;
+ }
+
+ return glxGeneration == serverGeneration;
+}
+
+static GlxServerVendor *glvnd_vendor = NULL;
+
+static GlxServerVendor *
+xorgGlxInitGLVNDVendor(void)
+{
+ if (glvnd_vendor == NULL) {
+ GlxServerImports *imports = NULL;
+ imports = glxServer.allocateServerImports();
+
+ if (imports != NULL) {
+ imports->extensionCloseDown = xorgGlxCloseExtension;
+ imports->handleRequest = xorgGlxHandleRequest;
+ imports->getDispatchAddress = xorgGlxGetDispatchAddress;
+ imports->makeCurrent = xorgGlxMakeCurrent;
+ glvnd_vendor = glxServer.createVendor(imports);
+ glxServer.freeServerImports(imports);
+ }
+ }
+ return glvnd_vendor;
+}
- SetResourceTypeSizeFunc(__glXDrawableRes, GetGLXDrawableBytes);
+static void
+xorgGlxServerInit(CallbackListPtr *pcbl, void *param, void *ext)
+{
+ const ExtensionEntry *extEntry = ext;
+ int i;
- if (!dixRegisterPrivateKey
- (&glxClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(__GLXclientState)))
+ if (!xorgGlxServerPreInit(extEntry)) {
return;
- if (!AddCallback(&ClientStateCallback, glxClientCallback, 0))
+ }
+
+ if (!xorgGlxInitGLVNDVendor()) {
return;
+ }
for (i = 0; i < screenInfo.numScreens; i++) {
- pScreen = screenInfo.screens[i];
+ ScreenPtr pScreen = screenInfo.screens[i];
+ __GLXprovider *p;
- for (p = __glXProviderStack; p != NULL; p = p->next) {
- __GLXscreen *glxScreen;
+ if (glxServer.getVendorForScreen(NULL, pScreen) != NULL) {
+ // There's already a vendor registered.
+ LogMessage(X_INFO, "GLX: Another vendor is already registered for screen %d\n", i);
+ continue;
+ }
- glxScreen = p->screenProbe(pScreen);
+ for (p = __glXProviderStack; p != NULL; p = p->next) {
+ __GLXscreen *glxScreen = p->screenProbe(pScreen);
if (glxScreen != NULL) {
LogMessage(X_INFO,
"GLX: Initialized %s GL provider for screen %d\n",
@@ -399,33 +565,19 @@ GlxExtensionInit(void)
}
- if (!p)
+ if (p) {
+ glxServer.setScreenVendor(pScreen, glvnd_vendor);
+ } else {
LogMessage(X_INFO,
"GLX: no usable GL providers found for screen %d\n", i);
- else
- glx_provided = TRUE;
- }
-
- /* don't register extension if GL is not provided on any screen */
- if (!glx_provided)
- return;
-
- /*
- ** Add extension to server extensions.
- */
- extEntry = AddExtension(GLX_EXTENSION_NAME, __GLX_NUMBER_EVENTS,
- __GLX_NUMBER_ERRORS, __glXDispatch,
- __glXDispatch, ResetExtension, StandardMinorOpcode);
- if (!extEntry) {
- FatalError("__glXExtensionInit: AddExtensions failed\n");
- return;
+ }
}
+}
- __glXErrorBase = extEntry->errorBase;
- __glXEventBase = extEntry->eventBase;
-#if PRESENT
- __glXregisterPresentCompleteNotify();
-#endif
+Bool
+xorgGlxCreateVendor(void)
+{
+ return AddCallback(glxServer.extensionInitCallback, xorgGlxServerInit, NULL);
}
/************************************************************************/
@@ -500,7 +652,7 @@ glxSuspendClients(void)
int i;
for (i = 1; i < currentMaxClients; i++) {
- if (clients[i] && glxGetClient(clients[i])->inUse)
+ if (glxGetClient(clients[i])->client)
IgnoreClient(clients[i]);
}
@@ -516,7 +668,7 @@ glxResumeClients(void)
glxBlockClients = FALSE;
for (i = 1; i < currentMaxClients; i++) {
- if (clients[i] && glxGetClient(clients[i])->inUse)
+ if (glxGetClient(clients[i])->client)
AttendClient(clients[i]);
}
@@ -553,12 +705,10 @@ __glXDispatch(ClientPtr client)
CARD8 opcode;
__GLXdispatchSingleProcPtr proc;
__GLXclientState *cl;
- int retval;
+ int retval = BadRequest;
opcode = stuff->glxCode;
cl = glxGetClient(client);
- /* Mark it in use so we suspend it on VT switch. */
- cl->inUse = TRUE;
/*
** If we're expecting a glXRenderLarge request, this better be one.
@@ -568,6 +718,9 @@ __glXDispatch(ClientPtr client)
return __glXError(GLXBadLargeRequest);
}
+ if (!cl->client)
+ cl->client = client;
+
/* If we're currently blocking GLX clients, just put this guy to
* sleep, reset the request and return. */
if (glxBlockClients) {
@@ -582,12 +735,8 @@ __glXDispatch(ClientPtr client)
*/
proc = __glXGetProtocolDecodeFunction(&Single_dispatch_info, opcode,
client->swapped);
- if (proc != NULL) {
+ if (proc != NULL)
retval = (*proc) (cl, (GLbyte *) stuff);
- }
- else {
- retval = BadRequest;
- }
return retval;
}
diff --git a/glx/glxext.h b/glx/glxext.h
index cde0e1519..af59165bf 100644
--- a/glx/glxext.h
+++ b/glx/glxext.h
@@ -62,4 +62,8 @@ extern void __glXResetLargeCommandStatus(__GLXclientState *);
extern const char GLServerVersion[];
extern int DoGetString(__GLXclientState * cl, GLbyte * pc, GLboolean need_swap);
+extern int
+xorgGlxMakeCurrent(ClientPtr client, GLXContextTag tag, XID drawId, XID readId,
+ XID contextId, GLXContextTag newContextTag);
+
#endif /* _glxext_h_ */
diff --git a/glx/glxscreens.h b/glx/glxscreens.h
index c6a0c5021..40649f88d 100644
--- a/glx/glxscreens.h
+++ b/glx/glxscreens.h
@@ -36,6 +36,7 @@
*/
#include "extension_string.h"
+#include "glxvndabi.h"
typedef struct __GLXconfig __GLXconfig;
struct __GLXconfig {
diff --git a/glx/glxserver.h b/glx/glxserver.h
index 8a3e6f98b..8ffde2342 100644
--- a/glx/glxserver.h
+++ b/glx/glxserver.h
@@ -110,11 +110,6 @@ __glXregisterPresentCompleteNotify(void);
*/
struct __GLXclientStateRec {
/*
- ** Whether this structure is currently being used to support a client.
- */
- Bool inUse;
-
- /*
** Buffer for returned data.
*/
GLbyte *returnBuf;
diff --git a/glx/xfont.c b/glx/xfont.c
index 83a455d73..bd2fdae52 100644
--- a/glx/xfont.c
+++ b/glx/xfont.c
@@ -152,8 +152,6 @@ __glXDisp_UseXFont(__GLXclientState * cl, GLbyte * pc)
__GLXcontext *cx;
int error;
- REQUEST_SIZE_MATCH(xGLXUseXFontReq);
-
req = (xGLXUseXFontReq *) pc;
cx = __glXForceCurrent(cl, req->contextTag, &error);
if (!cx) {