diff options
author | Marek Olšák <[email protected]> | 2018-08-06 07:11:33 -0400 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2019-04-01 12:37:52 -0400 |
commit | b9d627e07650a157176f6fb4bd3c3ffef6e21357 (patch) | |
tree | a8bb4d173e2a8ad9eb2f52bfe04436bc7c0b3c40 /src/gallium/drivers | |
parent | 050fae39838ef8f6b71194b4687849c6f7d0a92e (diff) |
radeonsi: implement ARB/KHR_parallel_shader_compile callbacks
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_pipe.c | 31 |
1 files changed, 31 insertions, 0 deletions
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); |