panfrost: Pass a memory pool to pan_blit_ctx_init()
Pass a memory pool to pan_blit_ctx_init() instead of creating a new pool. Useful for Vulkan since the descriptor pool is at the command buffer level and is thus shared by all blit batches. Doing this will save us a BO ownership transfer. Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11695>
This commit is contained in:
committed by
Marge Bot
parent
3cdbc1e8c0
commit
dea0c4ddd8
@@ -89,9 +89,9 @@ panfrost_u_blitter_blit(struct pipe_context *pipe,
|
||||
|
||||
static void
|
||||
panfrost_blit_add_ctx_bos(struct panfrost_batch *batch,
|
||||
struct pan_blit_context *ctx)
|
||||
struct pan_pool *blit_pool)
|
||||
{
|
||||
util_dynarray_foreach(&ctx->pool.bos, struct panfrost_bo *, bo) {
|
||||
util_dynarray_foreach(&blit_pool->bos, struct panfrost_bo *, bo) {
|
||||
panfrost_batch_add_bo(batch, *bo,
|
||||
PAN_BO_ACCESS_SHARED |
|
||||
PAN_BO_ACCESS_READ |
|
||||
@@ -241,8 +241,11 @@ panfrost_blit(struct pipe_context *pipe,
|
||||
}
|
||||
|
||||
struct pan_blit_context bctx;
|
||||
struct pan_pool blit_pool;
|
||||
|
||||
pan_blit_ctx_init(dev, &pinfo, &bctx);
|
||||
panfrost_pool_init(&blit_pool, NULL, dev, 0, 4096, "Blitter pool",
|
||||
false, true);
|
||||
pan_blit_ctx_init(dev, &pinfo, &blit_pool, &bctx);
|
||||
do {
|
||||
if (bctx.dst.cur_layer < 0)
|
||||
continue;
|
||||
@@ -279,7 +282,7 @@ panfrost_blit(struct pipe_context *pipe,
|
||||
}
|
||||
|
||||
panfrost_batch_add_fbo_bos(batch);
|
||||
panfrost_blit_add_ctx_bos(batch, &bctx);
|
||||
panfrost_blit_add_ctx_bos(batch, &blit_pool);
|
||||
batch->draws = draw_flags;
|
||||
batch->resolve = draw_flags;
|
||||
batch->minx = minx;
|
||||
@@ -301,5 +304,5 @@ panfrost_blit(struct pipe_context *pipe,
|
||||
ctx->batch = NULL;
|
||||
} while (pan_blit_next_surface(&bctx));
|
||||
|
||||
pan_blit_ctx_cleanup(&bctx);
|
||||
panfrost_pool_cleanup(&blit_pool);
|
||||
}
|
||||
|
||||
@@ -1344,10 +1344,10 @@ pan_preload_fb(struct pan_pool *pool,
|
||||
void
|
||||
pan_blit_ctx_init(struct panfrost_device *dev,
|
||||
const struct pan_blit_info *info,
|
||||
struct pan_pool *blit_pool,
|
||||
struct pan_blit_context *ctx)
|
||||
{
|
||||
memset(ctx, 0, sizeof(*ctx));
|
||||
panfrost_pool_init(&ctx->pool, NULL, dev, 0, 65536, "Blitter pool", false, true);
|
||||
|
||||
ctx->z_scale = (float)(info->dst.end.z - info->dst.start.z + 1) /
|
||||
(info->src.end.z - info->src.start.z + 1);
|
||||
@@ -1440,17 +1440,17 @@ pan_blit_ctx_init(struct panfrost_device *dev,
|
||||
|
||||
if (pan_is_bifrost(dev)) {
|
||||
ctx->textures =
|
||||
pan_blitter_emit_bifrost_textures(&ctx->pool, nviews, sview_ptrs);
|
||||
pan_blitter_emit_bifrost_textures(blit_pool, nviews, sview_ptrs);
|
||||
ctx->samplers =
|
||||
pan_blitter_emit_bifrost_sampler(&ctx->pool, info->nearest);
|
||||
pan_blitter_emit_bifrost_sampler(blit_pool, info->nearest);
|
||||
} else {
|
||||
ctx->textures =
|
||||
pan_blitter_emit_midgard_textures(&ctx->pool, nviews, sview_ptrs);
|
||||
pan_blitter_emit_midgard_textures(blit_pool, nviews, sview_ptrs);
|
||||
ctx->samplers =
|
||||
pan_blitter_emit_midgard_sampler(&ctx->pool, info->nearest);
|
||||
pan_blitter_emit_midgard_sampler(blit_pool, info->nearest);
|
||||
}
|
||||
|
||||
ctx->vpd = pan_blitter_emit_viewport(&ctx->pool,
|
||||
ctx->vpd = pan_blitter_emit_viewport(blit_pool,
|
||||
minx, miny, maxx, maxy);
|
||||
|
||||
float dst_rect[] = {
|
||||
@@ -1461,16 +1461,10 @@ pan_blit_ctx_init(struct panfrost_device *dev,
|
||||
};
|
||||
|
||||
ctx->position =
|
||||
panfrost_pool_upload_aligned(&ctx->pool, dst_rect,
|
||||
panfrost_pool_upload_aligned(blit_pool, dst_rect,
|
||||
sizeof(dst_rect), 64);
|
||||
}
|
||||
|
||||
void
|
||||
pan_blit_ctx_cleanup(struct pan_blit_context *ctx)
|
||||
{
|
||||
panfrost_pool_cleanup(&ctx->pool);
|
||||
}
|
||||
|
||||
bool
|
||||
pan_blit_next_surface(struct pan_blit_context *ctx)
|
||||
{
|
||||
|
||||
@@ -57,7 +57,6 @@ struct pan_blit_info {
|
||||
};
|
||||
|
||||
struct pan_blit_context {
|
||||
struct pan_pool pool;
|
||||
mali_ptr rsd, vpd;
|
||||
mali_ptr textures;
|
||||
mali_ptr samplers;
|
||||
@@ -95,11 +94,9 @@ pan_preload_fb(struct pan_pool *desc_pool,
|
||||
void
|
||||
pan_blit_ctx_init(struct panfrost_device *dev,
|
||||
const struct pan_blit_info *info,
|
||||
struct pan_pool *blit_pool,
|
||||
struct pan_blit_context *ctx);
|
||||
|
||||
void
|
||||
pan_blit_ctx_cleanup(struct pan_blit_context *ctx);
|
||||
|
||||
bool
|
||||
pan_blit_next_surface(struct pan_blit_context *ctx);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user