From 336839bcd8b9c5bef48d2b1ebf10a05735b2e0ec Mon Sep 17 00:00:00 2001 From: Connor Abbott Date: Mon, 7 Jul 2025 18:56:22 -0400 Subject: [PATCH] tu: Don't leave tile store CS writeable A rebase problem meant that the hunk leaving the CS not writeable again was dropped. This isn't what was intended and caused a crash in the CS code. Because tu6_emit_gmem_stores() is now called inside a condition, we have to move the enable/disable outside of it because changing to a read-write buffer inside of a condition isn't currently supported. Fixes: ba9d0ba9a05 ("turnip: Emit tile stores at subpass end time.") Part-of: --- src/freedreno/vulkan/tu_cmd_buffer.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/freedreno/vulkan/tu_cmd_buffer.cc b/src/freedreno/vulkan/tu_cmd_buffer.cc index 6e669c67933..13f5429aa19 100644 --- a/src/freedreno/vulkan/tu_cmd_buffer.cc +++ b/src/freedreno/vulkan/tu_cmd_buffer.cc @@ -1477,9 +1477,6 @@ tu6_emit_gmem_stores(struct tu_cmd_buffer *cmd, (!cmd->state.rp.draw_cs_writes_to_cond_pred || cs != &cmd->draw_cs); - if (pass->has_fdm) - tu_cs_set_writeable(cs, true); - bool scissor_emitted = false; /* Resolve should happen before store in case BLIT_EVENT_STORE_AND_CLEAR is @@ -1521,6 +1518,9 @@ tu6_emit_tile_store_cs(struct tu_cmd_buffer *cmd, struct tu_cs *cs) uint32_t subpass_idx = pass->subpass_count - 1; const struct tu_subpass *subpass = &pass->subpasses[subpass_idx]; + if (pass->has_fdm) + tu_cs_set_writeable(cs, true); + /* We believe setting the marker affects what state HW blocks save/restore * during preemption. So we only emit it before the stores at the end of the * last subpass, not other resolves. @@ -1534,6 +1534,10 @@ tu6_emit_tile_store_cs(struct tu_cmd_buffer *cmd, struct tu_cs *cs) tu6_emit_gmem_stores(cmd, cs, &resolve_group, subpass); tu_emit_resolve_group(cmd, cs, &resolve_group); + + if (pass->has_fdm) + tu_cs_set_writeable(cs, false); + } void