zink: break out transfer map destroy

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12422>
This commit is contained in:
Mike Blumenkrantz 2021-07-30 10:25:28 -04:00
parent 97545a0a1f
commit afa867b973

View file

@ -1051,6 +1051,19 @@ create_transfer(struct zink_context *ctx, struct pipe_resource *pres, unsigned u
return trans;
}
static void
destroy_transfer(struct zink_context *ctx, struct zink_transfer *trans)
{
if (trans->base.b.usage & PIPE_MAP_THREAD_SAFE) {
free(trans);
} else {
/* Don't use pool_transfers_unsync. We are always in the driver
* thread. Freeing an object into a different pool is allowed.
*/
slab_free(&ctx->transfer_pool, trans);
}
}
static void *
zink_buffer_map(struct pipe_context *pctx,
struct pipe_resource *pres,
@ -1372,14 +1385,7 @@ transfer_unmap(struct pipe_context *pctx, struct pipe_transfer *ptrans)
pipe_resource_reference(&trans->staging_res, NULL);
pipe_resource_reference(&trans->base.b.resource, NULL);
if (trans->base.b.usage & PIPE_MAP_THREAD_SAFE) {
free(trans);
} else {
/* Don't use pool_transfers_unsync. We are always in the driver
* thread. Freeing an object into a different pool is allowed.
*/
slab_free(&ctx->transfer_pool, ptrans);
}
destroy_transfer(ctx, trans);
}
static void