Mesa (staging/21.3): freedreno: Fix gmem invalidating the depth or stencil of packed d/s.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Nov 4 23:20:41 UTC 2021
Module: Mesa
Branch: staging/21.3
Commit: bb8f0c6a2e75c547295909e2595bd9b8889a068b
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=bb8f0c6a2e75c547295909e2595bd9b8889a068b
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>
(cherry picked from commit 29093bc42d20e95288cd306757e7efc928fdb366)
---
.pick_status.json | 2 +-
src/freedreno/ci/freedreno-a530-fails.txt | 1 -
src/freedreno/ci/freedreno-a630-fails.txt | 5 -----
src/gallium/drivers/freedreno/freedreno_draw.c | 10 ++++++++++
4 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/.pick_status.json b/.pick_status.json
index 4ac2c9a06ab..e439ce6311c 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -787,7 +787,7 @@
"description": "freedreno: Fix gmem invalidating the depth or stencil of packed d/s.",
"nominated": true,
"nomination_type": 0,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": null
},
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 362e0db3d3f..1ef238e0ff8 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
-
# "The values of resultStd[i] & 0xFFFFFFFE and resultFma[i] & 0xFFFFFFFE and resultCPU[i] & 0xFFFFFFFE are not bitwise equal for i = 0..99 "
KHR-GLES31.core.gpu_shader5.fma_precision_float,Fail
KHR-GLES31.core.gpu_shader5.fma_precision_vec2,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