Mesa (master): xlib: pass Display pointer to XMesaGarbageCollect()

Brian Paul brianp at kemper.freedesktop.org
Tue Feb 22 19:48:22 UTC 2011


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

Author: Andy Skinner <Andy.Skinner at mathworks.com>
Date:   Fri Feb 11 07:31:25 2011 -0800

xlib: pass Display pointer to XMesaGarbageCollect()

Fixes an issue when different displays are used on different threads.

Signed-off-by: Brian Paul <brianp at vmware.com>

---

 src/mesa/drivers/x11/fakeglx.c |    8 ++++----
 src/mesa/drivers/x11/xm_api.c  |    4 ++--
 src/mesa/drivers/x11/xmesa.h   |    2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c
index 577e27d..48657b4 100644
--- a/src/mesa/drivers/x11/fakeglx.c
+++ b/src/mesa/drivers/x11/fakeglx.c
@@ -1292,7 +1292,7 @@ Fake_glXCreateContext( Display *dpy, XVisualInfo *visinfo,
 
    /* deallocate unused windows/buffers */
 #if 0
-   XMesaGarbageCollect();
+   XMesaGarbageCollect(dpy);
 #endif
 
    xmvis = find_glx_visual( dpy, visinfo );
@@ -1533,7 +1533,7 @@ Fake_glXDestroyContext( Display *dpy, GLXContext ctx )
    MakeCurrent_PrevDrawBuffer = 0;
    MakeCurrent_PrevReadBuffer = 0;
    XMesaDestroyContext( glxCtx->xmesaContext );
-   XMesaGarbageCollect();
+   XMesaGarbageCollect(dpy);
    free(glxCtx);
 }
 
@@ -2327,7 +2327,7 @@ Fake_glXCreateNewContext( Display *dpy, GLXFBConfig config,
       return 0;
 
    /* deallocate unused windows/buffers */
-   XMesaGarbageCollect();
+   XMesaGarbageCollect(dpy);
 
    glxCtx->xmesaContext = XMesaCreateContext(xmvis,
                                    shareCtx ? shareCtx->xmesaContext : NULL);
@@ -2542,7 +2542,7 @@ Fake_glXCreateContextWithConfigSGIX(Display *dpy, GLXFBConfigSGIX config, int re
       return 0;
 
    /* deallocate unused windows/buffers */
-   XMesaGarbageCollect();
+   XMesaGarbageCollect(dpy);
 
    glxCtx->xmesaContext = XMesaCreateContext(xmvis,
                                    shareCtx ? shareCtx->xmesaContext : NULL);
diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c
index cb71b34..aad902d 100644
--- a/src/mesa/drivers/x11/xm_api.c
+++ b/src/mesa/drivers/x11/xm_api.c
@@ -2064,12 +2064,12 @@ void xmesa_destroy_buffers_on_display(XMesaDisplay *dpy)
  * Look for XMesaBuffers whose X window has been destroyed.
  * Deallocate any such XMesaBuffers.
  */
-void XMesaGarbageCollect( void )
+void XMesaGarbageCollect( XMesaDisplay* dpy )
 {
    XMesaBuffer b, next;
    for (b=XMesaBufferList; b; b=next) {
       next = b->Next;
-      if (b->display && b->frontxrb->drawable && b->type == WINDOW) {
+      if (b->display && b->display == dpy && b->frontxrb->drawable && b->type == WINDOW) {
          XSync(b->display, False);
          if (!window_exists( b->display, b->frontxrb->drawable )) {
             /* found a dead window, free the ancillary info */
diff --git a/src/mesa/drivers/x11/xmesa.h b/src/mesa/drivers/x11/xmesa.h
index 98737fa..347394e 100644
--- a/src/mesa/drivers/x11/xmesa.h
+++ b/src/mesa/drivers/x11/xmesa.h
@@ -324,7 +324,7 @@ extern const char *XMesaGetString( XMesaContext c, int name );
  *
  * New in Mesa 2.3.
  */
-extern void XMesaGarbageCollect( void );
+extern void XMesaGarbageCollect( XMesaDisplay* dpy );
 
 
 




More information about the mesa-commit mailing list