Message ID | 20190225182752.1804-7-maraeo@gmail.com |
---|---|
State | New |
Headers | show |
Series |
"Series without cover letter"
( rev:
1
)
in
Mesa |
diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c index b965d9d64d4..7dbd4cb2c40 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.c +++ b/src/gallium/drivers/radeonsi/si_pipe.c @@ -19,20 +19,21 @@ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. */ #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" #include "radeon/radeon_uvd.h" #include "gallivm/lp_bld_misc.h" #include "util/disk_cache.h" #include "util/u_log.h" #include "util/u_memory.h" #include "util/u_suballoc.h" #include "util/u_tests.h" @@ -826,20 +827,46 @@ static void si_disk_cache_create(struct si_screen *sscreen) */ STATIC_ASSERT(ALL_FLAGS <= UINT_MAX); shader_debug_flags |= (uint64_t)sscreen->info.address32_hi << 32; sscreen->disk_shader_cache = disk_cache_create(sscreen->info.name, cache_id, 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) { struct si_screen *sscreen = CALLOC_STRUCT(si_screen); unsigned hw_threads, num_comp_hi_threads, num_comp_lo_threads, i; if (!sscreen) { return NULL; } @@ -856,20 +883,24 @@ struct pipe_screen *radeonsi_screen_create(struct radeon_winsys *ws, } sscreen->debug_flags = debug_get_flags_option("R600_DEBUG", debug_options, 0); sscreen->debug_flags |= debug_get_flags_option("AMD_DEBUG", debug_options, 0); /* 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); si_init_screen_fence_functions(sscreen); si_init_screen_state_functions(sscreen); si_init_screen_texture_functions(sscreen); si_init_screen_query_functions(sscreen); /* Set these flags in debug_flags early, so that the shader cache takes * them into account.
For the series Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de> Do we have a (special) test in the wild? Dieter Am 25.02.2019 19:27, schrieb Marek Olšák: > From: Marek Olšák <marek.olsak@amd.com> > > --- > src/gallium/drivers/radeonsi/si_pipe.c | 31 ++++++++++++++++++++++++++ > 1 file changed, 31 insertions(+) > > diff --git a/src/gallium/drivers/radeonsi/si_pipe.c > b/src/gallium/drivers/radeonsi/si_pipe.c > index b965d9d64d4..7dbd4cb2c40 100644 > --- a/src/gallium/drivers/radeonsi/si_pipe.c > +++ b/src/gallium/drivers/radeonsi/si_pipe.c > @@ -19,20 +19,21 @@ > * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT > SHALL > * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, > * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT > OR > * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE > OR THE > * USE OR OTHER DEALINGS IN THE SOFTWARE. > */ > > #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" > #include "radeon/radeon_uvd.h" > #include "gallivm/lp_bld_misc.h" > #include "util/disk_cache.h" > #include "util/u_log.h" > #include "util/u_memory.h" > #include "util/u_suballoc.h" > #include "util/u_tests.h" > @@ -826,20 +827,46 @@ static void si_disk_cache_create(struct > si_screen *sscreen) > */ > STATIC_ASSERT(ALL_FLAGS <= UINT_MAX); > shader_debug_flags |= (uint64_t)sscreen->info.address32_hi << 32; > > sscreen->disk_shader_cache = > disk_cache_create(sscreen->info.name, > cache_id, > 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) > { > struct si_screen *sscreen = CALLOC_STRUCT(si_screen); > unsigned hw_threads, num_comp_hi_threads, num_comp_lo_threads, i; > > if (!sscreen) { > return NULL; > } > > @@ -856,20 +883,24 @@ struct pipe_screen > *radeonsi_screen_create(struct radeon_winsys *ws, > } > > sscreen->debug_flags = debug_get_flags_option("R600_DEBUG", > debug_options, 0); > sscreen->debug_flags |= debug_get_flags_option("AMD_DEBUG", > debug_options, 0); > > /* 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); > si_init_screen_fence_functions(sscreen); > si_init_screen_state_functions(sscreen); > si_init_screen_texture_functions(sscreen); > si_init_screen_query_functions(sscreen); > > /* Set these flags in debug_flags early, so that the shader cache > takes > * them into account.
From: Marek Olšák <marek.olsak@amd.com> --- src/gallium/drivers/radeonsi/si_pipe.c | 31 ++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)