aboutsummaryrefslogtreecommitdiffstats
path: root/src/amd/vulkan/radv_debug.c
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2017-09-01 09:44:45 +0200
committerSamuel Pitoiset <[email protected]>2017-09-01 09:46:00 +0200
commit72d9ffc72cba5852ec09d2e8d1f55fdbbefcfe6f (patch)
tree9005ed08a700083e248f37228329fcc999ebc87c /src/amd/vulkan/radv_debug.c
parentf14020c15fee4dd640a9b1e501208479c74c28b0 (diff)
radv: add radv_check_gpu_hangs() helper function
Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src/amd/vulkan/radv_debug.c')
-rw-r--r--src/amd/vulkan/radv_debug.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/amd/vulkan/radv_debug.c b/src/amd/vulkan/radv_debug.c
index 9913c06ec23..4024f75da88 100644
--- a/src/amd/vulkan/radv_debug.c
+++ b/src/amd/vulkan/radv_debug.c
@@ -47,7 +47,7 @@ radv_init_trace(struct radv_device *device)
return true;
}
-void
+static void
radv_dump_trace(struct radv_device *device, struct radeon_winsys_cs *cs)
{
const char *filename = getenv("RADV_TRACE_FILE");
@@ -63,6 +63,30 @@ radv_dump_trace(struct radv_device *device, struct radeon_winsys_cs *cs)
fclose(f);
}
+static bool
+radv_gpu_hang_occured(struct radv_queue *queue)
+{
+ struct radeon_winsys *ws = queue->device->ws;
+ enum ring_type ring;
+
+ ring = radv_queue_family_to_ring(queue->queue_family_index);
+
+ if (!ws->ctx_wait_idle(queue->hw_ctx, ring, queue->queue_idx))
+ return true;
+
+ return false;
+}
+
+void
+radv_check_gpu_hangs(struct radv_queue *queue, struct radeon_winsys_cs *cs)
+{
+ if (!radv_gpu_hang_occured(queue))
+ return;
+
+ radv_dump_trace(queue->device, cs);
+ abort();
+}
+
void
radv_print_spirv(struct radv_shader_module *module, FILE *fp)
{