radeonsi/gfx10: fix issue with multiple overflow queries on the same context

In gfx10_sh_query_end a new query buffer is being allocated if there are pending
shader queries. However since emit_shader_query is called only once per draw
command, this newly allocated buffer is not used subsequently.
So even though this newly allocated buffer is treated as the last query buffer,
it is never actually used by any of the queries. Essentially there is no need
to allocate a new query buffer on the same context i.e. draw command.
The existing query buffer can be used to provide the answers to multiple queries.
Allocating an extra buffer makes subsequent queries wait on a query buffer whose
fence will never be triggered since there are no subsequent draw commands to
trigger the same.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8083>
This commit is contained in:
Indrajit Kumar Das 2020-12-14 16:08:21 +05:30 committed by Marge Bot
parent 0b3379c7be
commit 00c30420cb
1 changed files with 1 additions and 3 deletions

View File

@ -183,9 +183,7 @@ static bool gfx10_sh_query_end(struct si_context *sctx, struct si_query *rquery)
sctx->num_active_shader_queries--;
if (sctx->num_active_shader_queries > 0) {
gfx10_alloc_query_buffer(sctx);
} else {
if (sctx->num_active_shader_queries <= 0 || !si_is_atom_dirty(sctx, &sctx->atoms.s.shader_query)) {
si_set_rw_shader_buffer(sctx, GFX10_GS_QUERY_BUF, NULL);
sctx->current_vs_state &= C_VS_STATE_STREAMOUT_QUERY_ENABLED;