Mesa (master): radv: Fix multiview queries.

Bas Nieuwenhuizen bnieuwenhuizen at kemper.freedesktop.org
Mon May 14 15:10:04 UTC 2018


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

Author: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Date:   Sun May 13 22:01:44 2018 +0200

radv: Fix multiview queries.

This moves the extra queries to after the main query ended, instead
of doing it after the begin and hence doing nesting.

We also emit only (view count - 1) extra queries, as the main query
is already there for the first view.

This fixes the CTS occasionally getting stuck in
dEQP-VK.multiview.queries* waiting on results.

Fixes: 32b4f3c38dc "radv/query: handle multiview queries properly. (v3)"
CC: 18.1 <mesa-stable at lists.freedesktop.org>

Reviewed-by: Dave Airlie <airlied at redhat.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>

---

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

diff --git a/src/amd/vulkan/radv_query.c b/src/amd/vulkan/radv_query.c
index 2b2e80f4e5..3749e2f43d 100644
--- a/src/amd/vulkan/radv_query.c
+++ b/src/amd/vulkan/radv_query.c
@@ -1204,25 +1204,6 @@ void radv_CmdBeginQuery(
 	va += pool->stride * query;
 
 	emit_begin_query(cmd_buffer, va, pool->type, flags);
-
-	/*
-	 * 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, flags);
-			emit_end_query(cmd_buffer, va, avail_va, pool->type);
-		}
-	}
 }
 
 
@@ -1241,6 +1222,26 @@ void radv_CmdEndQuery(
 	 * currently be active, which means the BO is already in the list.
 	 */
 	emit_end_query(cmd_buffer, va, avail_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 = 1; i < util_bitcount(cmd_buffer->state.subpass->view_mask); i++) {
+			va += pool->stride;
+			avail_va += 4;
+			emit_begin_query(cmd_buffer, va, pool->type, 0);
+			emit_end_query(cmd_buffer, va, avail_va, pool->type);
+		}
+	}
 }
 
 void radv_CmdWriteTimestamp(




More information about the mesa-commit mailing list