Module: Mesa Branch: staging/22.2 Commit: 7f79b1a010fcce200a48bc00a993b64a3c571f5a URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7f79b1a010fcce200a48bc00a993b64a3c571f5a
Author: Connor Abbott <[email protected]> Date: Thu Sep 1 14:30:20 2022 +0200 tu/lrz: Fix multiple subpass case with secondaries In dEQP-VK.renderpass.dedicated_allocation.attachment_allocation.input_output.94 we have the following: - There is more than one subpass, but only one depth attachment. - The first subpass doesn't use depth. - The subpass that does use depth has a draw call in a secondary. We wouldn't hit the case where there's more than one depth attachment, but because tu_begin_resumed_renderpass() only looked at the first subpass it wouldn't find the depth attachment and would leave LRZ invalid and thus a NULL LRZ fast-clear base. Then tu_begin_secondary_cmdbuf() would leave LRZ enabled and the draw would have LRZ enabled, leading to a hang. Fix this by making tu_begin_resumed_renderpass() match tu_begin_renderpass() with how it finds the depth attachment. Fixes: 4b5f0d98 ("tu: Overhaul LRZ, implement on-GPU dir tracking and LRZ fast-clear") Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18369> (cherry picked from commit bf09a5881b7d4fb7b11a7cc92513807ab00a7a47) --- .pick_status.json | 2 +- src/freedreno/vulkan/tu_lrz.c | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index f7bf18367ae..431ef05240e 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -6529,7 +6529,7 @@ "description": "tu/lrz: Fix multiple subpass case with secondaries", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "4b5f0d98fd57cbcd253b85291b7491aa5754a2eb" }, diff --git a/src/freedreno/vulkan/tu_lrz.c b/src/freedreno/vulkan/tu_lrz.c index 215a6777bb8..a60be23ab93 100644 --- a/src/freedreno/vulkan/tu_lrz.c +++ b/src/freedreno/vulkan/tu_lrz.c @@ -271,8 +271,14 @@ tu_lrz_begin_resumed_renderpass(struct tu_cmd_buffer *cmd, { /* Track LRZ valid state */ memset(&cmd->state.lrz, 0, sizeof(cmd->state.lrz)); - uint32_t a = cmd->state.subpass->depth_stencil_attachment.attachment; - if (a != VK_ATTACHMENT_UNUSED) { + + uint32_t a; + for (a = 0; a < cmd->state.pass->attachment_count; a++) { + if (cmd->state.attachments[a]->image->lrz_height) + break; + } + + if (a != cmd->state.pass->attachment_count) { const struct tu_render_pass_attachment *att = &cmd->state.pass->attachments[a]; tu_lrz_init_state(cmd, att, cmd->state.attachments[a]); if (att->clear_mask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT)) {
