From: Marek Olšák Date: Mon, 6 Aug 2018 11:11:33 +0000 (-0400) Subject: radeonsi: implement ARB/KHR_parallel_shader_compile callbacks X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b9d627e07650a157176f6fb4bd3c3ffef6e21357;p=mesa.git radeonsi: implement ARB/KHR_parallel_shader_compile callbacks --- diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c index 9b1eab8284b..98c59867d4b 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.c +++ b/src/gallium/drivers/radeonsi/si_pipe.c @@ -26,6 +26,7 @@ #include "si_pipe.h" #include "si_public.h" #include "si_shader_internal.h" +#include "si_compute.h" #include "sid.h" #include "ac_llvm_util.h" @@ -846,6 +847,32 @@ static void si_disk_cache_create(struct si_screen *sscreen) shader_debug_flags); } +static void si_set_max_shader_compiler_threads(struct pipe_screen *screen, + unsigned max_threads) +{ + struct si_screen *sscreen = (struct si_screen *)screen; + + /* This function doesn't allow a greater number of threads than + * the queue had at its creation. */ + util_queue_adjust_num_threads(&sscreen->shader_compiler_queue, + max_threads); + /* Don't change the number of threads on the low priority queue. */ +} + +static bool si_is_parallel_shader_compilation_finished(struct pipe_screen *screen, + void *shader, + unsigned shader_type) +{ + if (shader_type == PIPE_SHADER_COMPUTE) { + struct si_compute *cs = (struct si_compute*)shader; + + return util_queue_fence_is_signalled(&cs->ready); + } + struct si_shader_selector *sel = (struct si_shader_selector *)shader; + + return util_queue_fence_is_signalled(&sel->ready); +} + struct pipe_screen *radeonsi_screen_create(struct radeon_winsys *ws, const struct pipe_screen_config *config) { @@ -876,6 +903,10 @@ struct pipe_screen *radeonsi_screen_create(struct radeon_winsys *ws, /* Set functions first. */ sscreen->b.context_create = si_pipe_create_context; sscreen->b.destroy = si_destroy_screen; + sscreen->b.set_max_shader_compiler_threads = + si_set_max_shader_compiler_threads; + sscreen->b.is_parallel_shader_compilation_finished = + si_is_parallel_shader_compilation_finished; si_init_screen_get_functions(sscreen); si_init_screen_buffer_functions(sscreen);