Mesa (staging/22.0): radeonsi: fix a crash when failing to create a context

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon May 16 17:38:53 UTC 2022


Module: Mesa
Branch: staging/22.0
Commit: 72d812f03caf3734a47b9803dd08608fc5cb6609
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=72d812f03caf3734a47b9803dd08608fc5cb6609

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Wed May 11 18:22:46 2022 -0400

radeonsi: fix a crash when failing to create a context

When shader_query_buffers is NULL, the code treated as as non-empty.

Fixes: 792a638b032d "radeonsi/gfx10: implement streamout-related queries"

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16466>
(cherry picked from commit 6515b3b2dc0f4fed6faea8988137d09b0fd67f21)

---

 .pick_status.json                          | 2 +-
 src/gallium/drivers/radeonsi/gfx10_query.c | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index b2009e88a4d..8fec2bf97cf 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -84,7 +84,7 @@
         "description": "radeonsi: fix a crash when failing to create a context",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "because_sha": "792a638b032d16fbe6404f9d90c34b3e0f1fb0b5"
     },
     {
diff --git a/src/gallium/drivers/radeonsi/gfx10_query.c b/src/gallium/drivers/radeonsi/gfx10_query.c
index 7a39f520e22..fce595a9c3a 100644
--- a/src/gallium/drivers/radeonsi/gfx10_query.c
+++ b/src/gallium/drivers/radeonsi/gfx10_query.c
@@ -445,6 +445,9 @@ void gfx10_init_query(struct si_context *sctx)
 
 void gfx10_destroy_query(struct si_context *sctx)
 {
+   if (!sctx->shader_query_buffers.next)
+      return;
+
    while (!list_is_empty(&sctx->shader_query_buffers)) {
       struct gfx10_sh_query_buffer *qbuf =
          list_first_entry(&sctx->shader_query_buffers, struct gfx10_sh_query_buffer, list);



More information about the mesa-commit mailing list