diff --git a/src/gallium/drivers/asahi/agx_state.h b/src/gallium/drivers/asahi/agx_state.h index 96bf1d8cfd5..19a90021a73 100644 --- a/src/gallium/drivers/asahi/agx_state.h +++ b/src/gallium/drivers/asahi/agx_state.h @@ -981,12 +981,13 @@ agx_batch_add_bo(struct agx_batch *batch, struct agx_bo *bo) batch->bo_list.word_count = word_count; } + if (BITSET_TEST(batch->bo_list.set, bo->handle)) + return; + /* The batch holds a single reference to each BO in the batch, released when * the batch finishes execution. */ - if (!BITSET_TEST(batch->bo_list.set, bo->handle)) - agx_bo_reference(bo); - + agx_bo_reference(bo); BITSET_SET(batch->bo_list.set, bo->handle); }