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

Author: Indrajit Kumar Das <[email protected]>
Date:   Mon Dec 14 16:26:21 2020 +0530

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 <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8083>

---

 src/gallium/drivers/radeonsi/gfx10_query.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/gfx10_query.c 
b/src/gallium/drivers/radeonsi/gfx10_query.c
index a8ba299aca1..5bb4b827228 100644
--- a/src/gallium/drivers/radeonsi/gfx10_query.c
+++ b/src/gallium/drivers/radeonsi/gfx10_query.c
@@ -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;
 

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to