Skip to content

vulkan/wsi: Implement VK_KHR_present_wait and hide it behind driconf or enabled surface extensions

Hans-Kristian Arntzen requested to merge themaister/mesa:khr-present-wait into main

VK_KHR_present_wait is very useful, but we have not been able to expose it since there is no surface query for it. Until we have a per-surface query, we need to implement this in a more defensive way. For the time being, we have vk_khr_present_wait=true as a driconf to enable it. If the instance only enables specific surface extensions which are guaranteed to support present-wait, we can enable present-wait that way too.

Builds on work from !12086 from Keith, but I fixed various issues with it, especially deadlocks in Xorg implementation when using IMMEDIATE/MAILBOX, where we need a way to pump the X11 message queue while waiting, since there is no forward progress guarantee.

From the earlier MR, also fixes a subtle bug around WSI semaphore handling. A complete present implies that the semaphore has been unsignalled, which isn't necessarily guaranteed with implicit sync models. Our WSI just queues up a wait operation, but unless that is tied to a SYNC_FD dma-buf share, they are not directly correlated. The fix is to tie present ID to a timeline semaphore, and we can just wait for that.

Tested on Xorg/XWayland/Display on RADV/ANV.

This MR leaves the GOOGLE_display_timing alone for now since the present_wait use case is more pressing.

Edited by Hans-Kristian Arntzen

Merge request reports