[Mesa-dev] [PATCH 01/12] st/dri: clean up dri_unbind_context

Marek Olšák maraeo at gmail.com
Tue Nov 21 17:46:01 UTC 2017


From: Marek Olšák <marek.olsak at amd.com>

---
 src/gallium/state_trackers/dri/dri_context.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/gallium/state_trackers/dri/dri_context.c b/src/gallium/state_trackers/dri/dri_context.c
index 18bbfa0..f5400ab 100644
--- a/src/gallium/state_trackers/dri/dri_context.c
+++ b/src/gallium/state_trackers/dri/dri_context.c
@@ -221,26 +221,27 @@ dri_destroy_context(__DRIcontext * cPriv)
    ctx->st->destroy(ctx->st);
    free(ctx);
 }
 
 GLboolean
 dri_unbind_context(__DRIcontext * cPriv)
 {
    /* dri_util.c ensures cPriv is not null */
    struct dri_screen *screen = dri_screen(cPriv->driScreenPriv);
    struct dri_context *ctx = dri_context(cPriv);
+   struct st_context_iface *st = ctx->st;
    struct st_api *stapi = screen->st_api;
 
    if (--ctx->bind_count == 0) {
-      if (ctx->st == ctx->stapi->get_current(ctx->stapi)) {
-         if (ctx->st->thread_finish)
-            ctx->st->thread_finish(ctx->st);
+      if (st == stapi->get_current(stapi)) {
+         if (st->thread_finish)
+            st->thread_finish(st);
 
          /* For conformance, unbind is supposed to flush the context.
           * However, if we do it here we might end up flushing a partially
           * destroyed context. Instead, we flush in dri_make_current and
           * in dri_destroy_context which should cover all the cases.
           */
          stapi->make_current(stapi, NULL, NULL, NULL);
       }
    }
 
-- 
2.7.4



More information about the mesa-dev mailing list