panfrost: Extract panfrost_batch_reserve_framebuffer
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 15 Jul 2020 17:10:02 +0000 (13:10 -0400)
committerMarge Bot <eric+marge@anholt.net>
Wed, 15 Jul 2020 22:19:37 +0000 (22:19 +0000)
We need to trigger it explicitly for reloads without draws (for Z^S
reload which is an edge case).

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5929>

src/gallium/drivers/panfrost/pan_cmdstream.c
src/gallium/drivers/panfrost/pan_job.c
src/gallium/drivers/panfrost/pan_job.h

index 6e31d9bc4b97489f9edd1a07a48d42727b00ae9a..bda4b1da7c9bd048d596f62d15e7d820e1285ee0 100644 (file)
@@ -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
index bc9dab58cf2250397729431b02e44ac296d9a1b0..1da37214ab4106622ada4b3bb730e9acf5233afb 100644 (file)
@@ -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)
 {
index 409644d2cfdfdca0078d2af1c05740c7a790240b..fc958b1482e306c19ac49b4922971c913ac57035 100644 (file)
@@ -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