From a2e41590293a4c773c4f399e4f46fcf91cf8cbe9 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 14 Aug 2020 18:31:05 -0400 Subject: [PATCH] panfrost: Hoist add_fbo_bo call Move it to batch initialization, to take it out of the clear/draw path. This should make sense - as soon as the batch is created, we need to hold the refference. Functionally there shouldn't be unused batches floating around anyway. Signed-off-by: Alyssa Rosenzweig Reviewed-by: Tomeu Vizoso Part-of: --- src/gallium/drivers/panfrost/pan_context.c | 7 +------ src/gallium/drivers/panfrost/pan_job.c | 8 +++++++- src/gallium/drivers/panfrost/pan_job.h | 2 -- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index 84843ac8786..f3f1aa55362 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -139,8 +139,6 @@ panfrost_clear( * fragment jobs. */ struct panfrost_batch *batch = panfrost_get_fresh_batch_for_fbo(ctx); - - panfrost_batch_add_fbo_bos(batch); panfrost_batch_clear(batch, buffers, color, depth, stencil); } @@ -309,12 +307,9 @@ panfrost_draw_vbo( return; } - /* Now that we have a guaranteed terminating path, find the job. - * Assignment commented out to prevent unused warning */ + /* Now that we have a guaranteed terminating path, find the job. */ struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx); - - panfrost_batch_add_fbo_bos(batch); panfrost_batch_set_requirements(batch); /* Take into account a negative bias */ diff --git a/src/gallium/drivers/panfrost/pan_job.c b/src/gallium/drivers/panfrost/pan_job.c index 33b8bce4df8..b0665da6b6e 100644 --- a/src/gallium/drivers/panfrost/pan_job.c +++ b/src/gallium/drivers/panfrost/pan_job.c @@ -92,6 +92,9 @@ panfrost_batch_fence_reference(struct panfrost_batch_fence *fence) pipe_reference(NULL, &fence->reference); } +static void +panfrost_batch_add_fbo_bos(struct panfrost_batch *batch); + static struct panfrost_batch * panfrost_create_batch(struct panfrost_context *ctx, const struct pipe_framebuffer_state *key) @@ -111,6 +114,8 @@ panfrost_create_batch(struct panfrost_context *ctx, batch->pool = panfrost_create_pool(batch, pan_device(ctx->base.screen)); + panfrost_batch_add_fbo_bos(batch); + return batch; } @@ -559,7 +564,8 @@ panfrost_batch_add_resource_bos(struct panfrost_batch *batch, panfrost_batch_add_bo(batch, rsrc->separate_stencil->bo, flags); } -void panfrost_batch_add_fbo_bos(struct panfrost_batch *batch) +static void +panfrost_batch_add_fbo_bos(struct panfrost_batch *batch) { uint32_t flags = PAN_BO_ACCESS_SHARED | PAN_BO_ACCESS_WRITE | PAN_BO_ACCESS_VERTEX_TILER | diff --git a/src/gallium/drivers/panfrost/pan_job.h b/src/gallium/drivers/panfrost/pan_job.h index 68e1f40b99e..e94dd76ad0c 100644 --- a/src/gallium/drivers/panfrost/pan_job.h +++ b/src/gallium/drivers/panfrost/pan_job.h @@ -147,8 +147,6 @@ void panfrost_batch_add_bo(struct panfrost_batch *batch, struct panfrost_bo *bo, uint32_t flags); -void panfrost_batch_add_fbo_bos(struct panfrost_batch *batch); - struct panfrost_bo * panfrost_batch_create_bo(struct panfrost_batch *batch, size_t size, uint32_t create_flags, uint32_t access_flags); -- 2.30.2