Mesa (master): xlib: remove unneeded context tracking code

Brian Paul brianp at kemper.freedesktop.org
Mon Mar 3 20:11:30 UTC 2014


Module: Mesa
Branch: master
Commit: bc76e9f28d089f6e1689d8efc41f2a89030c44f6
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=bc76e9f28d089f6e1689d8efc41f2a89030c44f6

Author: Brian Paul <brianp at vmware.com>
Date:   Sat Mar  1 10:40:24 2014 -0700

xlib: remove unneeded context tracking code

This removes the only use of _glthread_Get/SetTSD(), etc.

Reviewed-by: José Fonseca <jfonseca at vmware.com>

---

 src/mesa/drivers/x11/glxapi.c |   47 ++++-------------------------------------
 1 file changed, 4 insertions(+), 43 deletions(-)

diff --git a/src/mesa/drivers/x11/glxapi.c b/src/mesa/drivers/x11/glxapi.c
index 8640cb0..c03c743 100644
--- a/src/mesa/drivers/x11/glxapi.c
+++ b/src/mesa/drivers/x11/glxapi.c
@@ -146,34 +146,6 @@ get_dispatch(Display *dpy)
    }
 
    
-
-
-/**
- * GLX API current context.
- */
-#if defined(GLX_USE_TLS)
-PUBLIC __thread void * CurrentContext
-    __attribute__((tls_model("initial-exec")));
-#elif defined(THREADS)
-static _glthread_TSD ContextTSD;         /**< Per-thread context pointer */
-#else
-static GLXContext CurrentContext = 0;
-#endif
-
-
-static void
-SetCurrentContext(GLXContext c)
-{
-#if defined(GLX_USE_TLS)
-   CurrentContext = c;
-#elif defined(THREADS)
-   _glthread_SetTSD(&ContextTSD, c);
-#else
-   CurrentContext = c;
-#endif
-}
-
-
 /*
  * GLX API entrypoints
  */
@@ -231,8 +203,6 @@ glXDestroyContext(Display *dpy, GLXContext ctx)
    GET_DISPATCH(dpy, t);
    if (!t)
       return;
-   if (glXGetCurrentContext() == ctx)
-      SetCurrentContext(NULL);
    (t->DestroyContext)(dpy, ctx);
 }
 
@@ -259,16 +229,13 @@ glXGetConfig(Display *dpy, XVisualInfo *visinfo, int attrib, int *value)
 }
 
 
+/* declare here to avoid including xmesa.h */
+extern void *XMesaGetCurrentContext(void);
+
 GLXContext PUBLIC
 glXGetCurrentContext(void)
 {
-#if defined(GLX_USE_TLS)
-   return CurrentContext;
-#elif defined(THREADS)
-   return (GLXContext) _glthread_GetTSD(&ContextTSD);
-#else
-   return CurrentContext;
-#endif
+   return (GLXContext) XMesaGetCurrentContext();
 }
 
 
@@ -301,9 +268,6 @@ glXMakeCurrent(Display *dpy, GLXDrawable drawable, GLXContext ctx)
       return False;
    }
    b = (*t->MakeCurrent)(dpy, drawable, ctx);
-   if (b) {
-      SetCurrentContext(ctx);
-   }
    return b;
 }
 
@@ -576,9 +540,6 @@ glXMakeContextCurrent(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXConte
    if (!t)
       return False;
    b = (t->MakeContextCurrent)(dpy, draw, read, ctx);
-   if (b) {
-      SetCurrentContext(ctx);
-   }
    return b;
 }
 




More information about the mesa-commit mailing list