panfrost: Move context initalization to the vtable
authorAlyssa Rosenzweig <alyssa@collabora.com>
Mon, 12 Jul 2021 22:48:46 +0000 (18:48 -0400)
committerMarge Bot <eric+marge@anholt.net>
Fri, 23 Jul 2021 20:12:18 +0000 (20:12 +0000)
Now there's only a single genx entrypoint.

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

src/gallium/drivers/panfrost/pan_cmdstream.c
src/gallium/drivers/panfrost/pan_context.c
src/gallium/drivers/panfrost/pan_context.h
src/gallium/drivers/panfrost/pan_screen.h

index 8b66cc0..543f20c 100644 (file)
@@ -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;
-}
index c64652e..064c8fd 100644 (file)
@@ -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);
 
index b2ad9af..f0f39d6 100644 (file)
@@ -436,7 +436,4 @@ panfrost_clean_state_3d(struct panfrost_context *ctx)
         }
 }
 
-void
-panfrost_cmdstream_context_init(struct pipe_context *pipe);
-
 #endif
index 33acb98..416af40 100644 (file)
@@ -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 {