Usually, we postpone acquisition until a swapchain is created, but there are
some cases with display extensions (at least with EXT_acquire_drm_display)
where we need to acquire before a swapchain is ever created.
Fixes various tests in:
dEQP-VK.wsi.acquire_drm_display.*
Reviewed-by: Alejandro PiƱeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22283>
device->device_id = drm_render_device->deviceinfo.pci->device_id;
#endif
- if (instance->vk.enabled_extensions.KHR_display) {
+ if (instance->vk.enabled_extensions.KHR_display ||
+ instance->vk.enabled_extensions.EXT_acquire_drm_display) {
#if !using_v3d_simulator
/* Open the primary node on the vc4 display device */
assert(drm_primary_device);
{
V3DV_FROM_HANDLE(v3dv_physical_device, pdevice, _pdevice);
+ /* There are some instances with direct display extensions where this may be
+ * called before we have ever tried to create a swapchain, and therefore,
+ * before we have ever tried to acquire the display device, in which case we
+ * have to do it now.
+ */
+ if (unlikely(pdevice->display_fd < 0 && pdevice->master_fd >= 0)) {
+ VkResult result =
+ v3dv_physical_device_acquire_display(pdevice, NULL);
+ if (result != VK_SUCCESS)
+ return false;
+ }
+
return wsi_common_drm_devices_equal(fd, pdevice->display_fd);
}