mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-26 17:10:11 +01:00
radv: fix race condition when getting the blit queue
Cc: mesa-stable Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/14439 Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38883>
This commit is contained in:
parent
31a24caad9
commit
a89118c5b0
3 changed files with 12 additions and 1 deletions
|
|
@ -1133,6 +1133,7 @@ radv_destroy_device(struct radv_device *device, const VkAllocationCallbacks *pAl
|
|||
simple_mtx_destroy(&device->trace_mtx);
|
||||
simple_mtx_destroy(&device->rt_handles_mtx);
|
||||
simple_mtx_destroy(&device->pso_cache_stats_mtx);
|
||||
simple_mtx_destroy(&device->blit_queue_mtx);
|
||||
|
||||
radv_destroy_shader_arenas(device);
|
||||
if (device->capture_replay_arena_vas)
|
||||
|
|
@ -1190,6 +1191,7 @@ radv_CreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCr
|
|||
simple_mtx_init(&device->pstate_mtx, mtx_plain);
|
||||
simple_mtx_init(&device->rt_handles_mtx, mtx_plain);
|
||||
simple_mtx_init(&device->pso_cache_stats_mtx, mtx_plain);
|
||||
simple_mtx_init(&device->blit_queue_mtx, mtx_plain);
|
||||
|
||||
device->rt_handles = _mesa_hash_table_create(NULL, _mesa_hash_u32, _mesa_key_u32_equal);
|
||||
|
||||
|
|
|
|||
|
|
@ -308,6 +308,8 @@ struct radv_device {
|
|||
simple_mtx_t pso_cache_stats_mtx;
|
||||
struct radv_pso_cache_stats pso_cache_stats[RADV_PIPELINE_TYPE_COUNT];
|
||||
|
||||
simple_mtx_t blit_queue_mtx;
|
||||
|
||||
struct radv_address_binding_tracker *addr_binding_tracker;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -41,8 +41,12 @@ radv_wsi_get_prime_blit_queue(VkDevice _device)
|
|||
struct radv_physical_device *pdev = radv_device_physical(device);
|
||||
const struct radv_instance *instance = radv_physical_device_instance(pdev);
|
||||
|
||||
if (device->private_sdma_queue != VK_NULL_HANDLE)
|
||||
simple_mtx_lock(&device->blit_queue_mtx);
|
||||
|
||||
if (device->private_sdma_queue != VK_NULL_HANDLE) {
|
||||
simple_mtx_unlock(&device->blit_queue_mtx);
|
||||
return &device->private_sdma_queue->vk;
|
||||
}
|
||||
|
||||
if (pdev->info.gfx_level >= GFX9 && !(instance->debug_flags & RADV_DEBUG_NO_DMA_BLIT)) {
|
||||
|
||||
|
|
@ -58,12 +62,15 @@ radv_wsi_get_prime_blit_queue(VkDevice _device)
|
|||
|
||||
VkResult result = radv_queue_init(device, device->private_sdma_queue, 0, &queue_create, NULL);
|
||||
if (result == VK_SUCCESS) {
|
||||
simple_mtx_unlock(&device->blit_queue_mtx);
|
||||
return &device->private_sdma_queue->vk;
|
||||
} else {
|
||||
vk_free(&device->vk.alloc, device->private_sdma_queue);
|
||||
device->private_sdma_queue = VK_NULL_HANDLE;
|
||||
}
|
||||
}
|
||||
|
||||
simple_mtx_unlock(&device->blit_queue_mtx);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue