v3dv: do a better job at cleaning up the device on init failure

These leaks on device creation failure have been there before, but
were only exposed as CTS failures after the recent event refactoring.

Partially fixes:
dEQP-VK.api.device_init.create_instance_device_intentional_alloc_fail.basic
dEQP-VK.api.object_management.alloc_callback_fail.device
dEQP-VK.api.object_management.alloc_callback_fail.device_group

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Eric Engestrom <eric@igalia.com>
cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19458>
(cherry picked from commit b78fd50e90)
This commit is contained in:
Iago Toral Quiroga
2022-11-02 08:50:24 +01:00
committed by Dylan Baker
parent 6c2e919156
commit 7f7586f87f
2 changed files with 4 additions and 1 deletions

View File

@@ -1948,7 +1948,7 @@
"description": "v3dv: do a better job at cleaning up the device on init failure",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null
},

View File

@@ -2016,6 +2016,9 @@ v3dv_CreateDevice(VkPhysicalDevice physicalDevice,
fail:
cnd_destroy(&device->query_ended);
mtx_destroy(&device->query_mutex);
queue_finish(&device->queue);
destroy_device_meta(device);
v3dv_pipeline_cache_finish(&device->default_pipeline_cache);
vk_device_finish(&device->vk);
vk_free(&device->vk.alloc, device);