vk/runtime: Allow enumerate and try_create_for_drm to coexist

For drivers that can support both drm and non-drm kernel mode drivers it
is useful to be able to provide both entrypoints.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21394>
This commit is contained in:
Rob Clark 2023-02-16 11:24:00 -08:00 committed by Marge Bot
parent 08ba87481b
commit 73dfcbf7e8
2 changed files with 6 additions and 3 deletions

View file

@ -239,7 +239,7 @@ tu_enumerate_devices(struct vk_instance *vk_instance)
fd = open(path, O_RDWR | O_CLOEXEC);
if (fd < 0) {
if (errno == ENOENT)
return VK_SUCCESS;
return VK_ERROR_INCOMPATIBLE_DRIVER;
return vk_errorf(instance, VK_ERROR_INITIALIZATION_FAILED,
"failed to open device %s", path);

View file

@ -396,8 +396,11 @@ enumerate_drm_physical_devices_locked(struct vk_instance *instance)
static VkResult
enumerate_physical_devices_locked(struct vk_instance *instance)
{
if (instance->physical_devices.enumerate)
return instance->physical_devices.enumerate(instance);
if (instance->physical_devices.enumerate) {
VkResult result = instance->physical_devices.enumerate(instance);
if (result != VK_ERROR_INCOMPATIBLE_DRIVER)
return result;
}
VkResult result = VK_SUCCESS;