util/u_queue: add UTIL_QUEUE_INIT_SCALE_THREADS flag
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Wed, 9 Jun 2021 11:49:23 +0000 (13:49 +0200)
committerPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Thu, 17 Jun 2021 07:11:59 +0000 (09:11 +0200)
commit3713dc6b2a7472a838885b9ff1e4e07f9b9b7713
treec44f169e977098a8caabadb7d303d3b7fe523922
parent0c88df1f6a524c52c8d893ed8db2cff01e8bd14a
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>
src/util/u_queue.c
src/util/u_queue.h