We were only dereferencing the resource in the PIPE_MAP_WRITE path of
agx_transfer_unmap, which means that read-only transfers leaked the
staging resource/BO. Always free the staging resource unconditionally.
Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20365>
agx_blit_from_staging(pctx, trans);
agx_flush_readers(agx_context(pctx), agx_resource(trans->staging.rsrc),
"GPU write staging blit");
- pipe_resource_reference(&trans->staging.rsrc, NULL);
} else if (trans->map && (transfer->usage & PIPE_MAP_WRITE)) {
assert(rsrc->modifier == DRM_FORMAT_MOD_APPLE_TWIDDLED);
/* Free the transfer */
free(trans->map);
+ pipe_resource_reference(&trans->staging.rsrc, NULL);
pipe_resource_reference(&transfer->resource, NULL);
FREE(transfer);
}