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

Author: Dave Airlie <airl...@redhat.com>
Date:   Thu Mar 15 20:23:30 2018 +0000

radv/query: handle multiview queries properly. (v3)

For multiview we need to emit a number of sequential queries
depending on the view mask.

This avoids dEQP-VK.multiview.queries.15 waiting forever
on the CPU for query results that are never coming.

We only really want to emit one query,
and the rest should be blank (amdvlk does the same),
so we emit begin/end pairs for all the others except
the first query.

v2: fix tests
v3: split out patch.

Fixes: dEQP-VK.multiview.queries*
Reviewed-by: Samuel Pitoiset <samuel.pitoi...@gmail.com>

---

 src/amd/vulkan/radv_query.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/src/amd/vulkan/radv_query.c b/src/amd/vulkan/radv_query.c
index 5fae8b6565..7a20314f61 100644
--- a/src/amd/vulkan/radv_query.c
+++ b/src/amd/vulkan/radv_query.c
@@ -1178,6 +1178,25 @@ void radv_CmdBeginQuery(
        va += pool->stride * query;
 
        emit_begin_query(cmd_buffer, va, pool->type);
+
+       /*
+        * For multiview we have to emit a query for each bit in the mask,
+        * however the first query we emit will get the totals for all the
+        * operations, so we don't want to get a real value in the other
+        * queries. This emits a fake begin/end sequence so the waiting
+        * code gets a completed query value and doesn't hang, but the
+        * query returns 0.
+        */
+       if (cmd_buffer->state.subpass && cmd_buffer->state.subpass->view_mask) {
+               uint64_t avail_va = va + pool->availability_offset + 4 * query;
+
+               for (unsigned i = 0; i < 
util_bitcount(cmd_buffer->state.subpass->view_mask); i++) {
+                       va += pool->stride;
+                       avail_va += 4;
+                       emit_begin_query(cmd_buffer, va, pool->type);
+                       emit_end_query(cmd_buffer, va, avail_va, pool->type);
+               }
+       }
 }
 
 

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to