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 29093bc42d)
This commit is contained in:
Emma Anholt 2021-11-03 09:19:42 -07:00 committed by Eric Engestrom
parent 4286b1ebed
commit 8b46e23ef2
4 changed files with 11 additions and 7 deletions

View file

@ -2119,7 +2119,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
},

View file

@ -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]"

View file

@ -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

View file

@ -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;
}