summaryrefslogtreecommitdiff
path: root/glx
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2014-04-17 18:18:49 -0700
committerEric Anholt <eric@anholt.net>2014-04-23 10:32:02 -0700
commitabf12027063dbe22bec1d055ad8db365cf07395a (patch)
tree306b0df0614f21830d279672476b387ac89e3f10 /glx
parentf12221cbd8ff33070fa2ca086bccf7ed32115f0e (diff)
glx: Move the GLX variable caching what GL context is current to dix.
GLX is trying to track whether the context it wants is current, to avoid the glFlush() (and the rest of the overhead) that occurs on all MakeCurrent calls. However, its cache can be incorrect now that glamor exists. This is a step toward getting glamor to coordinate with GLX. Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
Diffstat (limited to 'glx')
-rw-r--r--glx/glxcmds.c11
-rw-r--r--glx/glxext.c26
-rw-r--r--glx/glxserver.h1
3 files changed, 12 insertions, 26 deletions
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 187e42665..a451d2b43 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -188,7 +188,7 @@ validGlxDrawable(ClientPtr client, XID id, int type, int access_mode,
void
__glXContextDestroy(__GLXcontext * context)
{
- __glXFlushContextCache();
+ lastGLContext = NULL;
}
static void
@@ -434,9 +434,8 @@ static void
StopUsingContext(__GLXcontext * glxc)
{
if (glxc) {
- if (glxc == __glXLastContext) {
- /* Tell server GL library */
- __glXLastContext = 0;
+ if (glxc == lastGLContext) {
+ lastGLContext = NULL;
}
glxc->currentClient = NULL;
if (!glxc->idExists) {
@@ -448,7 +447,7 @@ StopUsingContext(__GLXcontext * glxc)
static void
StartUsingContext(__GLXclientState * cl, __GLXcontext * glxc)
{
- __glXLastContext = glxc;
+ lastGLContext = glxc;
glxc->currentClient = cl->client;
}
@@ -627,7 +626,7 @@ DoMakeCurrent(__GLXclientState * cl,
if (!(*prevglxc->loseCurrent) (prevglxc)) {
return __glXError(GLXBadContext);
}
- __glXFlushContextCache();
+ lastGLContext = NULL;
if (!prevglxc->isDirect) {
prevglxc->drawPriv = NULL;
prevglxc->readPriv = NULL;
diff --git a/glx/glxext.c b/glx/glxext.c
index c9b8cc5b3..85fd219df 100644
--- a/glx/glxext.c
+++ b/glx/glxext.c
@@ -48,12 +48,6 @@
#include "indirect_util.h"
/*
-** The last context used by the server. It is the context that is current
-** from the server's perspective.
-*/
-__GLXcontext *__glXLastContext;
-
-/*
** X resources.
*/
RESTYPE __glXContextRes;
@@ -79,7 +73,7 @@ static int __glXDispatch(ClientPtr);
static void
ResetExtension(ExtensionEntry * extEntry)
{
- __glXFlushContextCache();
+ lastGLContext = NULL;
}
/*
@@ -141,8 +135,8 @@ DrawableGone(__GLXdrawable * glxPriv, XID xid)
(c->drawPriv == glxPriv || c->readPriv == glxPriv)) {
/* just force a re-bind the next time through */
(*c->loseCurrent) (c);
- if (c == __glXLastContext)
- __glXFlushContextCache();
+ if (c == lastGLContext)
+ lastGLContext = NULL;
}
if (c->drawPriv == glxPriv)
c->drawPriv = NULL;
@@ -203,8 +197,8 @@ __glXFreeContext(__GLXcontext * cx)
free(cx->feedbackBuf);
free(cx->selectBuf);
- if (cx == __glXLastContext) {
- __glXFlushContextCache();
+ if (cx == lastGLContext) {
+ lastGLContext = NULL;
}
/* We can get here through both regular dispatching from
@@ -406,12 +400,6 @@ GlxExtensionInit(void)
/************************************************************************/
-void
-__glXFlushContextCache(void)
-{
- __glXLastContext = 0;
-}
-
/*
** 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
@@ -449,7 +437,7 @@ __glXForceCurrent(__GLXclientState * cl, GLXContextTag tag, int *error)
if (cx->wait && (*cx->wait) (cx, cl, error))
return NULL;
- if (cx == __glXLastContext) {
+ if (cx == lastGLContext) {
/* No need to re-bind */
return cx;
}
@@ -463,7 +451,7 @@ __glXForceCurrent(__GLXclientState * cl, GLXContextTag tag, int *error)
return 0;
}
}
- __glXLastContext = cx;
+ lastGLContext = cx;
return cx;
}
diff --git a/glx/glxserver.h b/glx/glxserver.h
index 3f2ae3593..a324b290f 100644
--- a/glx/glxserver.h
+++ b/glx/glxserver.h
@@ -84,7 +84,6 @@ void __glXScreenInitVisuals(__GLXscreen * screen);
/*
** The last context used (from the server's persective) is cached.
*/
-extern __GLXcontext *__glXLastContext;
extern __GLXcontext *__glXForceCurrent(__GLXclientState *, GLXContextTag,
int *);