util/queue: add a global data pointer for the queue object
this better enables object-specific (e.g., context) queues where the owner of the queue will always be needed and various pointers will be passed in for tasks Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11312>
This commit is contained in:
+5
-2
@@ -189,10 +189,11 @@ util_queue_fence_wait_timeout(struct util_queue_fence *fence,
|
||||
return _util_queue_fence_wait_timeout(fence, abs_timeout);
|
||||
}
|
||||
|
||||
typedef void (*util_queue_execute_func)(void *job, int thread_index);
|
||||
typedef void (*util_queue_execute_func)(void *job, void *gdata, int thread_index);
|
||||
|
||||
struct util_queue_job {
|
||||
void *job;
|
||||
void *global_data;
|
||||
size_t job_size;
|
||||
struct util_queue_fence *fence;
|
||||
util_queue_execute_func execute;
|
||||
@@ -215,6 +216,7 @@ struct util_queue {
|
||||
int write_idx, read_idx; /* ring buffer pointers */
|
||||
size_t total_jobs_size; /* memory use of all jobs in the queue */
|
||||
struct util_queue_job *jobs;
|
||||
void *global_data;
|
||||
|
||||
/* for cleanup at exit(), protected by exit_mutex */
|
||||
struct list_head head;
|
||||
@@ -224,7 +226,8 @@ bool util_queue_init(struct util_queue *queue,
|
||||
const char *name,
|
||||
unsigned max_jobs,
|
||||
unsigned num_threads,
|
||||
unsigned flags);
|
||||
unsigned flags,
|
||||
void *global_data);
|
||||
void util_queue_destroy(struct util_queue *queue);
|
||||
|
||||
/* optional cleanup callback is called after fence is signaled: */
|
||||
|
||||
Reference in New Issue
Block a user