diff options
author | Simon Ser <contact@emersion.fr> | 2022-01-19 13:08:46 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2022-01-19 13:08:46 +0100 |
commit | d8d30463ac3c094b243369761b70f21ff9c59ab9 (patch) | |
tree | c9130cc2da620157e1fb3df7f5b4a2f1afe58921 | |
parent | c22ea3eb9969de6cd141f280e14539d5c4b6bd3f (diff) |
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
-rw-r--r-- | render/vulkan/vulkan.c | 36 |
1 files changed, 27 insertions, 9 deletions
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 || |