vulkan/drm-syncobj: Stop returning early waiting for sync files

In the WAIT_ALL case in spin_wait_for_sync_file(), we were returning the
moment we saw the first success.  However, this isn't a wait-all, it's a
bad wait-any.  We should instead just continue on to check the next sync
until we've ensured that every sync in the array has a sync file.  The
only reason this wasn't blowing up in our face is because it only
affects non-timeline drivers (pretty rare these days) and because most
of the places where we use WAIT_PENDING on non-timeline drivers is to
guard a sync file export and those typically have only a single sync in
the array.

Cc: mesa-stable
Reviewed-by: Gurchetan Singh <gurchetansingh@google.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38635>
(cherry picked from commit e4e619d685)
This commit is contained in:
Faith Ekstrand 2025-11-24 14:02:25 -05:00 committed by Eric Engestrom
parent 17f6c783c2
commit 4e1069e7a5
2 changed files with 4 additions and 1 deletions

View file

@ -3424,7 +3424,7 @@
"description": "vulkan/drm-syncobj: Stop returning early waiting for sync files",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -186,6 +186,9 @@ spin_wait_for_sync_file(struct vk_device *device,
for (uint32_t i = 0; i < wait_count; i++) {
while (1) {
VkResult result = sync_has_sync_file(device, waits[i].sync);
if (result == VK_SUCCESS)
break; /* Break out of the inner while */
if (result != VK_TIMEOUT)
return result;