vulkan/wsi/headless: implement wait_for_present for swapchain
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

The VK_KHR_present_wait extension contains no functionality to announce
(the lack of) support for vkWaitForPresentKHR() on a WSI (or WSI-bound
object) granularity.

On any driver advertising that extension and the headless WSI, the
application will expect vkWaitForPresentKHR() to be usable with the
headless WSI, which leads to assertion failure in debug Mesa builds or
crash in release builds.

Create a trivial wait_for_present implementation for the headless WSI,
which just assumes the image is immediately presented at the time of
queue_present is called, so it only checks the WSI present semaphore.

Tested with `dEQP-VK.wsi.headless.present_id_wait.wait.*` on RADV
without any failures.

Signed-off-by: Icenowy Zheng <zhengxingda@iscas.ac.cn>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40347>
This commit is contained in:
Icenowy Zheng 2026-03-11 22:57:13 +08:00 committed by Marge Bot
parent 2f540283b3
commit ea783b4691

View file

@ -401,6 +401,15 @@ wsi_headless_swapchain_queue_present(struct wsi_swapchain *wsi_chain,
return VK_SUCCESS;
}
static VkResult
wsi_headless_swapchain_wait_for_present(struct wsi_swapchain *wsi_chain,
uint64_t waitValue,
uint64_t timeout)
{
return wsi_swapchain_wait_for_present_semaphore(
wsi_chain, waitValue, timeout);
}
static VkResult
wsi_headless_swapchain_destroy(struct wsi_swapchain *wsi_chain,
const VkAllocationCallbacks *pAllocator)
@ -499,6 +508,7 @@ wsi_headless_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
chain->base.acquire_next_image = wsi_headless_swapchain_acquire_next_image;
chain->base.release_images = wsi_headless_swapchain_release_images;
chain->base.queue_present = wsi_headless_swapchain_queue_present;
chain->base.wait_for_present = wsi_headless_swapchain_wait_for_present;
chain->base.present_mode = wsi_swapchain_get_present_mode(wsi_device, pCreateInfo);
chain->base.image_count = num_images;