X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fstate_trackers%2Fglx%2Fxlib%2Fglx_api.c;fp=src%2Fgallium%2Fstate_trackers%2Fglx%2Fxlib%2Fglx_api.c;h=ea503746604de7abb084eb1592bcad748b38942e;hb=a693f98e17694841fac1e3c90dfb5f5f46942486;hp=f83a7bb88dbe6f1bc5c85901283b9cac3ad7ae27;hpb=db8be355d13f7da4890b1856de2bc58b8458d445;p=mesa.git 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);