Mesa (staging/22.1): panfrost: Only write depth / stencil once if MRT is used

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


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

Author: Icecream95 <ixn at disroot.org>
Date:   Tue May 24 18:25:47 2022 +1200

panfrost: Only write depth / stencil once if MRT is used

We can't assume that RT0 will be written, so this has to be based on
whether a combined store has already been emitted, not the location of
the store.

Emit a non-special combined_store intrinsic that only writes colour
for the other RTs, as reordering stores breaks the Midgard compiler.

Fixes: d37e901e35a ("pan/mdg: Add new depth store lowering")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6527
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16685>
(cherry picked from commit a4323b097942a073822fb19c235af95edc58d64a)

---

 .pick_status.json                      | 2 +-
 src/panfrost/util/pan_lower_writeout.c | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 96f9ef42c26..9505dcd1a43 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -634,7 +634,7 @@
         "description": "panfrost: Only write depth / stencil once if MRT is used",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "d37e901e35a9db2fc5f10558e44fbf8376a174f5"
     },
diff --git a/src/panfrost/util/pan_lower_writeout.c b/src/panfrost/util/pan_lower_writeout.c
index ea8fb5f1a55..75d482f2b7b 100644
--- a/src/panfrost/util/pan_lower_writeout.c
+++ b/src/panfrost/util/pan_lower_writeout.c
@@ -173,7 +173,12 @@ pan_nir_lower_zs_store(nir_shader *nir)
                                 nir_builder_init(&b, function->impl);
                                 b.cursor = nir_after_block_before_jump(instr->block);
 
-                                pan_nir_emit_combined_store(&b, intr, writeout | PAN_WRITEOUT_C, stores);
+                                /* Trying to write depth twice results in the
+                                 * wrong blend shader being executed on
+                                 * Midgard */
+                                unsigned this_store = PAN_WRITEOUT_C | (replaced ? 0 : writeout);
+
+                                pan_nir_emit_combined_store(&b, intr, this_store, stores);
 
                                 nir_instr_remove(instr);
 



More information about the mesa-commit mailing list