From 55776a0ae0660d730293f11b435dc055753774fd Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Fri, 10 Jul 2020 14:45:19 +0200 Subject: [PATCH] radv: return VK_ERROR_DEVICE_LOST if wait-for-idle failed or expired When ctx_wait_idle failed, something really bad happened likely a GPU hang. Make sure to return the appropriate Vulkan error code in this case. Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhuizen Part-of: --- src/amd/vulkan/radv_device.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 7a67f31fef7..58299a0e0e4 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -5024,9 +5024,11 @@ VkResult radv_QueueWaitIdle( } pthread_mutex_unlock(&queue->pending_mutex); - queue->device->ws->ctx_wait_idle(queue->hw_ctx, - radv_queue_family_to_ring(queue->queue_family_index), - queue->queue_idx); + if (!queue->device->ws->ctx_wait_idle(queue->hw_ctx, + radv_queue_family_to_ring(queue->queue_family_index), + queue->queue_idx)) + return VK_ERROR_DEVICE_LOST; + return VK_SUCCESS; } @@ -5037,7 +5039,11 @@ VkResult radv_DeviceWaitIdle( for (unsigned i = 0; i < RADV_MAX_QUEUE_FAMILIES; i++) { for (unsigned q = 0; q < device->queue_count[i]; q++) { - radv_QueueWaitIdle(radv_queue_to_handle(&device->queues[i][q])); + VkResult result = + radv_QueueWaitIdle(radv_queue_to_handle(&device->queues[i][q])); + + if (result != VK_SUCCESS) + return result; } } return VK_SUCCESS; -- 2.30.2