2006-07-22 19:36:47 +02:00
|
|
|
/*
|
2008-09-22 17:26:49 +02:00
|
|
|
* SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
|
|
|
|
* Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice including the dates of first publication and
|
|
|
|
* either this permission notice or a reference to
|
|
|
|
* http://oss.sgi.com/projects/FreeB/
|
|
|
|
* shall be included in all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
|
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
|
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
|
|
|
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
* SOFTWARE.
|
|
|
|
*
|
|
|
|
* Except as contained in this notice, the name of Silicon Graphics, Inc.
|
|
|
|
* shall not be used in advertising or otherwise to promote the sale, use or
|
|
|
|
* other dealings in this Software without prior written authorization from
|
|
|
|
* Silicon Graphics, Inc.
|
|
|
|
*/
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2005-07-03 09:02:09 +02:00
|
|
|
#ifdef HAVE_DIX_CONFIG_H
|
|
|
|
#include <dix-config.h>
|
|
|
|
#endif
|
|
|
|
|
2006-03-12 01:11:34 +01:00
|
|
|
#include <string.h>
|
2003-11-14 17:48:57 +01:00
|
|
|
#include "glxserver.h"
|
|
|
|
#include <windowstr.h>
|
|
|
|
#include <propertyst.h>
|
2009-05-20 04:45:26 +02:00
|
|
|
#include <registry.h>
|
2007-10-17 22:09:40 +02:00
|
|
|
#include "privates.h"
|
2003-11-14 17:48:57 +01:00
|
|
|
#include <os.h>
|
2012-07-10 03:02:56 +02:00
|
|
|
#include "extinit.h"
|
2012-07-26 01:54:08 +02:00
|
|
|
#include "glx_extinit.h"
|
2003-11-14 17:48:57 +01:00
|
|
|
#include "unpack.h"
|
|
|
|
#include "glxutil.h"
|
|
|
|
#include "glxext.h"
|
2006-08-23 22:30:13 +02:00
|
|
|
#include "indirect_table.h"
|
|
|
|
#include "indirect_util.h"
|
2018-01-10 19:05:45 +01:00
|
|
|
#include "glxvndabi.h"
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2006-06-29 06:05:01 +02:00
|
|
|
/*
|
|
|
|
** X resources.
|
|
|
|
*/
|
2018-01-10 19:05:45 +01:00
|
|
|
static int glxGeneration;
|
2006-06-29 06:05:01 +02:00
|
|
|
RESTYPE __glXContextRes;
|
|
|
|
RESTYPE __glXDrawableRes;
|
|
|
|
|
2010-04-27 02:22:21 +02:00
|
|
|
static DevPrivateKeyRec glxClientPrivateKeyRec;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2010-04-27 02:22:21 +02:00
|
|
|
#define glxClientPrivateKey (&glxClientPrivateKeyRec)
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
** Forward declarations.
|
|
|
|
*/
|
|
|
|
static int __glXDispatch(ClientPtr);
|
2014-04-18 13:17:06 +02:00
|
|
|
static GLboolean __glXFreeContext(__GLXcontext * cx);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
/*
|
glx: Fix memory leak in context garbage collection (v2)
I broke this, back in:
commit a48dadc98a28c969741979b70b7a639f24f4cbbd
Author: Adam Jackson <ajax@redhat.com>
Date: Mon Mar 21 11:59:29 2011 -0400
glx: Reimplement context tags
In that, I changed the glx client state to not explicitly track the list
of current contexts for the client (since that was what we were deriving
tags from). The bug was that I removed the code for same from
glxClientCallback without noticing that it had the side effect of
effectively de-currenting those contexts, so that ContextGone could free
them. So, if you had a client exit with a context still current, the
context's memory would leak. Not a huge deal for direct clients, but
viciously bad for indirect, since the swrast context state at the bottom
of Mesa is like 15M.
Fix this by promoting Bool isCurrent to ClientPtr currentClient, so that
we have a back-pointer to chase when walking the list of contexts when
ClientStateGone happens.
v2: Explicitly call __glXFreeContext on the ClientStateGone path. Our
current context might be one we got from EXT_import_context and whose
creating client has since died. Without the explicit call, the creating
client's FreeClientResources would not free the context because it's
still current, and the using client's FreeClientResources would not free
the context because it's not an XID it created. This matches the logic
from a48dadc.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2013-08-03 15:47:55 +02:00
|
|
|
* This procedure is called when the client who created the context goes away
|
2018-01-10 19:05:45 +01:00
|
|
|
* 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.
|
glx: Fix memory leak in context garbage collection (v2)
I broke this, back in:
commit a48dadc98a28c969741979b70b7a639f24f4cbbd
Author: Adam Jackson <ajax@redhat.com>
Date: Mon Mar 21 11:59:29 2011 -0400
glx: Reimplement context tags
In that, I changed the glx client state to not explicitly track the list
of current contexts for the client (since that was what we were deriving
tags from). The bug was that I removed the code for same from
glxClientCallback without noticing that it had the side effect of
effectively de-currenting those contexts, so that ContextGone could free
them. So, if you had a client exit with a context still current, the
context's memory would leak. Not a huge deal for direct clients, but
viciously bad for indirect, since the swrast context state at the bottom
of Mesa is like 15M.
Fix this by promoting Bool isCurrent to ClientPtr currentClient, so that
we have a back-pointer to chase when walking the list of contexts when
ClientStateGone happens.
v2: Explicitly call __glXFreeContext on the ClientStateGone path. Our
current context might be one we got from EXT_import_context and whose
creating client has since died. Without the explicit call, the creating
client's FreeClientResources would not free the context because it's
still current, and the using client's FreeClientResources would not free
the context because it's not an XID it created. This matches the logic
from a48dadc.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2013-08-03 15:47:55 +02:00
|
|
|
*/
|
2012-03-21 20:55:09 +01:00
|
|
|
static int
|
|
|
|
ContextGone(__GLXcontext * cx, XID id)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2018-01-10 19:05:45 +01:00
|
|
|
if (!cx)
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
if (!cx->currentClient)
|
2012-03-21 20:55:09 +01:00
|
|
|
__glXFreeContext(cx);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2017-08-16 20:49:16 +02:00
|
|
|
return TRUE;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
2009-04-09 19:16:37 +02:00
|
|
|
static __GLXcontext *glxPendingDestroyContexts;
|
|
|
|
static __GLXcontext *glxAllContexts;
|
|
|
|
static int glxBlockClients;
|
|
|
|
|
2006-03-12 01:11:34 +01:00
|
|
|
/*
|
|
|
|
** Destroy routine that gets called when a drawable is freed. A drawable
|
|
|
|
** contains the ancillary buffers needed for rendering.
|
|
|
|
*/
|
2012-03-21 20:55:09 +01:00
|
|
|
static Bool
|
|
|
|
DrawableGone(__GLXdrawable * glxPriv, XID xid)
|
2006-03-12 01:11:34 +01:00
|
|
|
{
|
2010-09-23 15:04:11 +02:00
|
|
|
__GLXcontext *c, *next;
|
2008-07-21 21:28:50 +02:00
|
|
|
|
2011-03-28 18:30:09 +02:00
|
|
|
if (glxPriv->type == GLX_DRAWABLE_WINDOW) {
|
|
|
|
/* If this was created by glXCreateWindow, free the matching resource */
|
|
|
|
if (glxPriv->drawId != glxPriv->pDraw->id) {
|
|
|
|
if (xid == glxPriv->drawId)
|
|
|
|
FreeResourceByType(glxPriv->pDraw->id, __glXDrawableRes, TRUE);
|
|
|
|
else
|
|
|
|
FreeResourceByType(glxPriv->drawId, __glXDrawableRes, TRUE);
|
|
|
|
}
|
|
|
|
/* otherwise this window was implicitly created by MakeCurrent */
|
2010-04-16 11:55:32 +02:00
|
|
|
}
|
|
|
|
|
2010-09-23 15:04:11 +02:00
|
|
|
for (c = glxAllContexts; c; c = next) {
|
2012-03-21 20:55:09 +01:00
|
|
|
next = c->next;
|
glx: Fix memory leak in context garbage collection (v2)
I broke this, back in:
commit a48dadc98a28c969741979b70b7a639f24f4cbbd
Author: Adam Jackson <ajax@redhat.com>
Date: Mon Mar 21 11:59:29 2011 -0400
glx: Reimplement context tags
In that, I changed the glx client state to not explicitly track the list
of current contexts for the client (since that was what we were deriving
tags from). The bug was that I removed the code for same from
glxClientCallback without noticing that it had the side effect of
effectively de-currenting those contexts, so that ContextGone could free
them. So, if you had a client exit with a context still current, the
context's memory would leak. Not a huge deal for direct clients, but
viciously bad for indirect, since the swrast context state at the bottom
of Mesa is like 15M.
Fix this by promoting Bool isCurrent to ClientPtr currentClient, so that
we have a back-pointer to chase when walking the list of contexts when
ClientStateGone happens.
v2: Explicitly call __glXFreeContext on the ClientStateGone path. Our
current context might be one we got from EXT_import_context and whose
creating client has since died. Without the explicit call, the creating
client's FreeClientResources would not free the context because it's
still current, and the using client's FreeClientResources would not free
the context because it's not an XID it created. This matches the logic
from a48dadc.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2013-08-03 15:47:55 +02:00
|
|
|
if (c->currentClient &&
|
|
|
|
(c->drawPriv == glxPriv || c->readPriv == glxPriv)) {
|
2014-04-18 13:17:05 +02:00
|
|
|
/* flush the context */
|
|
|
|
glFlush();
|
2013-08-05 21:46:11 +02:00
|
|
|
/* just force a re-bind the next time through */
|
2012-03-21 20:55:09 +01:00
|
|
|
(*c->loseCurrent) (c);
|
2014-04-18 03:28:54 +02:00
|
|
|
lastGLContext = NULL;
|
2012-03-21 20:55:09 +01:00
|
|
|
}
|
|
|
|
if (c->drawPriv == glxPriv)
|
|
|
|
c->drawPriv = NULL;
|
|
|
|
if (c->readPriv == glxPriv)
|
|
|
|
c->readPriv = NULL;
|
2008-07-21 22:05:53 +02:00
|
|
|
}
|
2008-07-21 21:28:50 +02:00
|
|
|
|
2011-03-28 18:30:09 +02:00
|
|
|
/* drop our reference to any backing pixmap */
|
|
|
|
if (glxPriv->type == GLX_DRAWABLE_PIXMAP)
|
2012-03-21 20:55:09 +01:00
|
|
|
glxPriv->pDraw->pScreen->DestroyPixmap((PixmapPtr) glxPriv->pDraw);
|
2011-03-28 18:30:09 +02:00
|
|
|
|
2009-04-09 19:16:37 +02:00
|
|
|
glxPriv->destroy(glxPriv);
|
2006-03-12 01:11:34 +01:00
|
|
|
|
2017-08-16 20:49:16 +02:00
|
|
|
return TRUE;
|
2006-03-12 01:11:34 +01:00
|
|
|
}
|
|
|
|
|
2011-12-11 00:15:18 +01:00
|
|
|
Bool
|
|
|
|
__glXAddContext(__GLXcontext * cx)
|
2009-04-09 19:16:37 +02:00
|
|
|
{
|
2011-12-11 00:15:18 +01:00
|
|
|
/* Register this context as a resource.
|
|
|
|
*/
|
2013-12-15 10:05:51 +01:00
|
|
|
if (!AddResource(cx->id, __glXContextRes, (void *)cx)) {
|
2017-08-16 20:49:16 +02:00
|
|
|
return FALSE;
|
2011-12-11 00:15:18 +01:00
|
|
|
}
|
|
|
|
|
2009-04-09 19:16:37 +02:00
|
|
|
cx->next = glxAllContexts;
|
|
|
|
glxAllContexts = cx;
|
2017-08-16 20:49:16 +02:00
|
|
|
return TRUE;
|
2009-04-09 19:16:37 +02:00
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
static void
|
|
|
|
__glXRemoveFromContextList(__GLXcontext * cx)
|
2009-04-09 19:16:37 +02:00
|
|
|
{
|
2009-06-10 07:13:45 +02:00
|
|
|
__GLXcontext *c, *prev;
|
|
|
|
|
|
|
|
if (cx == glxAllContexts)
|
2012-03-21 20:55:09 +01:00
|
|
|
glxAllContexts = cx->next;
|
2009-06-10 07:13:45 +02:00
|
|
|
else {
|
2012-03-21 20:55:09 +01:00
|
|
|
prev = glxAllContexts;
|
|
|
|
for (c = glxAllContexts; c; c = c->next) {
|
|
|
|
if (c == cx)
|
|
|
|
prev->next = c->next;
|
|
|
|
prev = c;
|
|
|
|
}
|
2009-06-10 07:13:45 +02:00
|
|
|
}
|
2009-04-09 19:16:37 +02:00
|
|
|
}
|
2006-09-07 21:35:16 +02:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
/*
|
|
|
|
** Free a context.
|
|
|
|
*/
|
2014-04-18 13:17:06 +02:00
|
|
|
static GLboolean
|
2012-03-21 20:55:09 +01:00
|
|
|
__glXFreeContext(__GLXcontext * cx)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
glx: Fix memory leak in context garbage collection (v2)
I broke this, back in:
commit a48dadc98a28c969741979b70b7a639f24f4cbbd
Author: Adam Jackson <ajax@redhat.com>
Date: Mon Mar 21 11:59:29 2011 -0400
glx: Reimplement context tags
In that, I changed the glx client state to not explicitly track the list
of current contexts for the client (since that was what we were deriving
tags from). The bug was that I removed the code for same from
glxClientCallback without noticing that it had the side effect of
effectively de-currenting those contexts, so that ContextGone could free
them. So, if you had a client exit with a context still current, the
context's memory would leak. Not a huge deal for direct clients, but
viciously bad for indirect, since the swrast context state at the bottom
of Mesa is like 15M.
Fix this by promoting Bool isCurrent to ClientPtr currentClient, so that
we have a back-pointer to chase when walking the list of contexts when
ClientStateGone happens.
v2: Explicitly call __glXFreeContext on the ClientStateGone path. Our
current context might be one we got from EXT_import_context and whose
creating client has since died. Without the explicit call, the creating
client's FreeClientResources would not free the context because it's
still current, and the using client's FreeClientResources would not free
the context because it's not an XID it created. This matches the logic
from a48dadc.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2013-08-03 15:47:55 +02:00
|
|
|
if (cx->idExists || cx->currentClient)
|
2012-03-21 20:55:09 +01:00
|
|
|
return GL_FALSE;
|
|
|
|
|
glx: Fix memory leak in context garbage collection (v2)
I broke this, back in:
commit a48dadc98a28c969741979b70b7a639f24f4cbbd
Author: Adam Jackson <ajax@redhat.com>
Date: Mon Mar 21 11:59:29 2011 -0400
glx: Reimplement context tags
In that, I changed the glx client state to not explicitly track the list
of current contexts for the client (since that was what we were deriving
tags from). The bug was that I removed the code for same from
glxClientCallback without noticing that it had the side effect of
effectively de-currenting those contexts, so that ContextGone could free
them. So, if you had a client exit with a context still current, the
context's memory would leak. Not a huge deal for direct clients, but
viciously bad for indirect, since the swrast context state at the bottom
of Mesa is like 15M.
Fix this by promoting Bool isCurrent to ClientPtr currentClient, so that
we have a back-pointer to chase when walking the list of contexts when
ClientStateGone happens.
v2: Explicitly call __glXFreeContext on the ClientStateGone path. Our
current context might be one we got from EXT_import_context and whose
creating client has since died. Without the explicit call, the creating
client's FreeClientResources would not free the context because it's
still current, and the using client's FreeClientResources would not free
the context because it's not an XID it created. This matches the logic
from a48dadc.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2013-08-03 15:47:55 +02:00
|
|
|
__glXRemoveFromContextList(cx);
|
|
|
|
|
2010-06-06 10:28:30 +02:00
|
|
|
free(cx->feedbackBuf);
|
|
|
|
free(cx->selectBuf);
|
2018-01-10 19:05:48 +01:00
|
|
|
free(cx->largeCmdBuf);
|
2014-04-18 03:18:49 +02:00
|
|
|
if (cx == lastGLContext) {
|
|
|
|
lastGLContext = NULL;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
2006-03-12 01:11:34 +01:00
|
|
|
/* We can get here through both regular dispatching from
|
|
|
|
* __glXDispatch() or as a callback from the resource manager. In
|
|
|
|
* the latter case we need to lift the DRI lock manually. */
|
|
|
|
|
2006-11-16 01:18:03 +01:00
|
|
|
if (!glxBlockClients) {
|
2012-03-21 20:55:09 +01:00
|
|
|
cx->destroy(cx);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
cx->next = glxPendingDestroyContexts;
|
|
|
|
glxPendingDestroyContexts = cx;
|
2006-09-07 21:35:16 +02:00
|
|
|
}
|
2006-03-12 01:11:34 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
return GL_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************/
|
|
|
|
|
|
|
|
/*
|
|
|
|
** These routines can be used to check whether a particular GL command
|
|
|
|
** has caused an error. Specifically, we use them to check whether a
|
|
|
|
** given query has caused an error, in which case a zero-length data
|
|
|
|
** reply is sent to the client.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static GLboolean errorOccured = GL_FALSE;
|
|
|
|
|
|
|
|
/*
|
|
|
|
** The GL was will call this routine if an error occurs.
|
|
|
|
*/
|
2012-03-21 20:55:09 +01:00
|
|
|
void
|
|
|
|
__glXErrorCallBack(GLenum code)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
errorOccured = GL_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
** Clear the error flag before calling the GL command.
|
|
|
|
*/
|
2012-03-21 20:55:09 +01:00
|
|
|
void
|
|
|
|
__glXClearErrorOccured(void)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
errorOccured = GL_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
** Check if the GL command caused an error.
|
|
|
|
*/
|
2012-03-21 20:55:09 +01:00
|
|
|
GLboolean
|
|
|
|
__glXErrorOccured(void)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
return errorOccured;
|
|
|
|
}
|
|
|
|
|
2006-06-29 06:05:01 +02:00
|
|
|
static int __glXErrorBase;
|
2010-01-11 20:56:24 +01:00
|
|
|
int __glXEventBase;
|
2006-06-29 06:05:01 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
int
|
|
|
|
__glXError(int error)
|
2006-06-29 06:05:01 +02:00
|
|
|
{
|
|
|
|
return __glXErrorBase + error;
|
|
|
|
}
|
|
|
|
|
2007-05-31 05:25:03 +02:00
|
|
|
__GLXclientState *
|
|
|
|
glxGetClient(ClientPtr pClient)
|
|
|
|
{
|
2007-10-17 22:09:40 +02:00
|
|
|
return dixLookupPrivate(&pClient->devPrivates, glxClientPrivateKey);
|
2007-05-31 05:25:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-12-15 10:05:51 +01:00
|
|
|
glxClientCallback(CallbackListPtr *list, void *closure, void *data)
|
2007-05-31 05:25:03 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
|
|
|
|
ClientPtr pClient = clientinfo->client;
|
|
|
|
__GLXclientState *cl = glxGetClient(pClient);
|
2007-05-31 05:25:03 +02:00
|
|
|
|
|
|
|
switch (pClient->clientState) {
|
|
|
|
case ClientStateGone:
|
2012-03-21 20:55:09 +01:00
|
|
|
free(cl->returnBuf);
|
|
|
|
free(cl->GLClientextensions);
|
2018-01-10 19:05:45 +01:00
|
|
|
cl->returnBuf = NULL;
|
|
|
|
cl->GLClientextensions = NULL;
|
2012-03-21 20:55:09 +01:00
|
|
|
break;
|
2007-05-31 05:25:03 +02:00
|
|
|
|
|
|
|
default:
|
2012-03-21 20:55:09 +01:00
|
|
|
break;
|
2007-05-31 05:25:03 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
/************************************************************************/
|
|
|
|
|
2018-01-10 19:05:45 +01:00
|
|
|
static __GLXprovider *__glXProviderStack = &__glXDRISWRastProvider;
|
2007-05-31 05:25:03 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
void
|
|
|
|
GlxPushProvider(__GLXprovider * provider)
|
2007-05-31 05:25:03 +02:00
|
|
|
{
|
|
|
|
provider->next = __glXProviderStack;
|
|
|
|
__glXProviderStack = provider;
|
|
|
|
}
|
|
|
|
|
2012-09-27 23:44:42 +02:00
|
|
|
static Bool
|
|
|
|
checkScreenVisuals(void)
|
|
|
|
{
|
|
|
|
int i, j;
|
|
|
|
|
|
|
|
for (i = 0; i < screenInfo.numScreens; i++) {
|
|
|
|
ScreenPtr screen = screenInfo.screens[i];
|
|
|
|
for (j = 0; j < screen->numVisuals; j++) {
|
|
|
|
if (screen->visuals[j].class == TrueColor ||
|
|
|
|
screen->visuals[j].class == DirectColor)
|
2017-08-16 20:49:16 +02:00
|
|
|
return TRUE;
|
2012-09-27 23:44:42 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-16 20:49:16 +02:00
|
|
|
return FALSE;
|
2012-09-27 23:44:42 +02:00
|
|
|
}
|
|
|
|
|
2016-02-02 20:10:49 +01:00
|
|
|
static void
|
|
|
|
GetGLXDrawableBytes(void *value, XID id, ResourceSizePtr size)
|
|
|
|
{
|
|
|
|
__GLXdrawable *draw = value;
|
|
|
|
|
|
|
|
size->resourceSize = 0;
|
|
|
|
size->pixmapRefSize = 0;
|
|
|
|
size->refCnt = 1;
|
|
|
|
|
|
|
|
if (draw->type == GLX_DRAWABLE_PIXMAP) {
|
|
|
|
SizeType pixmapSizeFunc = GetResourceTypeSizeFunc(RT_PIXMAP);
|
|
|
|
ResourceSizeRec pixmapSize = { 0, };
|
|
|
|
pixmapSizeFunc((PixmapPtr)draw->pDraw, draw->pDraw->id, &pixmapSize);
|
|
|
|
size->pixmapRefSize += pixmapSize.pixmapRefSize;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-10 19:05:45 +01:00
|
|
|
static void
|
|
|
|
xorgGlxCloseExtension(const ExtensionEntry *extEntry)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2018-01-10 19:05:45 +01:00
|
|
|
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;
|
|
|
|
}
|
2006-06-29 06:05:01 +02:00
|
|
|
|
2018-01-10 19:05:45 +01:00
|
|
|
/* 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;
|
|
|
|
}
|
2012-07-10 03:02:55 +02:00
|
|
|
}
|
|
|
|
|
2018-01-10 19:05:45 +01:00
|
|
|
/* If we're creating a resource, add the map now */
|
|
|
|
if (resource) {
|
|
|
|
LEGAL_NEW_RESOURCE(resource, client);
|
|
|
|
if (!glxServer.addXIDMap(resource, vendor))
|
|
|
|
return BadAlloc;
|
|
|
|
}
|
2012-09-27 23:44:42 +02:00
|
|
|
|
2018-01-10 19:05:45 +01:00
|
|
|
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 *
|
|
|
|
xorgGlxInitGLVNDVendor(void)
|
|
|
|
{
|
2018-02-19 16:18:07 +01:00
|
|
|
static GlxServerVendor *glvnd_vendor = NULL;
|
|
|
|
|
2018-01-10 19:05:45 +01:00
|
|
|
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;
|
|
|
|
}
|
2009-12-11 09:46:22 +01:00
|
|
|
|
2018-01-10 19:05:45 +01:00
|
|
|
static void
|
|
|
|
xorgGlxServerInit(CallbackListPtr *pcbl, void *param, void *ext)
|
|
|
|
{
|
2018-02-19 16:18:07 +01:00
|
|
|
GlxServerVendor *glvnd_vendor;
|
2018-01-10 19:05:45 +01:00
|
|
|
const ExtensionEntry *extEntry = ext;
|
|
|
|
int i;
|
2016-02-02 20:10:49 +01:00
|
|
|
|
2018-01-10 19:05:45 +01:00
|
|
|
if (!xorgGlxServerPreInit(extEntry)) {
|
2012-03-21 20:55:09 +01:00
|
|
|
return;
|
2018-01-10 19:05:45 +01:00
|
|
|
}
|
|
|
|
|
2018-02-19 16:18:07 +01:00
|
|
|
glvnd_vendor = xorgGlxInitGLVNDVendor();
|
|
|
|
if (!glvnd_vendor) {
|
2012-03-21 20:55:09 +01:00
|
|
|
return;
|
2018-01-10 19:05:45 +01:00
|
|
|
}
|
2007-05-31 05:25:03 +02:00
|
|
|
|
2008-07-25 04:06:34 +02:00
|
|
|
for (i = 0; i < screenInfo.numScreens; i++) {
|
2018-01-10 19:05:45 +01:00
|
|
|
ScreenPtr pScreen = screenInfo.screens[i];
|
|
|
|
__GLXprovider *p;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2018-01-10 19:05:45 +01:00
|
|
|
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;
|
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2018-01-10 19:05:45 +01:00
|
|
|
for (p = __glXProviderStack; p != NULL; p = p->next) {
|
|
|
|
__GLXscreen *glxScreen = p->screenProbe(pScreen);
|
2012-03-21 20:55:09 +01:00
|
|
|
if (glxScreen != NULL) {
|
|
|
|
LogMessage(X_INFO,
|
|
|
|
"GLX: Initialized %s GL provider for screen %d\n",
|
|
|
|
p->name, i);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-01-10 19:05:45 +01:00
|
|
|
if (p) {
|
|
|
|
glxServer.setScreenVendor(pScreen, glvnd_vendor);
|
|
|
|
} else {
|
2012-03-21 20:55:09 +01:00
|
|
|
LogMessage(X_INFO,
|
|
|
|
"GLX: no usable GL providers found for screen %d\n", i);
|
2018-01-10 19:05:45 +01:00
|
|
|
}
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
2018-01-10 19:05:45 +01:00
|
|
|
}
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2018-01-10 19:05:45 +01:00
|
|
|
Bool
|
|
|
|
xorgGlxCreateVendor(void)
|
|
|
|
{
|
|
|
|
return AddCallback(glxServer.extensionInitCallback, xorgGlxServerInit, NULL);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************/
|
|
|
|
|
|
|
|
/*
|
|
|
|
** Make a context the current one for the GL (in this implementation, there
|
|
|
|
** is only one instance of the GL, and we use it to serve all GL clients by
|
|
|
|
** switching it between different contexts). While we are at it, look up
|
|
|
|
** a context by its tag and return its (__GLXcontext *).
|
|
|
|
*/
|
2012-03-21 20:55:09 +01:00
|
|
|
__GLXcontext *
|
|
|
|
__glXForceCurrent(__GLXclientState * cl, GLXContextTag tag, int *error)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2018-01-10 19:05:48 +01:00
|
|
|
ClientPtr client = cl->client;
|
|
|
|
REQUEST(xGLXSingleReq);
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
__GLXcontext *cx;
|
|
|
|
|
|
|
|
/*
|
2012-03-21 20:55:09 +01:00
|
|
|
** See if the context tag is legal; it is managed by the extension,
|
|
|
|
** so if it's invalid, we have an implementation error.
|
|
|
|
*/
|
2011-03-21 17:12:53 +01:00
|
|
|
cx = __glXLookupContextByTag(cl, tag);
|
2003-11-14 17:48:57 +01:00
|
|
|
if (!cx) {
|
2012-03-21 20:55:09 +01:00
|
|
|
cl->client->errorValue = tag;
|
|
|
|
*error = __glXError(GLXBadContextTag);
|
|
|
|
return 0;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
2018-01-10 19:05:48 +01:00
|
|
|
/* If we're expecting a glXRenderLarge request, this better be one. */
|
|
|
|
if (cx->largeCmdRequestsSoFar != 0 && stuff->glxCode != X_GLXRenderLarge) {
|
|
|
|
client->errorValue = stuff->glxCode;
|
|
|
|
*error = __glXError(GLXBadLargeRequest);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
if (!cx->isDirect) {
|
2012-03-21 20:55:09 +01:00
|
|
|
if (cx->drawPriv == NULL) {
|
|
|
|
/*
|
|
|
|
** The drawable has vanished. It must be a window, because only
|
|
|
|
** windows can be destroyed from under us; GLX pixmaps are
|
|
|
|
** refcounted and don't go away until no one is using them.
|
|
|
|
*/
|
|
|
|
*error = __glXError(GLXBadCurrentWindow);
|
|
|
|
return 0;
|
|
|
|
}
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
|
|
|
|
if (cx->wait && (*cx->wait) (cx, cl, error))
|
|
|
|
return NULL;
|
2009-07-16 15:01:17 +02:00
|
|
|
|
2014-04-18 03:18:49 +02:00
|
|
|
if (cx == lastGLContext) {
|
2012-03-21 20:55:09 +01:00
|
|
|
/* No need to re-bind */
|
|
|
|
return cx;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Make this context the current one for the GL. */
|
|
|
|
if (!cx->isDirect) {
|
2016-05-10 02:29:58 +02:00
|
|
|
/*
|
|
|
|
* If it is being forced, it means that this context was already made
|
|
|
|
* current. So it cannot just be made current again without decrementing
|
|
|
|
* refcount's
|
|
|
|
*/
|
|
|
|
(*cx->loseCurrent) (cx);
|
2014-04-18 03:23:51 +02:00
|
|
|
lastGLContext = cx;
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!(*cx->makeCurrent) (cx)) {
|
|
|
|
/* Bind failed, and set the error code. Bummer */
|
2014-04-18 03:23:51 +02:00
|
|
|
lastGLContext = NULL;
|
2012-03-21 20:55:09 +01:00
|
|
|
cl->client->errorValue = cx->id;
|
|
|
|
*error = __glXError(GLXBadContextState);
|
|
|
|
return 0;
|
|
|
|
}
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
return cx;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************/
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
void
|
|
|
|
glxSuspendClients(void)
|
2006-09-07 21:35:16 +02:00
|
|
|
{
|
|
|
|
int i;
|
2006-03-12 01:11:34 +01:00
|
|
|
|
2007-05-31 05:25:03 +02:00
|
|
|
for (i = 1; i < currentMaxClients; i++) {
|
2018-01-10 19:05:45 +01:00
|
|
|
if (glxGetClient(clients[i])->client)
|
2012-03-21 20:55:09 +01:00
|
|
|
IgnoreClient(clients[i]);
|
2006-09-07 21:35:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
glxBlockClients = TRUE;
|
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
void
|
|
|
|
glxResumeClients(void)
|
2006-09-07 21:35:16 +02:00
|
|
|
{
|
|
|
|
__GLXcontext *cx, *next;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
glxBlockClients = FALSE;
|
|
|
|
|
2007-05-31 05:25:03 +02:00
|
|
|
for (i = 1; i < currentMaxClients; i++) {
|
2018-01-10 19:05:45 +01:00
|
|
|
if (glxGetClient(clients[i])->client)
|
2012-03-21 20:55:09 +01:00
|
|
|
AttendClient(clients[i]);
|
2006-09-07 21:35:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
for (cx = glxPendingDestroyContexts; cx != NULL; cx = next) {
|
2012-03-21 20:55:09 +01:00
|
|
|
next = cx->next;
|
2006-09-07 21:35:16 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
cx->destroy(cx);
|
2006-09-07 21:35:16 +02:00
|
|
|
}
|
|
|
|
glxPendingDestroyContexts = NULL;
|
|
|
|
}
|
2006-03-12 01:11:34 +01:00
|
|
|
|
2013-12-03 21:01:44 +01:00
|
|
|
static glx_gpa_proc _get_proc_address;
|
2013-07-10 16:00:46 +02:00
|
|
|
|
|
|
|
void
|
2013-12-03 21:01:44 +01:00
|
|
|
__glXsetGetProcAddress(glx_gpa_proc get_proc_address)
|
2013-07-10 16:00:46 +02:00
|
|
|
{
|
|
|
|
_get_proc_address = get_proc_address;
|
|
|
|
}
|
|
|
|
|
|
|
|
void *__glGetProcAddress(const char *proc)
|
|
|
|
{
|
2014-02-04 02:38:24 +01:00
|
|
|
void *ret = (void *) _get_proc_address(proc);
|
2013-12-13 21:07:48 +01:00
|
|
|
|
2014-02-04 02:38:24 +01:00
|
|
|
return ret ? ret : (void *) NoopDDA;
|
2013-07-10 16:00:46 +02:00
|
|
|
}
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
/*
|
|
|
|
** Top level dispatcher; all commands are executed from here down.
|
|
|
|
*/
|
2012-03-21 20:55:09 +01:00
|
|
|
static int
|
|
|
|
__glXDispatch(ClientPtr client)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
REQUEST(xGLXSingleReq);
|
|
|
|
CARD8 opcode;
|
2006-08-23 22:30:13 +02:00
|
|
|
__GLXdispatchSingleProcPtr proc;
|
2003-11-14 17:48:57 +01:00
|
|
|
__GLXclientState *cl;
|
2018-01-10 19:05:45 +01:00
|
|
|
int retval = BadRequest;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
opcode = stuff->glxCode;
|
2007-05-31 05:25:03 +02:00
|
|
|
cl = glxGetClient(client);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
|
2018-01-10 19:05:45 +01:00
|
|
|
if (!cl->client)
|
|
|
|
cl->client = client;
|
|
|
|
|
2006-09-07 21:35:16 +02:00
|
|
|
/* If we're currently blocking GLX clients, just put this guy to
|
|
|
|
* sleep, reset the request and return. */
|
|
|
|
if (glxBlockClients) {
|
2012-03-21 20:55:09 +01:00
|
|
|
ResetCurrentRequest(client);
|
|
|
|
client->sequence--;
|
|
|
|
IgnoreClient(client);
|
|
|
|
return Success;
|
2006-09-07 21:35:16 +02:00
|
|
|
}
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
/*
|
2012-03-21 20:55:09 +01:00
|
|
|
** Use the opcode to index into the procedure table.
|
|
|
|
*/
|
|
|
|
proc = __glXGetProtocolDecodeFunction(&Single_dispatch_info, opcode,
|
2011-03-21 17:12:53 +01:00
|
|
|
client->swapped);
|
2018-01-10 19:05:45 +01:00
|
|
|
if (proc != NULL)
|
2012-03-21 20:55:09 +01:00
|
|
|
retval = (*proc) (cl, (GLbyte *) stuff);
|
2006-03-12 01:11:34 +01:00
|
|
|
|
|
|
|
return retval;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|