radeonsi: always wait for idle before get_query_result_resource
The shader busy-waits until the query results are written, but that only synchronizes for src. The destination buffer might also be used by previous shaders, so we should wait until all shaders are idle. This might fix some issues. The missing si_mark_atom_dirty fix should have no effect, but all flags changes should call it to be consistent. Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31193>
This commit is contained in:
@@ -347,8 +347,10 @@ static void gfx11_sh_query_get_result_resource(struct si_context *sctx, struct s
|
||||
grid.grid[2] = 1;
|
||||
|
||||
/* TODO: Range-invalidate GL2 */
|
||||
if (sctx->screen->info.cp_sdma_ge_use_system_memory_scope)
|
||||
if (sctx->screen->info.cp_sdma_ge_use_system_memory_scope) {
|
||||
sctx->flags |= SI_CONTEXT_INV_L2;
|
||||
si_mark_atom_dirty(sctx, &sctx->atoms.s.cache_flush);
|
||||
}
|
||||
|
||||
struct gfx11_sh_query_buffer *qbuf = query->first;
|
||||
for (;;) {
|
||||
@@ -393,7 +395,7 @@ static void gfx11_sh_query_get_result_resource(struct si_context *sctx, struct s
|
||||
/* ssbo[2] is either tmp_buffer or resource */
|
||||
assert(ssbo[2].buffer);
|
||||
|
||||
unsigned op_flags = SI_OP_SYNC_PS_BEFORE;
|
||||
unsigned op_flags = SI_OP_SYNC_BEFORE;
|
||||
unsigned writable_bitmask = (1 << 2) | (ssbo[1].buffer ? 1 << 1 : 0);
|
||||
|
||||
si_barrier_before_internal_op(sctx, op_flags, 3, ssbo, writable_bitmask, 0, NULL);
|
||||
|
||||
@@ -1647,7 +1647,7 @@ static void si_query_hw_get_result_resource(struct si_context *sctx, struct si_q
|
||||
|
||||
unsigned writable_bitmask = 0x4;
|
||||
|
||||
si_barrier_before_internal_op(sctx, 0, 3, ssbo, writable_bitmask, 0, NULL);
|
||||
si_barrier_before_internal_op(sctx, SI_OP_SYNC_BEFORE, 3, ssbo, writable_bitmask, 0, NULL);
|
||||
si_launch_grid_internal_ssbos(sctx, &grid, sctx->query_result_shader,
|
||||
0, 3, ssbo, writable_bitmask);
|
||||
si_barrier_after_internal_op(sctx, 0, 3, ssbo, writable_bitmask, 0, NULL);
|
||||
|
||||
Reference in New Issue
Block a user