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: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35319>
(cherry picked from commit d8a6ec5985)
This commit is contained in:
Mike Blumenkrantz 2025-06-03 13:40:47 -04:00 committed by Eric Engestrom
parent 30631106c4
commit 99aa2c4ce5
2 changed files with 7 additions and 1 deletions

View file

@ -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

View file

@ -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));