util/u_queue: add UTIL_QUEUE_INIT_SCALE_THREADS flag

This flag allow to create a single thread initially, but set
max_thread to the request thread count.

If the queue is full and num_threads is lower than max_threads,
we spawn a new thread to help process the queue faster.

This avoid creating N threads at queue creation time.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11296>
This commit is contained in:
Pierre-Eric Pelloux-Prayer
2021-06-09 13:49:23 +02:00
parent 0c88df1f6a
commit 3713dc6b2a
2 changed files with 11 additions and 3 deletions
+1
View File
@@ -49,6 +49,7 @@ extern "C" {
#define UTIL_QUEUE_INIT_USE_MINIMUM_PRIORITY (1 << 0)
#define UTIL_QUEUE_INIT_RESIZE_IF_FULL (1 << 1)
#define UTIL_QUEUE_INIT_SET_FULL_THREAD_AFFINITY (1 << 2)
#define UTIL_QUEUE_INIT_SCALE_THREADS (1 << 3)
#if UTIL_FUTEX_SUPPORTED
#define UTIL_QUEUE_FENCE_FUTEX