Lines Matching refs:glthread
24 /** @file glthread.c
26 * Support functions for the glthread feature of Mesa.
36 #include "main/glthread.h"
94 struct glthread_state *glthread = &ctx->GLThread;
96 assert(!glthread->enabled);
98 if (!util_queue_init(&glthread->queue, "gl", MARSHAL_MAX_BATCHES - 2,
103 glthread->VAOs = _mesa_NewHashTable();
104 if (!glthread->VAOs) {
105 util_queue_destroy(&glthread->queue);
109 _mesa_glthread_reset_vao(&glthread->DefaultVAO);
110 glthread->CurrentVAO = &glthread->DefaultVAO;
114 _mesa_DeleteHashTable(glthread->VAOs);
115 util_queue_destroy(&glthread->queue);
120 glthread->batches[i].ctx = ctx;
121 util_queue_fence_init(&glthread->batches[i].fence);
123 glthread->next_batch = &glthread->batches[glthread->next];
124 glthread->used = 0;
126 glthread->enabled = true;
127 glthread->stats.queue = &glthread->queue;
129 glthread->SupportsBufferUploads =
133 /* If the draw start index is non-zero, glthread can upload to offset 0,
137 glthread->SupportsNonVBOUploads = glthread->SupportsBufferUploads &&
142 glthread->LastDListChangeBatchIndex = -1;
147 util_queue_add_job(&glthread->queue, ctx, &fence,
162 struct glthread_state *glthread = &ctx->GLThread;
164 if (!glthread->enabled)
168 util_queue_destroy(&glthread->queue);
171 util_queue_fence_destroy(&glthread->batches[i].fence);
173 _mesa_HashDeleteAll(glthread->VAOs, free_vao, NULL);
174 _mesa_DeleteHashTable(glthread->VAOs);
194 printf("glthread disabled: %s\n", func);
209 struct glthread_state *glthread = &ctx->GLThread;
210 if (!glthread->enabled)
213 if (!glthread->used)
222 ++glthread->pin_thread_counter % 128 == 0) {
228 util_set_thread_affinity(glthread->queue.threads[0],
236 struct glthread_batch *next = glthread->next_batch;
249 p_atomic_add(&glthread->stats.num_offloaded_items, glthread->used);
250 next->used = glthread->used;
252 util_queue_add_job(&glthread->queue, next, &next->fence,
254 glthread->last = glthread->next;
255 glthread->next = (glthread->next + 1) % MARSHAL_MAX_BATCHES;
256 glthread->next_batch = &glthread->batches[glthread->next];
257 glthread->used = 0;
269 struct glthread_state *glthread = &ctx->GLThread;
270 if (!glthread->enabled)
278 if (u_thread_is_self(glthread->queue.threads[0]))
281 struct glthread_batch *last = &glthread->batches[glthread->last];
282 struct glthread_batch *next = glthread->next_batch;
290 if (glthread->used) {
291 p_atomic_add(&glthread->stats.num_direct_items, glthread->used);
292 next->used = glthread->used;
293 glthread->used = 0;
309 p_atomic_inc(&glthread->stats.num_syncs);
317 /* Uncomment this if you want to know where glthread syncs. */
322 _mesa_error_glthread_safe(struct gl_context *ctx, GLenum error, bool glthread,
325 if (glthread) {