From 1aaf4bf40a53e8e382ba14b2470f160afd78b6cc Mon Sep 17 00:00:00 2001 From: Asahi Lina Date: Wed, 3 May 2023 15:41:37 +0900 Subject: [PATCH] asahi: Fix batch writer_syncobj cleanup When an ACTIVE batch takes over the active writer role from a SUBMITTED batch, the written BO has the syncobj from the latter even though the writer is the former. This is correct and an intended state, but it means that then we can't gate the syncobj cleanup in agx_batch_cleanup on being the active writer, since the SUBMITTED batch won't be. Fixes: asahi/mesa#18 Signed-off-by: Asahi Lina Part-of: --- src/gallium/drivers/asahi/agx_batch.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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)); } }