diff --git a/src/gallium/drivers/asahi/agx_batch.c b/src/gallium/drivers/asahi/agx_batch.c index 3250c811135..2242f834827 100644 --- a/src/gallium/drivers/asahi/agx_batch.c +++ b/src/gallium/drivers/asahi/agx_batch.c @@ -210,10 +210,12 @@ agx_batch_cleanup(struct agx_context *ctx, struct agx_batch *batch, bool reset) if (writer == batch) { assert(bo->writer_syncobj == batch->syncobj); - bo->writer_syncobj = 0; agx_writer_remove(ctx, handle); } + if (bo->writer_syncobj == batch->syncobj) + bo->writer_syncobj = 0; + agx_bo_unreference(agx_lookup_bo(dev, handle)); } }