Mesa (main): freedreno: Fix gmem invalidating the depth or stencil of packed d/s.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Nov 3 19:20:17 UTC 2021


Module: Mesa
Branch: main
Commit: 29093bc42d20e95288cd306757e7efc928fdb366
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=29093bc42d20e95288cd306757e7efc928fdb366

Author: Emma Anholt <emma at anholt.net>
Date:   Wed Nov  3 09:19:42 2021 -0700

freedreno: Fix gmem invalidating the depth or stencil of packed d/s.

The gmem store stores both depth and stencil for z24s8.  So, if we're
doing a write (clear or draw) to one or the other of the channels, we need
the other one restored as well.

Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13649>

---

 src/freedreno/ci/freedreno-a530-fails.txt      |  1 -
 src/freedreno/ci/freedreno-a630-fails.txt      |  5 -----
 src/gallium/drivers/freedreno/freedreno_draw.c | 10 ++++++++++
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/freedreno/ci/freedreno-a530-fails.txt b/src/freedreno/ci/freedreno-a530-fails.txt
index e746dd66a9f..f493e646de4 100644
--- a/src/freedreno/ci/freedreno-a530-fails.txt
+++ b/src/freedreno/ci/freedreno-a530-fails.txt
@@ -158,7 +158,6 @@ KHR-GLES3.copy_tex_image_conversions.required.texture3d_texture2d,Fail
 
 KHR-GLES3.packed_depth_stencil.blit.depth24_stencil8,Fail
 KHR-GLES3.packed_depth_stencil.blit.depth32f_stencil8,Fail
-KHR-GLES3.packed_depth_stencil.verify_read_pixels.depth24_stencil8,Fail
 
 # "Non-integer comparison: 1, 0, 18, 1e-05: 0.142857 == 0: not equal.
 #  Copy stage: Gradient comparison failed during ReadPixels for input = [GL_RG, GL_FLOAT] output = [GL_RED, GL_FLOAT]"
diff --git a/src/freedreno/ci/freedreno-a630-fails.txt b/src/freedreno/ci/freedreno-a630-fails.txt
index 109b702da45..f2671ee4486 100644
--- a/src/freedreno/ci/freedreno-a630-fails.txt
+++ b/src/freedreno/ci/freedreno-a630-fails.txt
@@ -1,8 +1,6 @@
 # New in VK-GL-CTS 1.2.7.0
 KHR-GL33.cull_distance.coverage,Fail
 
-KHR-GL33.packed_depth_stencil.verify_get_tex_image.depth24_stencil8,Fail
-KHR-GL33.packed_depth_stencil.verify_read_pixels.depth24_stencil8,Fail
 KHR-GL33.transform_feedback.capture_vertex_interleaved_test,Fail
 KHR-GL33.transform_feedback.capture_vertex_separate_test,Fail
 KHR-GL33.transform_feedback.discard_vertex_test,Fail
@@ -11,9 +9,6 @@ KHR-GL33.transform_feedback.draw_xfb_stream_instanced_test,Crash
 KHR-GL33.transform_feedback.query_vertex_interleaved_test,Fail
 KHR-GL33.transform_feedback.query_vertex_separate_test,Fail
 
-# "*** Color comparison failed"
-KHR-GLES3.packed_depth_stencil.verify_read_pixels.depth24_stencil8,Fail
-
 # Lots of errors like "[279] Check failed. Received: [3,0,0,2] instead of: [5,0,0,2]"
 KHR-GLES31.core.geometry_shader.layered_framebuffer.depth_support,Fail
 
diff --git a/src/gallium/drivers/freedreno/freedreno_draw.c b/src/gallium/drivers/freedreno/freedreno_draw.c
index baa5f2e5530..1a7b0580efa 100644
--- a/src/gallium/drivers/freedreno/freedreno_draw.c
+++ b/src/gallium/drivers/freedreno/freedreno_draw.c
@@ -69,6 +69,11 @@ batch_draw_tracking_for_dirty_bits(struct fd_batch *batch) assert_dt
       if (fd_depth_enabled(ctx)) {
          if (fd_resource(pfb->zsbuf->texture)->valid) {
             restore_buffers |= FD_BUFFER_DEPTH;
+            /* storing packed d/s depth also stores stencil, so we need
+             * the stencil restored too to avoid invalidating it.
+             */
+            if (pfb->zsbuf->texture->format == PIPE_FORMAT_Z24_UNORM_S8_UINT)
+               restore_buffers |= FD_BUFFER_STENCIL;
          } else {
             batch->invalidated |= FD_BUFFER_DEPTH;
          }
@@ -84,6 +89,11 @@ batch_draw_tracking_for_dirty_bits(struct fd_batch *batch) assert_dt
       if (fd_stencil_enabled(ctx)) {
          if (fd_resource(pfb->zsbuf->texture)->valid) {
             restore_buffers |= FD_BUFFER_STENCIL;
+            /* storing packed d/s stencil also stores depth, so we need
+             * the depth restored too to avoid invalidating it.
+             */
+            if (pfb->zsbuf->texture->format == PIPE_FORMAT_Z24_UNORM_S8_UINT)
+               restore_buffers |= FD_BUFFER_DEPTH;
          } else {
             batch->invalidated |= FD_BUFFER_STENCIL;
          }



More information about the mesa-commit mailing list