Mesa (master): radeonsi: clear dirty_atoms and dirty_states only if we entered the emit loop
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Jan 20 22:13:28 UTC 2021
Module: Mesa
Branch: master
Commit: ae5df516f1ed0ce01ffdcbacb869aa1374d6b248
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ae5df516f1ed0ce01ffdcbacb869aa1374d6b248
Author: Marek Olšák <marek.olsak at amd.com>
Date: Sat Jan 9 19:48:54 2021 -0500
radeonsi: clear dirty_atoms and dirty_states only if we entered the emit loop
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8600>
---
src/gallium/drivers/radeonsi/si_state_draw.cpp | 28 ++++++++++++++++----------
1 file changed, 17 insertions(+), 11 deletions(-)
diff --git a/src/gallium/drivers/radeonsi/si_state_draw.cpp b/src/gallium/drivers/radeonsi/si_state_draw.cpp
index 685336755e6..181aa50ddc5 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.cpp
+++ b/src/gallium/drivers/radeonsi/si_state_draw.cpp
@@ -1484,24 +1484,30 @@ static void si_emit_all_states(struct si_context *sctx, const struct pipe_draw_i
/* Emit state atoms. */
unsigned mask = sctx->dirty_atoms & ~skip_atom_mask;
- while (mask)
- sctx->atoms.array[u_bit_scan(&mask)].emit(sctx);
+ if (mask) {
+ do {
+ sctx->atoms.array[u_bit_scan(&mask)].emit(sctx);
+ } while (mask);
- sctx->dirty_atoms &= skip_atom_mask;
+ sctx->dirty_atoms &= skip_atom_mask;
+ }
/* Emit states. */
mask = sctx->dirty_states;
- while (mask) {
- unsigned i = u_bit_scan(&mask);
- struct si_pm4_state *state = sctx->queued.array[i];
+ if (mask) {
+ do {
+ unsigned i = u_bit_scan(&mask);
+ struct si_pm4_state *state = sctx->queued.array[i];
- if (!state || sctx->emitted.array[i] == state)
- continue;
+ if (!state || sctx->emitted.array[i] == state)
+ continue;
+
+ si_pm4_emit(sctx, state);
+ sctx->emitted.array[i] = state;
+ } while (mask);
- si_pm4_emit(sctx, state);
- sctx->emitted.array[i] = state;
+ sctx->dirty_states = 0;
}
- sctx->dirty_states = 0;
/* Emit draw states. */
si_emit_vs_state<GFX_VERSION, HAS_TESS, HAS_GS, NGG>(sctx, info->index_size);
More information about the mesa-commit
mailing list