diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c index 7eb7d364f80..48d7844732c 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.c +++ b/src/gallium/drivers/radeonsi/si_pipe.c @@ -1192,18 +1192,27 @@ static struct pipe_screen *radeonsi_screen_create_impl(struct radeon_winsys *ws, /* Take a reference on the glsl types for the compiler threads. */ glsl_type_singleton_init_or_ref(); - if (!util_queue_init( - &sscreen->shader_compiler_queue, "sh", 64, num_comp_hi_threads, - UTIL_QUEUE_INIT_RESIZE_IF_FULL | UTIL_QUEUE_INIT_SET_FULL_THREAD_AFFINITY, NULL)) { + /* Start with a single thread and a single slot. + * Each time we'll hit the "all slots are in use" case, the number of threads and + * slots will be increased. + */ + int num_slots = num_comp_hi_threads == 1 ? 64 : 1; + if (!util_queue_init(&sscreen->shader_compiler_queue, "sh", num_slots, + num_comp_hi_threads, + UTIL_QUEUE_INIT_RESIZE_IF_FULL | + UTIL_QUEUE_INIT_SCALE_THREADS | + UTIL_QUEUE_INIT_SET_FULL_THREAD_AFFINITY, NULL)) { si_destroy_shader_cache(sscreen); FREE(sscreen); glsl_type_singleton_decref(); return NULL; } - if (!util_queue_init(&sscreen->shader_compiler_queue_low_priority, "shlo", 64, + if (!util_queue_init(&sscreen->shader_compiler_queue_low_priority, "shlo", num_slots, num_comp_lo_threads, - UTIL_QUEUE_INIT_RESIZE_IF_FULL | UTIL_QUEUE_INIT_SET_FULL_THREAD_AFFINITY | + UTIL_QUEUE_INIT_RESIZE_IF_FULL | + UTIL_QUEUE_INIT_SCALE_THREADS | + UTIL_QUEUE_INIT_SET_FULL_THREAD_AFFINITY | UTIL_QUEUE_INIT_USE_MINIMUM_PRIORITY, NULL)) { si_destroy_shader_cache(sscreen); FREE(sscreen);