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

Author: Lionel Landwerlin <[email protected]>
Date:   Sun Feb 20 20:46:17 2022 +0200

isl: don't set inconsistent fields for depth when using stencil only

Since Gfx12+ 3DSTATE_STENCIL_BUFFER gained its own
Width/Depth/Format/etc... fields. So don't set those fields but leave
the address/pitch to 0.

Issue found on simulation.

Signed-off-by: Lionel Landwerlin <[email protected]>
Reviewed-by: Caio Oliveira <[email protected]>
Reviewed-by: Emma Anholt <[email protected]>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15637>
(cherry picked from commit 3ca1fdc8b56c0cb6d3c8687d4d13ec594f5041f1)

---

 .pick_status.json                      | 2 +-
 src/intel/isl/isl_emit_depth_stencil.c | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index 22b6206a2e6..887208a6380 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -2864,7 +2864,7 @@
         "description": "isl: don't set inconsistent fields for depth when 
using stencil only",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null,
         "notes": null
diff --git a/src/intel/isl/isl_emit_depth_stencil.c 
b/src/intel/isl/isl_emit_depth_stencil.c
index f1863fe8df5..aaa2a8e80d0 100644
--- a/src/intel/isl/isl_emit_depth_stencil.c
+++ b/src/intel/isl/isl_emit_depth_stencil.c
@@ -114,12 +114,20 @@ isl_genX(emit_depth_stencil_hiz_s)(const struct 
isl_device *dev, void *batch,
       if (db.SurfaceType == SURFTYPE_3D)
          db.Depth = info->depth_surf->logical_level0_px.depth - 1;
    } else if (info->stencil_surf) {
+      /* On Gfx12+ 3DSTATE_STENCIL_BUFFER has its own fields for all of
+       * this. No need to replicate it here.
+       */
+#if GFX_VER < 12
       db.SurfaceType = isl_encode_ds_surftype[info->stencil_surf->dim];
       db.SurfaceFormat = D32_FLOAT;
       db.Width = info->stencil_surf->logical_level0_px.width - 1;
       db.Height = info->stencil_surf->logical_level0_px.height - 1;
       if (db.SurfaceType == SURFTYPE_3D)
          db.Depth = info->stencil_surf->logical_level0_px.depth - 1;
+#else
+      db.SurfaceType = SURFTYPE_NULL;
+      db.SurfaceFormat = D32_FLOAT;
+#endif
    } else {
       db.SurfaceType = SURFTYPE_NULL;
       db.SurfaceFormat = D32_FLOAT;

Reply via email to