From 34a03109b8e740083d145fcd539b92bf55c215cb Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Wed, 15 Jul 2020 13:10:02 -0400 Subject: [PATCH] panfrost: Extract panfrost_batch_reserve_framebuffer We need to trigger it explicitly for reloads without draws (for Z^S reload which is an edge case). Signed-off-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/panfrost/pan_cmdstream.c | 18 +-------------- src/gallium/drivers/panfrost/pan_job.c | 24 ++++++++++++++++++++ src/gallium/drivers/panfrost/pan_job.h | 3 +++ 3 files changed, 28 insertions(+), 17 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c index 6e31d9bc4b9..bda4b1da7c9 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -71,24 +71,8 @@ static void panfrost_vt_attach_framebuffer(struct panfrost_context *ctx, struct mali_vertex_tiler_postfix *postfix) { - struct panfrost_device *dev = pan_device(ctx->base.screen); struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx); - - /* If we haven't, reserve space for the framebuffer */ - - if (!batch->framebuffer.gpu) { - unsigned size = (dev->quirks & MIDGARD_SFBD) ? - sizeof(struct mali_single_framebuffer) : - sizeof(struct mali_framebuffer); - - batch->framebuffer = panfrost_pool_alloc(&batch->pool, size); - - /* Tag the pointer */ - if (!(dev->quirks & MIDGARD_SFBD)) - batch->framebuffer.gpu |= MALI_MFBD; - } - - postfix->shared_memory = batch->framebuffer.gpu; + postfix->shared_memory = panfrost_batch_reserve_framebuffer(batch); } static void diff --git a/src/gallium/drivers/panfrost/pan_job.c b/src/gallium/drivers/panfrost/pan_job.c index bc9dab58cf2..1da37214ab4 100644 --- a/src/gallium/drivers/panfrost/pan_job.c +++ b/src/gallium/drivers/panfrost/pan_job.c @@ -770,6 +770,30 @@ panfrost_batch_get_tiler_dummy(struct panfrost_batch *batch) return batch->tiler_dummy; } +mali_ptr +panfrost_batch_reserve_framebuffer(struct panfrost_batch *batch) +{ + struct panfrost_device *dev = pan_device(batch->ctx->base.screen); + + /* If we haven't, reserve space for the framebuffer */ + + if (!batch->framebuffer.gpu) { + unsigned size = (dev->quirks & MIDGARD_SFBD) ? + sizeof(struct mali_single_framebuffer) : + sizeof(struct mali_framebuffer); + + batch->framebuffer = panfrost_pool_alloc(&batch->pool, size); + + /* Tag the pointer */ + if (!(dev->quirks & MIDGARD_SFBD)) + batch->framebuffer.gpu |= MALI_MFBD; + } + + return batch->framebuffer.gpu; +} + + + static void panfrost_batch_draw_wallpaper(struct panfrost_batch *batch) { diff --git a/src/gallium/drivers/panfrost/pan_job.h b/src/gallium/drivers/panfrost/pan_job.h index 409644d2cfd..fc958b1482e 100644 --- a/src/gallium/drivers/panfrost/pan_job.h +++ b/src/gallium/drivers/panfrost/pan_job.h @@ -221,4 +221,7 @@ panfrost_batch_is_scanout(struct panfrost_batch *batch); mali_ptr panfrost_batch_get_tiler_meta(struct panfrost_batch *batch, unsigned vertex_count); +mali_ptr +panfrost_batch_reserve_framebuffer(struct panfrost_batch *batch); + #endif -- 2.30.2