Module: Mesa
Branch: staging/22.3
Commit: 0889382796c6be2fb14415ef86397fef37e7fdfd
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0889382796c6be2fb14415ef86397fef37e7fdfd

Author: Lucas Stach <[email protected]>
Date:   Mon Nov  7 14:22:21 2022 +0100

etnaviv: fix late Z with MSAA active

On RA_WRITE_DEPTH GPUs the RA stage needs to be told that MSAA is active
when the PE Z/S stage is needed. Not sure what it does exactly, but this
fixes broken late Z on those GPUs when performing MSAA rendering.

Cc: 22.3 mesa-stable
Signed-off-by: Lucas Stach <[email protected]>
Reviewed-by: Christian Gmeiner <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19571>
(cherry picked from commit 2f85d9095e3559597bc1cf0051ab6d7bc18faecd)

---

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

diff --git a/.pick_status.json b/.pick_status.json
index 47757541d78..861c5b22878 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -58,7 +58,7 @@
         "description": "etnaviv: fix late Z with MSAA active",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null
     },
diff --git a/src/gallium/drivers/etnaviv/etnaviv_state.c 
b/src/gallium/drivers/etnaviv/etnaviv_state.c
index 750509673d7..794e6820995 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_state.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_state.c
@@ -777,6 +777,13 @@ etna_update_zsa(struct etna_context *ctx)
        */
       if (late_z_test || (early_z_test && late_z_write))
          new_ra_depth |= VIVS_RA_EARLY_DEPTH_HDEPTH_DISABLE;
+
+      if (ctx->framebuffer_s.nr_cbufs > 0) {
+         struct pipe_resource *res = ctx->framebuffer_s.cbufs[0]->texture;
+
+         if ((late_z_test || late_z_write) && res->nr_samples > 1)
+            new_ra_depth |= VIVS_RA_EARLY_DEPTH_LATE_DEPTH_MSAA;
+      }
    }
 
    if (new_pe_depth != zsa->PE_DEPTH_CONFIG ||

Reply via email to