From 8e7df8ab3776d3042874abf5ef3f1028a9858e91 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Timur=20Krist=C3=B3f?= Date: Mon, 24 Apr 2023 17:13:38 +0200 Subject: [PATCH] radv: Move perf counter CS creation to where it's used. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Timur Kristóf Reviewed-by: Bas Nieuwenhuizen Part-of: --- src/amd/vulkan/radv_queue.c | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/src/amd/vulkan/radv_queue.c b/src/amd/vulkan/radv_queue.c index 935cfe0..16eea34 100644 --- a/src/amd/vulkan/radv_queue.c +++ b/src/amd/vulkan/radv_queue.c @@ -1620,25 +1620,6 @@ radv_queue_submit_normal(struct radv_queue *queue, struct vk_queue_submit *submi wait_count += 1; } - struct radeon_cmdbuf *perf_ctr_lock_cs = NULL; - struct radeon_cmdbuf *perf_ctr_unlock_cs = NULL; - - if (use_perf_counters) { - /* Create the lock/unlock CS. */ - perf_ctr_lock_cs = - radv_create_perf_counter_lock_cs(queue->device, submission->perf_pass_index, false); - perf_ctr_unlock_cs = - radv_create_perf_counter_lock_cs(queue->device, submission->perf_pass_index, true); - - /* RADV only supports perf counters on the GFX queue currently. */ - assert(radv_queue_ring(queue) == AMD_IP_GFX); - - if (!perf_ctr_lock_cs || !perf_ctr_unlock_cs) { - result = VK_ERROR_OUT_OF_HOST_MEMORY; - goto fail; - } - } - /* For fences on the same queue/vm amdgpu doesn't wait till all processing is finished * before starting the next cmdbuffer, so we need to do it here. */ @@ -1657,6 +1638,20 @@ radv_queue_submit_normal(struct radv_queue *queue, struct vk_queue_submit *submi continue_preambles[num_continue_preambles++] = queue->state.continue_preamble_cs; if (use_perf_counters) { + /* RADV only supports perf counters on the GFX queue currently. */ + assert(queue->state.qf == RADV_QUEUE_GENERAL); + + /* Create the lock/unlock CS. */ + struct radeon_cmdbuf *perf_ctr_lock_cs = + radv_create_perf_counter_lock_cs(queue->device, submission->perf_pass_index, false); + struct radeon_cmdbuf *perf_ctr_unlock_cs = + radv_create_perf_counter_lock_cs(queue->device, submission->perf_pass_index, true); + + if (!perf_ctr_lock_cs || !perf_ctr_unlock_cs) { + result = VK_ERROR_OUT_OF_HOST_MEMORY; + goto fail; + } + initial_preambles[num_initial_preambles++] = perf_ctr_lock_cs; continue_preambles[num_continue_preambles++] = perf_ctr_lock_cs; postambles[num_postambles++] = perf_ctr_unlock_cs; -- 2.7.4