On Sun, Aug 30, 2015 at 10:11 PM, Marek Olšák <mar...@gmail.com> wrote: ... > diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c > b/src/gallium/drivers/radeonsi/si_state_draw.c > index 2ff58d1..81575b5 100644 > --- a/src/gallium/drivers/radeonsi/si_state_draw.c > +++ b/src/gallium/drivers/radeonsi/si_state_draw.c > @@ -729,7 +729,7 @@ void si_draw_vbo(struct pipe_context *ctx, const struct > pipe_draw_info *info) > { > struct si_context *sctx = (struct si_context *)ctx; > struct pipe_index_buffer ib = {}; > - unsigned i; > + unsigned mask; > > if (!info->count && !info->indirect && > (info->indexed || !info->count_from_stream_output)) > @@ -821,12 +821,13 @@ void si_draw_vbo(struct pipe_context *ctx, const struct > pipe_draw_info *info) > si_need_cs_space(sctx, 0, TRUE); > > /* Emit states. */ > - for (i = 0; i < SI_NUM_ATOMS; i++) { > - if (sctx->atoms.array[i]->dirty) { > - sctx->atoms.array[i]->emit(&sctx->b, > sctx->atoms.array[i]); > - sctx->atoms.array[i]->dirty = false; > - } > + mask = sctx->dirty_atoms; > + while (mask) { > + struct r600_atom *atom = sctx->atoms.array[u_bit_scan(&mask)]; > + > + atom->emit(&sctx->b, atom); > } > + sctx->dirty_atoms = 0;
It looks like sctx->atoms.array[i]->dirty is never cleared? Maybe we should get rid of it then? I wonder if multiple threads can end up touching the atoms? If so, we might need to use atomic bit set/clear (__sync_or_and_fetch(), etc) and something to read+clear sctx->dirty_atoms atomically above (xchg instruction, not sure which helper in mesa could be used for this). Gražvydas _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev