Skip to content

vulkan/wsi: Add common wrappers for most entrypoints

Faith Ekstrand requested to merge gfxstrand/mesa:review/vk-wsi-dispatch into main

For a long time, our Vulkan WSI code has acted as something of a layer. The WSI code calls into various Vulkan entrypoints inside the driver to create images, allocate memory, etc. It then implements the API-facing interface almost entirely. The only thing the driver has to provide is little wrappers that wrap around the WSI calls to expose them through the API.

However, now that we have a common dispatch framework, we can implement entrypoints directly in the WSI code. As long as the driver uses vk_instance, vk_physical_device, and vk_device, we can provide common wrappers for the vast majority of entrypoints. The only exceptions are vkAcquireNextImage, vkQueuePresent, vkRegisterDeviceEventEXT, and vkRegisterDisplayEventEXT because those may have to manually poke at synchronization primitives. We provide wrappers for vkAcquireNextImage and vkQueuePresent because some drivers can use the default versions.

For now, we're intentionally avoiding any link-time dependencies between WSI and the common code. We only use VK_FROM_HANDLE and associated inline helpers and vk_physical_device has a pointer to a wsi_device. Eventually, we may tie the two together closer, but this lets us get 95% of the way there without reworking the universe.

Merge request reports