diff options
author | Marek Olšák <[email protected]> | 2016-06-12 12:54:42 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2016-06-24 12:24:40 +0200 |
commit | d8367e91f2e3d8426e77674b39f36c09ed9992ec (patch) | |
tree | fe060afc629bff25253847ca33400b3d0e2dc6b4 /src/gallium/auxiliary/util/u_queue.h | |
parent | c36a363a2d305a987ef2ea843fe9fc860b576eed (diff) |
gallium/u_queue: use a ring instead of a stack
and allow specifying its size in util_queue_init.
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 | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/util/u_queue.h b/src/gallium/auxiliary/util/u_queue.h index db5a266fd41..48cd9f4c707 100644 --- a/src/gallium/auxiliary/util/u_queue.h +++ b/src/gallium/auxiliary/util/u_queue.h @@ -54,12 +54,14 @@ struct util_queue { pipe_semaphore queued; pipe_thread thread; int kill_thread; - int num_jobs; - struct util_queue_job jobs[8]; + int max_jobs; + int write_idx, read_idx; /* ring buffer pointers */ + struct util_queue_job *jobs; void (*execute_job)(void *job); }; -void util_queue_init(struct util_queue *queue, +bool util_queue_init(struct util_queue *queue, + unsigned max_jobs, void (*execute_job)(void *)); void util_queue_destroy(struct util_queue *queue); void util_queue_fence_init(struct util_queue_fence *fence); |