From d8d30463ac3c094b243369761b70f21ff9c59ab9 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Wed, 19 Jan 2022 13:08:46 +0100 Subject: render/vulkan: log physical device driver name This can be useful to figure out why a required feature is missing, e.g. as in [1]. We check VK_EXT_physical_device_drm availability after printing the driver name. [1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3358 --- render/vulkan/vulkan.c | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) (limited to 'render/vulkan/vulkan.c') diff --git a/render/vulkan/vulkan.c b/render/vulkan/vulkan.c index 4932ec4d..7e9e9396 100644 --- a/render/vulkan/vulkan.c +++ b/render/vulkan/vulkan.c @@ -343,22 +343,40 @@ VkPhysicalDevice vulkan_find_drm_phdev(struct wlr_vk_instance *ini, int drm_fd) } const char *name = VK_EXT_PHYSICAL_DEVICE_DRM_EXTENSION_NAME; - if (find_extensions(avail_ext_props, avail_extc, &name, 1) != NULL) { - wlr_log(WLR_DEBUG, " Ignoring physical device \"%s\": " - "VK_EXT_physical_device_drm not supported", - phdev_props.deviceName); - continue; - } + bool has_drm_props = find_extensions(avail_ext_props, avail_extc, &name, 1) == NULL; + name = VK_KHR_DRIVER_PROPERTIES_EXTENSION_NAME; + bool has_driver_props = find_extensions(avail_ext_props, avail_extc, &name, 1) == NULL; + + VkPhysicalDeviceProperties2 props = {0}; + props.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2; VkPhysicalDeviceDrmPropertiesEXT drm_props = {0}; drm_props.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRM_PROPERTIES_EXT; + if (has_drm_props) { + drm_props.pNext = props.pNext; + props.pNext = &drm_props; + } - VkPhysicalDeviceProperties2 props = {0}; - props.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2; - props.pNext = &drm_props; + VkPhysicalDeviceDriverPropertiesKHR driver_props = {0}; + driver_props.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES; + if (has_driver_props) { + driver_props.pNext = props.pNext; + props.pNext = &driver_props; + } vkGetPhysicalDeviceProperties2(phdev, &props); + if (has_driver_props) { + wlr_log(WLR_INFO, " Driver name: %s (%s)", driver_props.driverName, driver_props.driverInfo); + } + + if (!has_drm_props) { + wlr_log(WLR_DEBUG, " Ignoring physical device \"%s\": " + "VK_EXT_physical_device_drm not supported", + phdev_props.deviceName); + continue; + } + dev_t primary_devid = makedev(drm_props.primaryMajor, drm_props.primaryMinor); dev_t render_devid = makedev(drm_props.renderMajor, drm_props.renderMinor); if (primary_devid == drm_stat.st_rdev || -- cgit v1.2.3