From b042c71ac12762f65981ca499dc989b64b294bd6 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 7 Sep 2021 13:50:27 -0700 Subject: [PATCH] iris: Move iris_set_max_shader_compiler_threads and iris_is_parallel_shader_compilation_finished There's going to be at least one more shader function set in pipe_screen, so it makes more sense to do it in iris_program.c. Reviewed-by: Kenneth Graunke Part-of: --- src/gallium/drivers/iris/iris_context.h | 1 + src/gallium/drivers/iris/iris_program.c | 41 +++++++++++++++++++++++++ src/gallium/drivers/iris/iris_screen.c | 35 +-------------------- 3 files changed, 43 insertions(+), 34 deletions(-) diff --git a/src/gallium/drivers/iris/iris_context.h b/src/gallium/drivers/iris/iris_context.h index 41f43bbeb5a..7827d65f1c6 100644 --- a/src/gallium/drivers/iris/iris_context.h +++ b/src/gallium/drivers/iris/iris_context.h @@ -858,6 +858,7 @@ void iris_flush_dirty_dmabufs(struct iris_context *ice); void iris_init_blit_functions(struct pipe_context *ctx); void iris_init_clear_functions(struct pipe_context *ctx); void iris_init_program_functions(struct pipe_context *ctx); +void iris_init_screen_program_functions(struct pipe_screen *pscreen); void iris_init_resource_functions(struct pipe_context *ctx); void iris_init_perfquery_functions(struct pipe_context *ctx); void iris_update_compiled_shaders(struct iris_context *ice); diff --git a/src/gallium/drivers/iris/iris_program.c b/src/gallium/drivers/iris/iris_program.c index c282a26c7de..d0017acc345 100644 --- a/src/gallium/drivers/iris/iris_program.c +++ b/src/gallium/drivers/iris/iris_program.c @@ -2907,6 +2907,47 @@ iris_bind_cs_state(struct pipe_context *ctx, void *state) bind_shader_state((void *) ctx, state, MESA_SHADER_COMPUTE); } +static void +iris_set_max_shader_compiler_threads(struct pipe_screen *pscreen, + unsigned max_threads) +{ + struct iris_screen *screen = (struct iris_screen *) pscreen; + util_queue_adjust_num_threads(&screen->shader_compiler_queue, max_threads); +} + +static bool +iris_is_parallel_shader_compilation_finished(struct pipe_screen *pscreen, + void *v_shader, + enum pipe_shader_type p_stage) +{ + struct iris_screen *screen = (struct iris_screen *) pscreen; + + /* Threaded compilation is only used for the precompile. If precompile is + * disabled, threaded compilation is "done." + */ + if (!screen->precompile) + return true; + + struct iris_uncompiled_shader *ish = v_shader; + + /* When precompile is enabled, the first entry is the precompile variant. + * Check the ready fence of the precompile variant. + */ + struct iris_compiled_shader *first = + list_first_entry(&ish->variants, struct iris_compiled_shader, link); + + return util_queue_fence_is_signalled(&first->ready); +} + +void +iris_init_screen_program_functions(struct pipe_screen *pscreen) +{ + pscreen->is_parallel_shader_compilation_finished = + iris_is_parallel_shader_compilation_finished; + pscreen->set_max_shader_compiler_threads = + iris_set_max_shader_compiler_threads; +} + void iris_init_program_functions(struct pipe_context *ctx) { diff --git a/src/gallium/drivers/iris/iris_screen.c b/src/gallium/drivers/iris/iris_screen.c index ffd1dc6e096..0344ac894ff 100644 --- a/src/gallium/drivers/iris/iris_screen.c +++ b/src/gallium/drivers/iris/iris_screen.c @@ -651,38 +651,6 @@ iris_get_disk_shader_cache(struct pipe_screen *pscreen) return screen->disk_cache; } -static void -iris_set_max_shader_compiler_threads(struct pipe_screen *pscreen, - unsigned max_threads) -{ - struct iris_screen *screen = (struct iris_screen *) pscreen; - util_queue_adjust_num_threads(&screen->shader_compiler_queue, max_threads); -} - -static bool -iris_is_parallel_shader_compilation_finished(struct pipe_screen *pscreen, - void *v_shader, - enum pipe_shader_type p_stage) -{ - struct iris_screen *screen = (struct iris_screen *) pscreen; - - /* Threaded compilation is only used for the precompile. If precompile is - * disabled, threaded compilation is "done." - */ - if (!screen->precompile) - return true; - - struct iris_uncompiled_shader *ish = v_shader; - - /* When precompile is enabled, the first entry is the precompile variant. - * Check the ready fence of the precompile variant. - */ - struct iris_compiled_shader *first = - list_first_entry(&ish->variants, struct iris_compiled_shader, link); - - return util_queue_fence_is_signalled(&first->ready); -} - static int iris_getparam(int fd, int param, int *value) { @@ -899,8 +867,7 @@ iris_screen_create(int fd, const struct pipe_screen_config *config) pscreen->query_memory_info = iris_query_memory_info; pscreen->get_driver_query_group_info = iris_get_monitor_group_info; pscreen->get_driver_query_info = iris_get_monitor_info; - pscreen->is_parallel_shader_compilation_finished = iris_is_parallel_shader_compilation_finished; - pscreen->set_max_shader_compiler_threads = iris_set_max_shader_compiler_threads; + iris_init_screen_program_functions(pscreen); genX_call(&screen->devinfo, init_screen_state, screen);