radv: fix a sync issue with primitives generated query and NGG/legacy

On RDNA1&2, the driver needs to support both NGG and legacy for
primitives generated query because we can't know that before starting
queries.

To get the query pool results, we check the availability bit wrote by
the SAMPLE_STREAMOUTSTATS packet but the GDS copy was emitted after,
which means the availability bit might be TRUE before the GDS copy is
actually done.

Fix this by emitting the GDS copy before to ensure the availability is
TRUE for both results.

This fixes recent updates in
dEQP-VK.transform_feedback.primitives_generated_query.* because the
tests no longer wait for the fence.

Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23080>
This commit is contained in:
Samuel Pitoiset
2023-05-17 15:55:12 +02:00
committed by Marge Bot
parent 177af45577
commit 9ba41ed70a
+4 -4
View File
@@ -1901,8 +1901,6 @@ emit_begin_query(struct radv_cmd_buffer *cmd_buffer, struct radv_query_pool *poo
cmd_buffer->state.active_prims_gen_queries++;
}
emit_sample_streamout(cmd_buffer, va, index);
if (pool->uses_gds) {
/* generated prim counter */
gfx10_copy_gds_query(cmd_buffer, RADV_NGG_QUERY_PRIM_GEN_OFFSET(index), va + 32);
@@ -1915,6 +1913,8 @@ emit_begin_query(struct radv_cmd_buffer *cmd_buffer, struct radv_query_pool *poo
cmd_buffer->state.active_prims_gen_gds_queries++;
}
emit_sample_streamout(cmd_buffer, va, index);
}
break;
}
@@ -2037,8 +2037,6 @@ emit_end_query(struct radv_cmd_buffer *cmd_buffer, struct radv_query_pool *pool,
cmd_buffer->state.active_prims_gen_queries--;
}
emit_sample_streamout(cmd_buffer, va + 16, index);
if (pool->uses_gds) {
/* generated prim counter */
gfx10_copy_gds_query(cmd_buffer, RADV_NGG_QUERY_PRIM_GEN_OFFSET(index), va + 36);
@@ -2048,6 +2046,8 @@ emit_end_query(struct radv_cmd_buffer *cmd_buffer, struct radv_query_pool *pool,
if (!cmd_buffer->state.active_prims_gen_gds_queries)
cmd_buffer->state.dirty |= RADV_CMD_DIRTY_NGG_QUERY;
}
emit_sample_streamout(cmd_buffer, va + 16, index);
}
break;
}