summaryrefslogtreecommitdiff
path: root/lib/mesa/src/util/u_queue.c
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2024-04-02 10:42:24 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2024-04-02 10:42:24 +0000
commita3f73acb9d2cdc62692af7ff93c51f910dff2d0d (patch)
tree303d205e8e6ed9676bdcbe006a402c23bf668f6c /lib/mesa/src/util/u_queue.c
parentf54e142455cb3c9d1662dae7e096a32a47e5409b (diff)
Merge Mesa 23.3.6
Diffstat (limited to 'lib/mesa/src/util/u_queue.c')
-rw-r--r--lib/mesa/src/util/u_queue.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/mesa/src/util/u_queue.c b/lib/mesa/src/util/u_queue.c
index ed1e96b10..750dd2015 100644
--- a/lib/mesa/src/util/u_queue.c
+++ b/lib/mesa/src/util/u_queue.c
@@ -442,9 +442,10 @@ util_queue_init(struct util_queue *queue,
snprintf(queue->name, sizeof(queue->name), "%s", name);
}
+ queue->create_threads_on_demand = true;
queue->flags = flags;
queue->max_threads = num_threads;
- queue->num_threads = (flags & UTIL_QUEUE_INIT_SCALE_THREADS) ? 1 : num_threads;
+ queue->num_threads = 1;
queue->max_jobs = max_jobs;
queue->global_data = global_data;
@@ -582,7 +583,7 @@ util_queue_add_job_locked(struct util_queue *queue,
/* Scale the number of threads up if there's already one job waiting. */
if (queue->num_queued > 0 &&
- queue->flags & UTIL_QUEUE_INIT_SCALE_THREADS &&
+ queue->create_threads_on_demand &&
execute != util_queue_finish_execute &&
queue->num_threads < queue->max_threads) {
util_queue_adjust_num_threads(queue, queue->num_threads + 1, true);
@@ -719,8 +720,7 @@ util_queue_finish(struct util_queue *queue)
* Also note that util_queue_add_job can unlock the mutex if there is not
* enough space in the queue and wait for space.
*/
- unsigned saved_flags = queue->flags;
- queue->flags &= ~UTIL_QUEUE_INIT_SCALE_THREADS;
+ queue->create_threads_on_demand = false;
fences = malloc(queue->num_threads * sizeof(*fences));
util_barrier_init(&barrier, queue->num_threads);
@@ -730,7 +730,7 @@ util_queue_finish(struct util_queue *queue)
util_queue_add_job_locked(queue, &barrier, &fences[i],
util_queue_finish_execute, NULL, 0, true);
}
- queue->flags = saved_flags;
+ queue->create_threads_on_demand = true;
mtx_unlock(&queue->lock);
for (unsigned i = 0; i < queue->num_threads; ++i) {