Mesa (master): glx: Only clear the stored context tag when the context has been unbound

Kristian Høgsberg krh at kemper.freedesktop.org
Tue Sep 7 13:08:33 UTC 2010


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

Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Tue Sep  7 11:36:07 2010 +0100

glx: Only clear the stored context tag when the context has been unbound

The calling order of ->bind and ->unbind changed and then ->unbind would
clear the currentContextTag of the old context before ->bind could reuse
it in the make current request, in the indirect case.

Instead, clear the old currentContextTag if and only if we send a request
to the server to actually unbind it or reassign it to another context.

https://bugs.freedesktop.org/show_bug.cgi?id=29977

Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
Signed-off-by: Kristian Høgsberg <krh at bitplanet.net>

---

 src/glx/indirect_glx.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/glx/indirect_glx.c b/src/glx/indirect_glx.c
index f059840..61ceed3 100644
--- a/src/glx/indirect_glx.c
+++ b/src/glx/indirect_glx.c
@@ -137,10 +137,12 @@ indirect_bind_context(struct glx_context *gc, struct glx_context *old,
    Display *dpy = gc->psc->dpy;
    int opcode = __glXSetupForCommand(dpy);
 
-   if (old != &dummyContext && !old->isDirect && old->psc->dpy == dpy)
+   if (old != &dummyContext && !old->isDirect && old->psc->dpy == dpy) {
       tag = old->currentContextTag;
-   else
-      tag = None;
+      old->currentContextTag = 0;
+   } else {
+      tag = 0;
+   }
 
    SendMakeCurrentRequest(dpy, opcode, gc->xid, tag, draw, read, &reply);
 
@@ -170,10 +172,11 @@ indirect_unbind_context(struct glx_context *gc, struct glx_context *new)
     * context to a direct context or from one dpy to another and have
     * to send a request to the dpy to unbind the previous context.
     */
-   if (!new || new->isDirect || new->psc->dpy != dpy)
+   if (!new || new->isDirect || new->psc->dpy != dpy) {
       SendMakeCurrentRequest(dpy, opcode, None,
 			     gc->currentContextTag, None, None, &reply);
-   gc->currentContextTag = 0;
+      gc->currentContextTag = 0;
+   }
 }
 
 static void




More information about the mesa-commit mailing list