vulkan: Make sure we've loaded our connectors when querying plane props.

If you hadn't already called wsi_GetPhysicalDeviceDisplayProperties2KHR or
wsi_GetDrmDisplayEXT before calling
GetPhysicalDeviceDisplayPlaneProperties2KHR, then the connectors list
wouldn't be populated and you'd get no plane properties.  Fixes failure of
dEQP-VK.wsi.display.get_display_plane_capabilities when run on its own.

Fixes: #4575
Cc: mesa-stable
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15353>
This commit is contained in:
Emma Anholt 2022-03-11 13:55:52 -08:00 committed by Marge Bot
parent 83de19c900
commit da834a12cf
2 changed files with 53 additions and 24 deletions

View File

@ -6,9 +6,6 @@
# reliable to be run in parallel with other tests due to CPU-side timing.
dEQP-GLES[0-9]*.functional.flush_finish.*
# https://gitlab.freedesktop.org/mesa/mesa/-/issues/4575
dEQP-VK.wsi.display.get_display_plane_capabilities
# piglit: WGL is Windows-only
wgl@.*

View File

@ -480,6 +480,37 @@ wsi_GetPhysicalDeviceDisplayPropertiesKHR(VkPhysicalDevice physicalDevice,
}
}
static VkResult
wsi_get_connectors(VkPhysicalDevice physicalDevice)
{
VK_FROM_HANDLE(vk_physical_device, pdevice, physicalDevice);
struct wsi_device *wsi_device = pdevice->wsi_device;
struct wsi_display *wsi =
(struct wsi_display *) wsi_device->wsi[VK_ICD_WSI_PLATFORM_DISPLAY];
if (wsi->fd < 0)
return VK_SUCCESS;
drmModeResPtr mode_res = drmModeGetResources(wsi->fd);
if (!mode_res)
return VK_ERROR_OUT_OF_HOST_MEMORY;
/* Get current information */
for (int c = 0; c < mode_res->count_connectors; c++) {
struct wsi_display_connector *connector =
wsi_display_get_connector(wsi_device, wsi->fd,
mode_res->connectors[c]);
if (!connector) {
drmModeFreeResources(mode_res);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
drmModeFreeResources(mode_res);
return VK_SUCCESS;
}
VKAPI_ATTR VkResult VKAPI_CALL
wsi_GetPhysicalDeviceDisplayProperties2KHR(VkPhysicalDevice physicalDevice,
uint32_t *pPropertyCount,
@ -490,28 +521,14 @@ wsi_GetPhysicalDeviceDisplayProperties2KHR(VkPhysicalDevice physicalDevice,
struct wsi_display *wsi =
(struct wsi_display *) wsi_device->wsi[VK_ICD_WSI_PLATFORM_DISPLAY];
if (wsi->fd < 0)
goto bail;
drmModeResPtr mode_res = drmModeGetResources(wsi->fd);
if (!mode_res)
/* Get current information */
VkResult result = wsi_get_connectors(physicalDevice);
if (result != VK_SUCCESS)
goto bail;
VK_OUTARRAY_MAKE(conn, pProperties, pPropertyCount);
/* Get current information */
for (int c = 0; c < mode_res->count_connectors; c++) {
struct wsi_display_connector *connector =
wsi_display_get_connector(wsi_device, wsi->fd,
mode_res->connectors[c]);
if (!connector) {
drmModeFreeResources(mode_res);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
wsi_for_each_connector(connector, wsi) {
if (connector->connected) {
vk_outarray_append(&conn, prop) {
wsi_display_fill_in_display_properties(wsi_device,
@ -521,13 +538,11 @@ wsi_GetPhysicalDeviceDisplayProperties2KHR(VkPhysicalDevice physicalDevice,
}
}
drmModeFreeResources(mode_res);
return vk_outarray_status(&conn);
bail:
*pPropertyCount = 0;
return VK_SUCCESS;
return result;
}
/*
@ -561,6 +576,10 @@ wsi_GetPhysicalDeviceDisplayPlanePropertiesKHR(VkPhysicalDevice physicalDevice,
struct wsi_display *wsi =
(struct wsi_display *) wsi_device->wsi[VK_ICD_WSI_PLATFORM_DISPLAY];
VkResult result = wsi_get_connectors(physicalDevice);
if (result != VK_SUCCESS)
goto bail;
VK_OUTARRAY_MAKE(conn, pProperties, pPropertyCount);
wsi_for_each_connector(connector, wsi) {
@ -574,6 +593,10 @@ wsi_GetPhysicalDeviceDisplayPlanePropertiesKHR(VkPhysicalDevice physicalDevice,
}
}
return vk_outarray_status(&conn);
bail:
*pPropertyCount = 0;
return result;
}
VKAPI_ATTR VkResult VKAPI_CALL
@ -586,6 +609,11 @@ wsi_GetPhysicalDeviceDisplayPlaneProperties2KHR(VkPhysicalDevice physicalDevice,
struct wsi_display *wsi =
(struct wsi_display *) wsi_device->wsi[VK_ICD_WSI_PLATFORM_DISPLAY];
/* Get current information */
VkResult result = wsi_get_connectors(physicalDevice);
if (result != VK_SUCCESS)
goto bail;
VK_OUTARRAY_MAKE(conn, pProperties, pPropertyCount);
wsi_for_each_connector(connector, wsi) {
@ -595,6 +623,10 @@ wsi_GetPhysicalDeviceDisplayPlaneProperties2KHR(VkPhysicalDevice physicalDevice,
}
}
return vk_outarray_status(&conn);
bail:
*pPropertyCount = 0;
return result;
}
/*