Module: Mesa
Branch: staging/22.2
Commit: 7cd4905eaff6ce59f49f652d5fc8406845c6165c
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7cd4905eaff6ce59f49f652d5fc8406845c6165c

Author: Connor Abbott <[email protected]>
Date:   Thu Sep  1 14:37:41 2022 +0200

tu/lrz: Fix multiple depth attachment case with secondaries

This is a counterpart to the previous commit. When we have multiple
depth attachments, in the secondary we currently don't disable LRZ and
so we may need a valid LRZ fast-clear base.

Fixes: 4b5f0d98 ("tu: Overhaul LRZ, implement on-GPU dir tracking and LRZ 
fast-clear")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18369>
(cherry picked from commit f640661e541bb2b300b1432f5e6a6e575353c3f5)

---

 .pick_status.json             | 2 +-
 src/freedreno/vulkan/tu_lrz.c | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index 431ef05240e..4117af7abed 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -6520,7 +6520,7 @@
         "description": "tu/lrz: Fix multiple depth attachment case with 
secondaries",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "4b5f0d98fd57cbcd253b85291b7491aa5754a2eb"
     },
diff --git a/src/freedreno/vulkan/tu_lrz.c b/src/freedreno/vulkan/tu_lrz.c
index a60be23ab93..31b659856b1 100644
--- a/src/freedreno/vulkan/tu_lrz.c
+++ b/src/freedreno/vulkan/tu_lrz.c
@@ -318,6 +318,14 @@ tu_lrz_begin_renderpass(struct tu_cmd_buffer *cmd,
          struct tu_image *image = cmd->state.attachments[i]->image;
          tu_disable_lrz(cmd, &cmd->cs, image);
       }
+
+      /* We need a valid LRZ fast-clear base, in case the render pass contents
+       * are in secondaries that enable LRZ, so that they can read that LRZ is
+       * dynamically disabled. It doesn't matter which we use, so just leave
+       * the last one as emitted in tu_disable_lrz().
+       */
+      memset(&cmd->state.lrz, 0, sizeof(cmd->state.lrz));
+      return;
    }
 
     /* Track LRZ valid state */

Reply via email to