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

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


Module: Mesa
Branch: staging/22.1
Commit: d6009c3fe99236fafc2ded379da2a8ee0bf808b8
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d6009c3fe99236fafc2ded379da2a8ee0bf808b8

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 7a99f0d157f..542d8a270c9 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -94,7 +94,7 @@
         "description": "radeonsi: fix a crash when failing to create a context",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "792a638b032d16fbe6404f9d90c34b3e0f1fb0b5"
     },
diff --git a/src/gallium/drivers/radeonsi/gfx10_query.c b/src/gallium/drivers/radeonsi/gfx10_query.c
index a6aac5a49b3..9631f0dea3c 100644
--- a/src/gallium/drivers/radeonsi/gfx10_query.c
+++ b/src/gallium/drivers/radeonsi/gfx10_query.c
@@ -446,6 +446,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