Mesa (staging/22.0): radeonsi: don't use sel->nir in si_check_blend_dst_sampler_noop

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu May 26 16:40:24 UTC 2022


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

Author: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Date:   Wed May 18 16:50:22 2022 +0200

radeonsi: don't use sel->nir in si_check_blend_dst_sampler_noop

We don't want to modify sel->nir so force the use of the serialized
version of the shader.
Waiting on sel->ready guarantees that sel->nir will be NULL and that
si_get_nir_shader will use sel->nir_binary.

Fixes: b78a38bd022 ("radeonsi: use si_nir_is_output_const_if_tex_is_const")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6415
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16587>
(cherry picked from commit ef950d370a7854eee751ae49f50f2ef392ab3b2b)

---

 .pick_status.json                       | 2 +-
 src/gallium/drivers/radeonsi/si_state.c | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index c35fc2f1025..04a8c04bb4a 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -300,7 +300,7 @@
         "description": "radeonsi: don't use sel->nir in si_check_blend_dst_sampler_noop",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "because_sha": "b78a38bd0223188ee585bfaa32384ef98527e016"
     },
     {
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index 0d7d23f41a7..e177a252247 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -641,6 +641,12 @@ static bool si_check_blend_dst_sampler_noop(struct si_context *sctx)
 {
    if (sctx->framebuffer.state.nr_cbufs == 1) {
       struct si_shader_selector *sel = sctx->shader.ps.cso;
+
+      /* Wait for the shader to be ready. */
+      util_queue_fence_wait(&sel->ready);
+
+      assert(!sel->nir);
+
       bool free_nir;
       if (unlikely(sel->info.writes_1_if_tex_is_1 == 0xff)) {
          struct nir_shader *nir = si_get_nir_shader(sel, &sctx->shader.ps.key, &free_nir);
@@ -658,6 +664,7 @@ static bool si_check_blend_dst_sampler_noop(struct si_context *sctx)
             sel->info.writes_1_if_tex_is_1 = 0;
          }
 
+         assert(free_nir);
          if (free_nir)
             ralloc_free(nir);
       }



More information about the mesa-commit mailing list