Mesa (main): panfrost: Move context initalization to the vtable

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


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

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Mon Jul 12 18:48:46 2021 -0400

panfrost: Move context initalization to the vtable

Now there's only a single genx entrypoint.

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 | 31 +++++++++++++++-------------
 src/gallium/drivers/panfrost/pan_context.c   |  3 ++-
 src/gallium/drivers/panfrost/pan_context.h   |  3 ---
 src/gallium/drivers/panfrost/pan_screen.h    |  3 +++
 4 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c
index 8b66cc0f61e..543f20cecc5 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.c
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.c
@@ -3699,6 +3699,22 @@ preload(struct panfrost_batch *batch, struct pan_fb_info *fb)
                        pan_is_bifrost(dev) ? batch->tiler_ctx.bifrost : 0);
 }
 
+static void
+context_init(struct pipe_context *pipe)
+{
+        pipe->draw_vbo           = panfrost_draw_vbo;
+        pipe->launch_grid        = panfrost_launch_grid;
+
+        pipe->create_vertex_elements_state = panfrost_create_vertex_elements_state;
+        pipe->create_rasterizer_state = panfrost_create_rasterizer_state;
+        pipe->create_depth_stencil_alpha_state = panfrost_create_depth_stencil_state;
+        pipe->create_sampler_view = panfrost_create_sampler_view;
+        pipe->create_sampler_state = panfrost_create_sampler_state;
+        pipe->create_blend_state = panfrost_create_blend_state;
+
+        pipe->get_sample_position = panfrost_get_sample_position;
+}
+
 void
 panfrost_cmdstream_screen_init(struct panfrost_screen *screen)
 {
@@ -3710,23 +3726,10 @@ panfrost_cmdstream_screen_init(struct panfrost_screen *screen)
         screen->vtbl.emit_fragment_job = emit_fragment_job;
         screen->vtbl.screen_destroy = screen_destroy;
         screen->vtbl.preload     = preload;
+        screen->vtbl.context_init = context_init;
 
         pan_blitter_init(dev, &screen->blitter.bin_pool.base,
                          &screen->blitter.desc_pool.base);
 }
 
-void
-panfrost_cmdstream_context_init(struct pipe_context *pipe)
-{
-        pipe->draw_vbo           = panfrost_draw_vbo;
-        pipe->launch_grid        = panfrost_launch_grid;
-
-        pipe->create_vertex_elements_state = panfrost_create_vertex_elements_state;
-        pipe->create_rasterizer_state = panfrost_create_rasterizer_state;
-        pipe->create_depth_stencil_alpha_state = panfrost_create_depth_stencil_state;
-        pipe->create_sampler_view = panfrost_create_sampler_view;
-        pipe->create_sampler_state = panfrost_create_sampler_state;
-        pipe->create_blend_state = panfrost_create_blend_state;
 
-        pipe->get_sample_position = panfrost_get_sample_position;
-}
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index c64652e9fa4..064c8fd6c9a 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -1100,7 +1100,8 @@ panfrost_create_context(struct pipe_screen *screen, void *priv, unsigned flags)
 
         gallium->set_blend_color = panfrost_set_blend_color;
 
-        panfrost_cmdstream_context_init(gallium);
+        pan_screen(screen)->vtbl.context_init(gallium);
+
         panfrost_resource_context_init(gallium);
         panfrost_compute_context_init(gallium);
 
diff --git a/src/gallium/drivers/panfrost/pan_context.h b/src/gallium/drivers/panfrost/pan_context.h
index b2ad9af36ba..f0f39d69d14 100644
--- a/src/gallium/drivers/panfrost/pan_context.h
+++ b/src/gallium/drivers/panfrost/pan_context.h
@@ -436,7 +436,4 @@ panfrost_clean_state_3d(struct panfrost_context *ctx)
         }
 }
 
-void
-panfrost_cmdstream_context_init(struct pipe_context *pipe);
-
 #endif
diff --git a/src/gallium/drivers/panfrost/pan_screen.h b/src/gallium/drivers/panfrost/pan_screen.h
index 33acb983d9a..416af403315 100644
--- a/src/gallium/drivers/panfrost/pan_screen.h
+++ b/src/gallium/drivers/panfrost/pan_screen.h
@@ -70,6 +70,9 @@ struct panfrost_vtable {
 
         /* Preload framebuffer */
         void (*preload)(struct panfrost_batch *, struct pan_fb_info *);
+
+        /* Initialize a Gallium context */
+        void (*context_init)(struct pipe_context *pipe);
 };
 
 struct panfrost_screen {



More information about the mesa-commit mailing list