Mesa (main): panfrost: Move init_batch to GenXML vtbl

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jul 23 20:28:03 UTC 2021


Module: Mesa
Branch: main
Commit: 6f0c235da1a07568dd19dd0fabb3086154e1cecd
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6f0c235da1a07568dd19dd0fabb3086154e1cecd

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Tue Jul 13 13:42:55 2021 -0400

panfrost: Move init_batch to GenXML vtbl

Secretly depends on GenXML.

Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11851>

---

 src/gallium/drivers/panfrost/pan_cmdstream.c | 25 +++++++++++++++++++++++++
 src/gallium/drivers/panfrost/pan_job.c       | 23 ++++-------------------
 src/gallium/drivers/panfrost/pan_screen.h    |  3 +++
 3 files changed, 32 insertions(+), 19 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c
index 513f234b79c..4b9e3cd7d7e 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.c
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.c
@@ -3486,6 +3486,30 @@ preload(struct panfrost_batch *batch, struct pan_fb_info *fb)
                        PAN_ARCH >= 6 ? batch->tiler_ctx.bifrost : 0);
 }
 
+static void
+init_batch(struct panfrost_batch *batch)
+{
+        /* Reserve the framebuffer and local storage descriptors */
+        batch->framebuffer =
+#if PAN_ARCH == 4
+                pan_pool_alloc_desc(&batch->pool.base, SINGLE_TARGET_FRAMEBUFFER);
+#else
+                pan_pool_alloc_desc_aggregate(&batch->pool.base,
+                                              PAN_DESC(MULTI_TARGET_FRAMEBUFFER),
+                                              PAN_DESC(ZS_CRC_EXTENSION),
+                                              PAN_DESC_ARRAY(MAX2(batch->key.nr_cbufs, 1), RENDER_TARGET));
+
+                batch->framebuffer.gpu |= MALI_FBD_TAG_IS_MFBD;
+#endif
+
+#if PAN_ARCH >= 6
+        batch->tls = pan_pool_alloc_desc(&batch->pool.base, LOCAL_STORAGE);
+#else
+        /* On Midgard, the TLS is embedded in the FB descriptor */
+        batch->tls = batch->framebuffer;
+#endif
+}
+
 static void
 context_init(struct pipe_context *pipe)
 {
@@ -3514,6 +3538,7 @@ GENX(panfrost_cmdstream_screen_init)(struct panfrost_screen *screen)
         screen->vtbl.screen_destroy = screen_destroy;
         screen->vtbl.preload     = preload;
         screen->vtbl.context_init = context_init;
+        screen->vtbl.init_batch = init_batch;
 
         pan_blitter_init(dev, &screen->blitter.bin_pool.base,
                          &screen->blitter.desc_pool.base);
diff --git a/src/gallium/drivers/panfrost/pan_job.c b/src/gallium/drivers/panfrost/pan_job.c
index ffd445a08a4..3fdcfde755c 100644
--- a/src/gallium/drivers/panfrost/pan_job.c
+++ b/src/gallium/drivers/panfrost/pan_job.c
@@ -51,7 +51,9 @@ panfrost_batch_init(struct panfrost_context *ctx,
                     const struct pipe_framebuffer_state *key,
                     struct panfrost_batch *batch)
 {
-        struct panfrost_device *dev = pan_device(ctx->base.screen);
+        struct pipe_screen *pscreen = ctx->base.screen;
+        struct panfrost_screen *screen = pan_screen(pscreen);
+        struct panfrost_device *dev = &screen->dev;
 
         batch->ctx = ctx;
 
@@ -79,24 +81,7 @@ panfrost_batch_init(struct panfrost_context *ctx,
 
         panfrost_batch_add_fbo_bos(batch);
 
-        /* Reserve the framebuffer and local storage descriptors */
-        batch->framebuffer =
-                (dev->quirks & MIDGARD_SFBD) ?
-                pan_pool_alloc_desc(&batch->pool.base, SINGLE_TARGET_FRAMEBUFFER) :
-                pan_pool_alloc_desc_aggregate(&batch->pool.base,
-                                              PAN_DESC(MULTI_TARGET_FRAMEBUFFER),
-                                              PAN_DESC(ZS_CRC_EXTENSION),
-                                              PAN_DESC_ARRAY(MAX2(key->nr_cbufs, 1), RENDER_TARGET));
-
-        /* Add the MFBD tag now, other tags will be added at submit-time */
-        if (!(dev->quirks & MIDGARD_SFBD))
-                batch->framebuffer.gpu |= MALI_FBD_TAG_IS_MFBD;
-
-        /* On Midgard, the TLS is embedded in the FB descriptor */
-        if (pan_is_bifrost(dev))
-                batch->tls = pan_pool_alloc_desc(&batch->pool.base, LOCAL_STORAGE);
-        else
-                batch->tls = batch->framebuffer;
+        screen->vtbl.init_batch(batch);
 }
 
 static void
diff --git a/src/gallium/drivers/panfrost/pan_screen.h b/src/gallium/drivers/panfrost/pan_screen.h
index 5ff084848cb..198f33b26db 100644
--- a/src/gallium/drivers/panfrost/pan_screen.h
+++ b/src/gallium/drivers/panfrost/pan_screen.h
@@ -73,6 +73,9 @@ struct panfrost_vtable {
 
         /* Initialize a Gallium context */
         void (*context_init)(struct pipe_context *pipe);
+
+        /* Device-dependent initialization of a panfrost_batch */
+        void (*init_batch)(struct panfrost_batch *batch);
 };
 
 struct panfrost_screen {



More information about the mesa-commit mailing list