From d8a6ec59858522df925d5918696effe59a75f1c4 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 3 Jun 2025 13:40:47 -0400 Subject: [PATCH] lavapipe: undo fb remapping before poisoning memory at end of renderpass in a scenario like: * begin_rendering(cbuf1:store=DONTCARE, cbuf2) * draw * remap(cbuf2, NULL) * draw * end_rendering cbuf1 will be poisoned at the end of the renderpass, but the corresponding clear call to trigger the poisoning will not be able to detect that this texture is being written by an async fs, causing a write hazard unremapping the fb here ensures that all attachments are fb-referenced as expected in order to guarantee threads sync before memory is poisoned cc: mesa-stable Part-of: --- src/gallium/frontends/lavapipe/lvp_execute.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gallium/frontends/lavapipe/lvp_execute.c b/src/gallium/frontends/lavapipe/lvp_execute.c index 2cf6f90840d..8bd918d80e3 100644 --- a/src/gallium/frontends/lavapipe/lvp_execute.c +++ b/src/gallium/frontends/lavapipe/lvp_execute.c @@ -1771,6 +1771,12 @@ static void handle_end_rendering(struct vk_cmd_queue_entry *cmd, if (!state->poison_mem) return; + /* ensure that textures are correctly framebuffer-referenced in llvmpipe */ + if (state->fb_remapped) { + state->fb_remapped = false; + emit_fb_state(state); + } + union pipe_color_union color_clear_val; memset(color_clear_val.ui, rand() % UINT8_MAX, sizeof(color_clear_val.ui));