radv: report a better error message when QueueWaitIdle() failed
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 7 Aug 2020 15:18:41 +0000 (17:18 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 10 Aug 2020 12:09:23 +0000 (14:09 +0200)
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6230>

src/amd/vulkan/radv_device.c

index 00df3a97dd6368ae6269f3ce7f75a9b707d1fbad..799f291f0aeed67a03cc50b040b53383dcb947a8 100644 (file)
@@ -4749,6 +4749,21 @@ VkResult radv_QueueSubmit(
        return VK_SUCCESS;
 }
 
+static const char *
+radv_get_queue_family_name(struct radv_queue *queue)
+{
+       switch (queue->queue_family_index) {
+       case RADV_QUEUE_GENERAL:
+               return "graphics";
+       case RADV_QUEUE_COMPUTE:
+               return "compute";
+       case RADV_QUEUE_TRANSFER:
+               return "transfer";
+       default:
+               unreachable("Unknown queue family");
+       }
+}
+
 VkResult radv_QueueWaitIdle(
        VkQueue                                     _queue)
 {
@@ -4762,8 +4777,11 @@ VkResult radv_QueueWaitIdle(
 
        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;
+                                             queue->queue_idx)) {
+               return vk_errorf(queue->device->instance, VK_ERROR_DEVICE_LOST,
+                                "Failed to wait for a '%s' queue to be idle. "
+                                "GPU hang ?", radv_get_queue_family_name(queue));
+       }
 
        return VK_SUCCESS;
 }