zink: don't use set_foreach_remove with dmabuf_exports

foreach_remove cannot be used if the set ever has members deleted,
and this set may have deleted members

Fixes: 7b7a581a52 ("zink: prune dmabuf export tracking when adding resource binds")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28464>
(cherry picked from commit c2e0c2c67f)
This commit is contained in:
Mike Blumenkrantz 2024-03-18 09:28:13 -04:00 committed by Eric Engestrom
parent 1cc79c6d89
commit b21da22332
2 changed files with 3 additions and 2 deletions

View file

@ -4444,7 +4444,7 @@
"description": "zink: don't use set_foreach_remove with dmabuf_exports",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "7b7a581a52db21ed8826d6f2986ea6dfc208fb2a",
"notes": null

View file

@ -757,7 +757,7 @@ submit_queue(void *data, void *gdata, int thread_index)
unsigned i = 0;
VkSemaphore *sem = bs->signal_semaphores.data;
set_foreach_remove(&bs->dmabuf_exports, entry) {
set_foreach(&bs->dmabuf_exports, entry) {
struct zink_resource *res = (void*)entry->key;
for (; res; res = zink_resource(res->base.b.next))
zink_screen_import_dmabuf_semaphore(screen, res, sem[i++]);
@ -765,6 +765,7 @@ submit_queue(void *data, void *gdata, int thread_index)
struct pipe_resource *pres = (void*)entry->key;
pipe_resource_reference(&pres, NULL);
}
_mesa_set_clear(&bs->dmabuf_exports, NULL);
bs->usage.submit_count++;
end: