From e122c9f3c88a3591a4f274d582a44ff662d9b3a2 Mon Sep 17 00:00:00 2001 From: Iago Toral Quiroga Date: Fri, 18 Dec 2020 12:51:08 +0100 Subject: [PATCH] v3dv: don't wait for idle on occlusion query pool resets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead, wait for the specific queries being reset to not be in use by the GPU. This takes query pool resets in the UE4 Shooter demo from 50-60ms down to 0.5-2ms. Reviewed-by: Alejandro PiƱeiro Part-of: --- src/broadcom/vulkan/v3dv_queue.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/broadcom/vulkan/v3dv_queue.c b/src/broadcom/vulkan/v3dv_queue.c index cc1b29b0768..fd54a24cdb0 100644 --- a/src/broadcom/vulkan/v3dv_queue.c +++ b/src/broadcom/vulkan/v3dv_queue.c @@ -153,6 +153,9 @@ v3dv_QueueWaitIdle(VkQueue _queue) static VkResult handle_reset_query_cpu_job(struct v3dv_job *job) { + struct v3dv_reset_query_cpu_job_info *info = &job->cpu.query_reset; + assert(info->pool); + /* We are about to reset query counters so we need to make sure that * The GPU is not using them. The exception is timestamp queries, since * we handle those in the CPU. @@ -160,21 +163,14 @@ handle_reset_query_cpu_job(struct v3dv_job *job) * FIXME: we could avoid blocking the main thread for this if we use * submission thread. */ - struct v3dv_reset_query_cpu_job_info *info = &job->cpu.query_reset; - assert(info->pool); - - if (info->pool->query_type == VK_QUERY_TYPE_OCCLUSION) { - VkResult result = gpu_queue_wait_idle(&job->device->queue); - if (result != VK_SUCCESS) - return result; - } - for (uint32_t i = info->first; i < info->first + info->count; i++) { assert(i < info->pool->query_count); struct v3dv_query *query = &info->pool->queries[i]; query->maybe_available = false; switch (info->pool->query_type) { case VK_QUERY_TYPE_OCCLUSION: { + const uint64_t infinite = 0xffffffffffffffffull; + v3dv_bo_wait(job->device, query->bo, infinite); uint32_t *counter = (uint32_t *) query->bo->map; *counter = 0; break;