freedreno: Add transfer_pool_unsync

With threaded_context, in the TC_TRANSFER_MAP_UNSYNC case, we are
getting called from the frontend thread, rather than driver thread.
So we need a different slab_child_pool for that.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9323>
This commit is contained in:
Rob Clark 2021-03-04 12:43:51 -08:00 committed by Marge Bot
parent 0c163e0a45
commit acc2c015b3
3 changed files with 12 additions and 1 deletions

View file

@ -325,6 +325,7 @@ fd_context_destroy(struct pipe_context *pctx)
util_primconvert_destroy(ctx->primconvert);
slab_destroy_child(&ctx->transfer_pool);
slab_destroy_child(&ctx->transfer_pool_unsync);
for (i = 0; i < ARRAY_SIZE(ctx->vsc_pipe_bo); i++) {
if (!ctx->vsc_pipe_bo[i])
@ -577,6 +578,7 @@ fd_context_init(struct fd_context *ctx, struct pipe_screen *pscreen,
pctx->const_uploader = pctx->stream_uploader;
slab_create_child(&ctx->transfer_pool, &screen->transfer_pool);
slab_create_child(&ctx->transfer_pool_unsync, &screen->transfer_pool);
fd_draw_init(pctx);
fd_resource_context_init(pctx);

View file

@ -204,6 +204,7 @@ struct fd_context {
/* slab for pipe_transfer allocations: */
struct slab_child_pool transfer_pool dt;
struct slab_child_pool transfer_pool_unsync; /* for threaded_context */
/**
* query related state:

View file

@ -667,6 +667,9 @@ fd_resource_transfer_unmap(struct pipe_context *pctx,
assert(trans->b.staging == NULL); /* for threaded context only */
/* 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);
}
@ -928,7 +931,12 @@ fd_resource_transfer_map(struct pipe_context *pctx,
return NULL;
}
ptrans = slab_alloc(&ctx->transfer_pool);
if (usage & TC_TRANSFER_MAP_THREADED_UNSYNC) {
ptrans = slab_alloc(&ctx->transfer_pool_unsync);
} else {
ptrans = slab_alloc(&ctx->transfer_pool);
}
if (!ptrans)
return NULL;