panfrost_batch_add_bo(batch, ctx->scratchpad);
panfrost_batch_add_bo(batch, ctx->tiler_heap);
- panfrost_batch_add_bo(batch, batch->polygon_list);
if (batch->first_job.gpu) {
ret = panfrost_drm_submit_batch(batch, batch->first_job.gpu, 0);
panfrost_bo_unreference(ctx->base.screen, bo);
}
- /* Unreference the polygon list */
- panfrost_bo_unreference(ctx->base.screen, batch->polygon_list);
-
_mesa_hash_table_remove_key(ctx->batches, &batch->key);
if (ctx->batch == batch)
batch->polygon_list = panfrost_drm_create_bo(screen,
size, PAN_ALLOCATE_INVISIBLE);
+ panfrost_batch_add_bo(batch, batch->polygon_list);
+
+ /* A BO reference has been retained by panfrost_batch_add_bo(),
+ * so we need to unreference it here if we want the BO to be
+ * automatically released when the batch is destroyed.
+ */
+ panfrost_bo_unreference(&screen->base, batch->polygon_list);
}
return batch->polygon_list->gpu;