diff options
author | Adam Jackson <[email protected]> | 2019-09-10 15:06:29 -0400 |
---|---|---|
committer | Adam Jackson <[email protected]> | 2019-09-17 20:16:00 +0000 |
commit | a693f98e17694841fac1e3c90dfb5f5f46942486 (patch) | |
tree | 25a0b2d1ed5386a63e4a870769fffc620f07e96a | |
parent | db8be355d13f7da4890b1856de2bc58b8458d445 (diff) |
gallium/xlib: Remove MakeCurrent_PrevContext
As the comment notes, this is not thread-safe. You can just as easily
use GetCurrentContext instead, so, do that.
-rw-r--r-- | src/gallium/state_trackers/glx/xlib/glx_api.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/gallium/state_trackers/glx/xlib/glx_api.c b/src/gallium/state_trackers/glx/xlib/glx_api.c index f83a7bb88db..ea503746604 100644 --- a/src/gallium/state_trackers/glx/xlib/glx_api.c +++ b/src/gallium/state_trackers/glx/xlib/glx_api.c @@ -1174,16 +1174,13 @@ glXCreateContext( Display *dpy, XVisualInfo *visinfo, } -/* XXX these may have to be removed due to thread-safety issues. */ -static GLXContext MakeCurrent_PrevContext = 0; - - /* GLX 1.3 and later */ PUBLIC Bool glXMakeContextCurrent( Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx ) { GLXContext glxCtx = ctx; + GLXContext current = GetCurrentContext(); static boolean firsttime = 1, no_rast = 0; if (firsttime) { @@ -1196,7 +1193,7 @@ glXMakeContextCurrent( Display *dpy, GLXDrawable draw, XMesaContext xmctx = glxCtx->xmesaContext; /* Find the XMesaBuffer which corresponds to the GLXDrawable 'draw' */ - if (ctx == MakeCurrent_PrevContext) { + if (ctx == current) { drawBuffer = XMesaFindBuffer( dpy, draw ); } if (!drawBuffer) { @@ -1209,7 +1206,7 @@ glXMakeContextCurrent( Display *dpy, GLXDrawable draw, } /* Find the XMesaBuffer which corresponds to the GLXDrawable 'read' */ - if (ctx == MakeCurrent_PrevContext) { + if (ctx == current) { readBuffer = XMesaFindBuffer( dpy, read ); } if (!readBuffer) { @@ -1221,11 +1218,9 @@ glXMakeContextCurrent( Display *dpy, GLXDrawable draw, } } - if (no_rast && MakeCurrent_PrevContext == ctx) + if (no_rast && current == ctx) return True; - MakeCurrent_PrevContext = ctx; - /* Now make current! */ if (XMesaMakeCurrent2(xmctx, drawBuffer, readBuffer)) { ctx->currentDpy = dpy; @@ -1241,7 +1236,6 @@ glXMakeContextCurrent( Display *dpy, GLXDrawable draw, else if (!ctx && !draw && !read) { /* release current context w/out assigning new one. */ XMesaMakeCurrent2( NULL, NULL, NULL ); - MakeCurrent_PrevContext = 0; SetCurrentContext(NULL); return True; } @@ -1376,7 +1370,7 @@ glXCopyContext( Display *dpy, GLXContext src, GLXContext dst, XMesaContext xm_src = src->xmesaContext; XMesaContext xm_dst = dst->xmesaContext; (void) dpy; - if (MakeCurrent_PrevContext == src) { + if (GetCurrentContext() == src) { glFlush(); } XMesaCopyContext(xm_src, xm_dst, mask); @@ -1404,7 +1398,6 @@ glXDestroyContext( Display *dpy, GLXContext ctx ) if (ctx) { GLXContext glxCtx = ctx; (void) dpy; - MakeCurrent_PrevContext = 0; XMesaDestroyContext( glxCtx->xmesaContext ); XMesaGarbageCollect(); free(glxCtx); |