From 99aa2c4ce57a031b0cad1e0a6bce425e251175f6 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: (cherry picked from commit d8a6ec59858522df925d5918696effe59a75f1c4) --- .pick_status.json | 2 +- src/gallium/frontends/lavapipe/lvp_execute.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index 6b7d9fb3e8e..30cb669a46e 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -544,7 +544,7 @@ "description": "lavapipe: undo fb remapping before poisoning memory at end of renderpass", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/gallium/frontends/lavapipe/lvp_execute.c b/src/gallium/frontends/lavapipe/lvp_execute.c index 42d2cefda63..23e3b86c785 100644 --- a/src/gallium/frontends/lavapipe/lvp_execute.c +++ b/src/gallium/frontends/lavapipe/lvp_execute.c @@ -1785,6 +1785,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));