diff options
author | Marek Olšák <[email protected]> | 2016-06-11 15:40:28 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2016-06-24 12:24:40 +0200 |
commit | 404d0d50d8aaf60597668e65a2d7c96cdea53aea (patch) | |
tree | 4bc6013efc181d8678a00ac5f434bc4433772172 /src/gallium/auxiliary/util/u_queue.h | |
parent | 4358f6dd130680d60d48d6646959c11c8d7ca13d (diff) |
gallium/u_queue: add an option to have multiple worker threads
independent jobs don't have to be stuck on only one thread
v2: use CALLOC & FREE
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/util/u_queue.h')
-rw-r--r-- | src/gallium/auxiliary/util/u_queue.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/gallium/auxiliary/util/u_queue.h b/src/gallium/auxiliary/util/u_queue.h index acebb51382f..f3aa4f6f5c6 100644 --- a/src/gallium/auxiliary/util/u_queue.h +++ b/src/gallium/auxiliary/util/u_queue.h @@ -54,17 +54,19 @@ struct util_queue { pipe_mutex lock; pipe_semaphore has_space; pipe_semaphore queued; - pipe_thread thread; - int kill_thread; + pipe_thread *threads; + unsigned num_threads; + int kill_threads; int max_jobs; int write_idx, read_idx; /* ring buffer pointers */ struct util_queue_job *jobs; - void (*execute_job)(void *job); + void (*execute_job)(void *job, int thread_index); }; bool util_queue_init(struct util_queue *queue, unsigned max_jobs, - void (*execute_job)(void *)); + unsigned num_threads, + void (*execute_job)(void *, int)); void util_queue_destroy(struct util_queue *queue); void util_queue_fence_init(struct util_queue_fence *fence); void util_queue_fence_destroy(struct util_queue_fence *fence); @@ -78,7 +80,7 @@ void util_queue_job_wait(struct util_queue_fence *fence); static inline bool util_queue_is_initialized(struct util_queue *queue) { - return queue->thread != 0; + return queue->threads != NULL; } static inline bool |