From d0e6db100c9bb812fc60643299389ec784e59b97 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Mon, 12 Jul 2021 18:48:46 -0400 Subject: [PATCH] panfrost: Move context initalization to the vtable Now there's only a single genx entrypoint. Signed-off-by: Alyssa Rosenzweig Reviewed-by: Boris Brezillon Part-of: --- 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 8b66cc0..543f20c 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 c64652e..064c8fd 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 b2ad9af..f0f39d6 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 33acb98..416af40 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 { -- 2.7.4