venus: filter out venus incapable physical devices

VK_KHR_external_memory_fd is required by Venus at the bare minimum for
all different ways to support the current venus guest memory mapping.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34830>
This commit is contained in:
Yiwei Zhang 2025-05-05 20:00:26 -07:00 committed by Marge Bot
parent 5abce52a67
commit 1895de16a6

View file

@ -1503,6 +1503,12 @@ vn_physical_device_init_renderer_extensions(
vk_free(alloc, exts);
/* VK_KHR_external_memory_fd is required for venus memory mapping */
if (!physical_dev->renderer_extensions.KHR_external_memory_fd) {
vk_free(alloc, physical_dev->extension_spec_versions);
return VK_ERROR_INCOMPATIBLE_DRIVER;
}
return VK_SUCCESS;
}
@ -1628,10 +1634,6 @@ vn_physical_device_init(struct vn_physical_device *physical_dev)
const VkAllocationCallbacks *alloc = &instance->base.vk.alloc;
VkResult result;
result = vn_physical_device_init_renderer_extensions(physical_dev);
if (result != VK_SUCCESS)
return result;
vn_physical_device_init_external_memory(physical_dev);
vn_physical_device_init_external_fence_handles(physical_dev);
vn_physical_device_init_external_semaphore_handles(physical_dev);
@ -1663,7 +1665,6 @@ vn_physical_device_init(struct vn_physical_device *physical_dev)
return VK_SUCCESS;
fail:
vk_free(alloc, physical_dev->extension_spec_versions);
vk_free(alloc, physical_dev->queue_family_properties);
return result;
}
@ -1877,6 +1878,12 @@ filter_physical_devices(struct vn_physical_device *physical_devs,
continue;
}
result = vn_physical_device_init_renderer_extensions(physical_dev);
if (result != VK_SUCCESS) {
vn_physical_device_base_fini(&physical_dev->base);
continue;
}
if (supported_count < i)
physical_devs[supported_count] = *physical_dev;
supported_count++;