From 4e1069e7a5745adb8cd81ad22005c1bd527c63f0 Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Mon, 24 Nov 2025 14:02:25 -0500 Subject: [PATCH] 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 Reviewed-by: Emma Anholt Part-of: (cherry picked from commit e4e619d68532c882e6d1ececb8b4a6d3e5a48b0d) --- .pick_status.json | 2 +- src/vulkan/runtime/vk_drm_syncobj.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index 4be6425a390..9b612f8d1fa 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -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 diff --git a/src/vulkan/runtime/vk_drm_syncobj.c b/src/vulkan/runtime/vk_drm_syncobj.c index d0fd0309670..d1219731c5c 100644 --- a/src/vulkan/runtime/vk_drm_syncobj.c +++ b/src/vulkan/runtime/vk_drm_syncobj.c @@ -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;