From 16d8815c09e981a12edd48de2e8e45c2d3b67a97 Mon Sep 17 00:00:00 2001 From: Tatsuyuki Ishi Date: Sat, 27 May 2023 12:54:11 +0900 Subject: [PATCH] radv: Make shader related destruction happen before hw_ctx. radv_destroy_shader_upload_queue waits for a semaphore, which will in turn call query_reset_status on hw_ctx that will fail due to being already destroyed. Fix radv/amdgpu: amdgpu_cs_query_reset_state2 failed. (-9) spam in the logs with RADV_PERFTEST=dmashaders. Cc: mesa-stable Part-of: (cherry picked from commit 978d80fbe2ad83f8acdf6c9a3ae2486c10960c96) --- .pick_status.json | 2 +- src/amd/vulkan/radv_device.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 0d4914a2854..26065a21c24 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -2074,7 +2074,7 @@ "description": "radv: Make shader related destruction happen before hw_ctx.", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null }, diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 2b2b90e17c7..12c0c5dbaad 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -1166,6 +1166,12 @@ radv_DestroyDevice(VkDevice _device, const VkAllocationCallbacks *pAllocator) _mesa_hash_table_destroy(device->rt_handles, NULL); + radv_device_finish_meta(device); + + vk_pipeline_cache_destroy(device->mem_cache, NULL); + + radv_destroy_shader_upload_queue(device); + for (unsigned i = 0; i < RADV_NUM_HW_CTX; i++) { if (device->hw_ctx[i]) device->ws->ctx_destroy(device->hw_ctx[i]); @@ -1176,12 +1182,6 @@ radv_DestroyDevice(VkDevice _device, const VkAllocationCallbacks *pAllocator) simple_mtx_destroy(&device->trace_mtx); simple_mtx_destroy(&device->rt_handles_mtx); - radv_device_finish_meta(device); - - vk_pipeline_cache_destroy(device->mem_cache, NULL); - - radv_destroy_shader_upload_queue(device); - radv_trap_handler_finish(device); radv_finish_trace(device);