From 880663c25ddb06310222c98464bd727e5a9eae22 Mon Sep 17 00:00:00 2001 From: Emma Anholt Date: Wed, 3 May 2023 14:10:09 -0700 Subject: [PATCH] nvk: Clean up redundant vendor checking for physical device creation. Part-of: --- src/nouveau/vulkan/nvk_physical_device.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/src/nouveau/vulkan/nvk_physical_device.c b/src/nouveau/vulkan/nvk_physical_device.c index e016f5e46a2..96e0fb3bd39 100644 --- a/src/nouveau/vulkan/nvk_physical_device.c +++ b/src/nouveau/vulkan/nvk_physical_device.c @@ -572,11 +572,12 @@ nvk_get_device_features(const struct nv_device_info *dev, }; } -static VkResult -nvk_physical_device_try_create(struct nvk_instance *instance, +VkResult +nvk_create_drm_physical_device(struct vk_instance *_instance, drmDevicePtr drm_device, - struct nvk_physical_device **device_out) + struct vk_physical_device **device_out) { + struct nvk_instance *instance = (struct nvk_instance *)_instance; VkResult result; if (!(drm_device->available_nodes & (1 << DRM_NODE_RENDER)) || @@ -666,7 +667,7 @@ nvk_physical_device_try_create(struct nvk_instance *instance, if (result != VK_SUCCESS) goto fail_init; - *device_out = device; + *device_out = &device->vk; return VK_SUCCESS; @@ -690,20 +691,6 @@ nvk_physical_device_destroy(struct vk_physical_device *vk_device) vk_free(&device->instance->vk.alloc, device); } -VkResult nvk_create_drm_physical_device(struct vk_instance *vk_instance, - struct _drmDevice *device, - struct vk_physical_device **out) -{ - if (!(device->available_nodes & (1 << DRM_NODE_RENDER)) || - device->bustype != DRM_BUS_PCI || - device->deviceinfo.pci->vendor_id != NVIDIA_VENDOR_ID) - return VK_ERROR_INCOMPATIBLE_DRIVER; - - return nvk_physical_device_try_create((struct nvk_instance *)vk_instance, - device, - (struct nvk_physical_device **)out); -} - VKAPI_ATTR void VKAPI_CALL nvk_GetPhysicalDeviceMemoryProperties2( VkPhysicalDevice physicalDevice,