Module: Mesa Branch: staging/22.0 Commit: 57fdbddadc3031f92c6412df30d7fe482f026735 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=57fdbddadc3031f92c6412df30d7fe482f026735
Author: Danylo Piliaiev <[email protected]> Date: Wed Mar 23 14:09:36 2022 +0200 turnip: Correctly store separate stencil in gmem store - When resolving d32s8 to s8 we stored stencil with a wrong format. - For unaligned multi-sample store we used wrong gmem offset for stencil. If unaligined store is forced this change fixes a hang in: dEQP-VK.renderpass2.depth_stencil_resolve.image_2d_32_32.samples_2.d32_sfloat_s8_uint_separate_layouts.compatibility_depth_zero_stencil_zero_testing_stencil Fixes: b157a5d0d68ee8a1b4cb862a56b97bd881841413 ("tu: Implement non-aligned multisample GMEM STORE_OP_STORE") Signed-off-by: Danylo Piliaiev <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15532> (cherry picked from commit 72716993b2e0db9a6bbf1543d435cd2f7489961e) --- .pick_status.json | 2 +- src/freedreno/vulkan/tu_clear_blit.c | 25 ++++++++++++++----------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index f34a4a97223..0c8b2148015 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -68,7 +68,7 @@ "description": "turnip: Correctly store separate stencil in gmem store", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "because_sha": "b157a5d0d68ee8a1b4cb862a56b97bd881841413" }, { diff --git a/src/freedreno/vulkan/tu_clear_blit.c b/src/freedreno/vulkan/tu_clear_blit.c index ebaefcd9c50..7aa9540a4af 100644 --- a/src/freedreno/vulkan/tu_clear_blit.c +++ b/src/freedreno/vulkan/tu_clear_blit.c @@ -2876,13 +2876,16 @@ tu_store_gmem_attachment(struct tu_cmd_buffer *cmd, src->format == VK_FORMAT_D32_SFLOAT_S8_UINT && dst->format == VK_FORMAT_S8_UINT; + bool store_common = dst->store && !resolve_d32s8_s8; + bool store_separate_stencil = dst->store_stencil || resolve_d32s8_s8; + trace_start_gmem_store(&cmd->trace, cs); /* use fast path when render area is aligned, except for unsupported resolve cases */ if (!unaligned && (a == gmem_a || blit_can_resolve(dst->format))) { - if (dst->store) - tu_emit_blit(cmd, cs, iview, src, true, resolve_d32s8_s8); - if (dst->store_stencil) + if (store_common) + tu_emit_blit(cmd, cs, iview, src, true, false); + if (store_separate_stencil) tu_emit_blit(cmd, cs, iview, src, true, true); trace_end_gmem_store(&cmd->trace, cs, dst->format, true, false); @@ -2901,25 +2904,25 @@ tu_store_gmem_attachment(struct tu_cmd_buffer *cmd, * TODO: store a flag somewhere so we don't do this more than once and * don't do it after the renderpass when this happens. */ - if (dst->store || dst->store_stencil) + if (store_common || store_separate_stencil) tu_disable_draw_states(cmd, cs); - if (dst->store) { - store_3d_blit(cmd, cs, iview, dst->samples, resolve_d32s8_s8, format, + if (store_common) { + store_3d_blit(cmd, cs, iview, dst->samples, false, format, render_area, src->gmem_offset, src->cpp); } - if (dst->store_stencil) { + if (store_separate_stencil) { store_3d_blit(cmd, cs, iview, dst->samples, true, PIPE_FORMAT_S8_UINT, - render_area, src->gmem_offset, src->samples); + render_area, src->gmem_offset_stencil, src->samples); } } else { r2d_coords(cs, &render_area->offset, &render_area->offset, &render_area->extent); - if (dst->store) { - store_cp_blit(cmd, cs, iview, src->samples, resolve_d32s8_s8, format, + if (store_common) { + store_cp_blit(cmd, cs, iview, src->samples, false, format, src->gmem_offset, src->cpp); } - if (dst->store_stencil) { + if (store_separate_stencil) { store_cp_blit(cmd, cs, iview, src->samples, true, PIPE_FORMAT_S8_UINT, src->gmem_offset_stencil, src->samples); }
