diff --git a/.pick_status.json b/.pick_status.json index f5be3d7c79d..2440526cb79 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -304,7 +304,7 @@ "description": "venus: handle device probing properly.", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/virtio/vulkan/vn_instance.c b/src/virtio/vulkan/vn_instance.c index 43f46cfaa28..239d7b93732 100644 --- a/src/virtio/vulkan/vn_instance.c +++ b/src/virtio/vulkan/vn_instance.c @@ -276,6 +276,7 @@ vn_CreateInstance(const VkInstanceCreateInfo *pCreateInfo, return vn_error(NULL, result); } + VkInstance instance_handle = vn_instance_to_handle(instance); /* ring_idx = 0 reserved for CPU timeline */ instance->ring_idx_used_mask = 0x1; @@ -294,6 +295,10 @@ vn_CreateInstance(const VkInstanceCreateInfo *pCreateInfo, } result = vn_instance_init_renderer(instance); + if (result == VK_ERROR_INITIALIZATION_FAILED) { + *pInstance = instance_handle; + return VK_SUCCESS; + } if (result != VK_SUCCESS) goto out_mtx_destroy; @@ -333,7 +338,6 @@ vn_CreateInstance(const VkInstanceCreateInfo *pCreateInfo, local_create_info.pApplicationInfo = &local_app_info; } - VkInstance instance_handle = vn_instance_to_handle(instance); result = vn_call_vkCreateInstance(instance->ring.ring, pCreateInfo, NULL, &instance_handle); if (result != VK_SUCCESS) @@ -407,16 +411,18 @@ vn_DestroyInstance(VkInstance _instance, mtx_destroy(&instance->physical_device.mutex); mtx_destroy(&instance->ring_idx_mutex); - vn_call_vkDestroyInstance(instance->ring.ring, _instance, NULL); + if (instance->renderer) { + vn_call_vkDestroyInstance(instance->ring.ring, _instance, NULL); - vn_instance_fini_ring(instance); + vn_instance_fini_ring(instance); - vn_renderer_shmem_pool_fini(instance->renderer, - &instance->reply_shmem_pool); + vn_renderer_shmem_pool_fini(instance->renderer, + &instance->reply_shmem_pool); - vn_renderer_shmem_pool_fini(instance->renderer, &instance->cs_shmem_pool); + vn_renderer_shmem_pool_fini(instance->renderer, &instance->cs_shmem_pool); - vn_renderer_destroy(instance->renderer, alloc); + vn_renderer_destroy(instance->renderer, alloc); + } driDestroyOptionCache(&instance->dri_options); driDestroyOptionInfo(&instance->available_dri_options); diff --git a/src/virtio/vulkan/vn_physical_device.c b/src/virtio/vulkan/vn_physical_device.c index 3022a79e7c0..6ef24a285d0 100644 --- a/src/virtio/vulkan/vn_physical_device.c +++ b/src/virtio/vulkan/vn_physical_device.c @@ -1500,6 +1500,10 @@ enumerate_physical_devices(struct vn_instance *instance, struct vn_physical_device *physical_devs = NULL; VkResult result; + if (!instance->renderer) { + *out_count = 0; + return VK_SUCCESS; + } uint32_t count = 0; result = vn_call_vkEnumeratePhysicalDevices( ring, vn_instance_to_handle(instance), &count, NULL);