From 46c70b72ca14005e63eb43f86b9df7dd27c59ea0 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Sun, 21 Jan 2024 11:53:56 -0400 Subject: [PATCH] asahi: skip set if tested Signed-off-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/asahi/agx_state.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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); }