Mesa (staging/20.1): mesa/st: release debug_output after destroying the context

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Sep 16 06:28:54 UTC 2020


Module: Mesa
Branch: staging/20.1
Commit: 85feefb975b3f76f96acdb9f14b27a312d96c28d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=85feefb975b3f76f96acdb9f14b27a312d96c28d

Author: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Date:   Tue Jul  7 11:08:50 2020 +0200

mesa/st: release debug_output after destroying the context

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3230
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2218
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5789>
(cherry picked from commit 25baceafd3dfbc288fe05876c7c088549e46d9d4)

---

 .pick_status.json                   | 2 +-
 src/mesa/state_tracker/st_context.c | 9 ++++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index fbd7a17a8f0..b644b245d6b 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -19561,7 +19561,7 @@
         "description": "mesa/st: release debug_output after destroying the context",
         "nominated": false,
         "nomination_type": null,
-        "resolution": 4,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": null
     },
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index ec4ed493a54..935de6d7b1f 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -29,6 +29,7 @@
 #include "main/accum.h"
 #include "main/api_exec.h"
 #include "main/context.h"
+#include "main/debug_output.h"
 #include "main/glthread.h"
 #include "main/samplerobj.h"
 #include "main/shaderobj.h"
@@ -1108,13 +1109,19 @@ st_destroy_context(struct st_context *st)
 
    st_destroy_program_variants(st);
 
-   _mesa_free_context_data(ctx, true);
+   /* Do not release debug_output yet because it might be in use by other threads.
+    * These threads will be terminated by _mesa_free_context_data and
+    * st_destroy_context_priv.
+    */
+   _mesa_free_context_data(ctx, false);
 
    /* This will free the st_context too, so 'st' must not be accessed
     * afterwards. */
    st_destroy_context_priv(st, true);
    st = NULL;
 
+   _mesa_destroy_debug_output(ctx);
+
    free(ctx);
 
    if (save_ctx == ctx) {



More information about the mesa-commit mailing list