From 663877e8943d074e6ac520a8312f221e6a45e629 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Thu, 9 Feb 2023 15:16:47 +0100 Subject: [PATCH] Revert "radv: acquire pstate on-demand when capturing with RGP" This change is wrong for two reasons: - it hangs most of the time maybe, because changing PSTATE when the application is running is broken somehow - it increases the time between triggering and generating the capture considerably, because there is a delay for changing PSTATE This restores previous logic where PSTATE is set to profile_peak at logical device creation. Though, it also re-introduces an issue with multiple logical devices (kernel returns -EBUSY) but this will be fixed in the next commit. This fixes GPU hangs when trying to record RGP captures on my NAVI21. Note that profile_peak is only required for some RDNA2 chips (including VanGogh). Cc: mesa-stable This reverts commit 923a864d94517462698c529bdc0e5c056d37b4e1. Part-of: --- src/amd/vulkan/layers/radv_sqtt_layer.c | 7 +------ src/amd/vulkan/radv_sqtt.c | 3 +++ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/amd/vulkan/layers/radv_sqtt_layer.c b/src/amd/vulkan/layers/radv_sqtt_layer.c index 079cce65b70..11775d66892 100644 --- a/src/amd/vulkan/layers/radv_sqtt_layer.c +++ b/src/amd/vulkan/layers/radv_sqtt_layer.c @@ -512,10 +512,6 @@ radv_handle_thread_trace(VkQueue _queue) radv_end_thread_trace(queue); thread_trace_enabled = false; - if (!radv_device_set_pstate(queue->device, false)) { - fprintf(stderr, "radv: Failed to restore previous pstate, ignoring.\n"); - } - /* TODO: Do something better than this whole sync. */ queue->device->vk.dispatch_table.QueueWaitIdle(_queue); @@ -551,8 +547,7 @@ radv_handle_thread_trace(VkQueue _queue) #endif if (frame_trigger || file_trigger || resize_trigger) { - if (!radv_device_set_pstate(queue->device, true) || - ac_check_profile_state(&queue->device->physical_device->rad_info)) { + if (ac_check_profile_state(&queue->device->physical_device->rad_info)) { fprintf(stderr, "radv: Canceling RGP trace request as a hang condition has been " "detected. Force the GPU into a profiling mode with e.g. " "\"echo profile_peak > " diff --git a/src/amd/vulkan/radv_sqtt.c b/src/amd/vulkan/radv_sqtt.c index 28298981701..270af5be507 100644 --- a/src/amd/vulkan/radv_sqtt.c +++ b/src/amd/vulkan/radv_sqtt.c @@ -526,6 +526,9 @@ radv_thread_trace_init(struct radv_device *device) if (!radv_thread_trace_init_bo(device)) return false; + if (!radv_device_acquire_performance_counters(device)) + return false; + list_inithead(&thread_trace_data->rgp_pso_correlation.record); simple_mtx_init(&thread_trace_data->rgp_pso_correlation.lock, mtx_plain);