Mesa (master): v3dv: don't wait for idle on occlusion query pool resets

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jan 19 11:03:46 UTC 2021


Module: Mesa
Branch: master
Commit: e122c9f3c88a3591a4f274d582a44ff662d9b3a2
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e122c9f3c88a3591a4f274d582a44ff662d9b3a2

Author: Iago Toral Quiroga <itoral at igalia.com>
Date:   Fri Dec 18 12:51:08 2020 +0100

v3dv: don't wait for idle on occlusion query pool resets

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 <apinheiro at igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8554>

---

 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;



More information about the mesa-commit mailing list