Mesa (master): st/mesa: call glthread_destroy() before _vbo_DestroyContext ()

Timothy Arceri tarceri at kemper.freedesktop.org
Thu Mar 16 22:47:13 UTC 2017


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

Author: Timothy Arceri <tarceri at itsqueeze.com>
Date:   Thu Mar 16 23:09:19 2017 +1100

st/mesa: call glthread_destroy() before _vbo_DestroyContext()

Otherwise we have a race condition between vbo calls in the
glthread and the _vbo_DestroyContext() call.

This fixes a bunch of piglit crashes.

Reviewed-by: Marek Olšák <marek.olsak at amd.com>

---

 src/mesa/main/context.c             | 2 --
 src/mesa/state_tracker/st_context.c | 3 +++
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 0a9c65c2ab..8876ca2e24 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1294,8 +1294,6 @@ _mesa_free_context_data( struct gl_context *ctx )
       _mesa_make_current(ctx, NULL, NULL);
    }
 
-   _mesa_glthread_destroy(ctx);
-
    /* unreference WinSysDraw/Read buffers */
    _mesa_reference_framebuffer(&ctx->WinSysDrawBuffer, NULL);
    _mesa_reference_framebuffer(&ctx->WinSysReadBuffer, NULL);
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index 869e6e9f87..c7d25ecd75 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -575,6 +575,9 @@ void st_destroy_context( struct st_context *st )
    struct gl_context *ctx = st->ctx;
    GLuint i;
 
+   /* This must be called first so that glthread has a chance to finish */
+   _mesa_glthread_destroy(ctx);
+
    _mesa_HashWalk(ctx->Shared->TexObjects, destroy_tex_sampler_cb, st);
 
    st_reference_fragprog(st, &st->fp, NULL);




More information about the mesa-commit mailing list