Lines Matching refs:glthread

24 /** @file glthread.c
26 * Support functions for the glthread feature of Mesa.
36 #include "main/glthread.h"
95 struct glthread_state *glthread = &ctx->GLThread;
97 assert(!glthread->enabled);
99 if (!util_queue_init(&glthread->queue, "gl", MARSHAL_MAX_BATCHES - 2,
104 glthread->VAOs = _mesa_NewHashTable();
105 if (!glthread->VAOs) {
106 util_queue_destroy(&glthread->queue);
110 _mesa_glthread_reset_vao(&glthread->DefaultVAO);
111 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 _mesa_debug(ctx, "glthread destroy reason: %s\n", reason);
171 util_queue_destroy(&glthread->queue);
174 util_queue_fence_destroy(&glthread->batches[i].fence);
176 _mesa_HashDeleteAll(glthread->VAOs, free_vao, NULL);
177 _mesa_DeleteHashTable(glthread->VAOs);
191 struct glthread_state *glthread = &ctx->GLThread;
192 if (!glthread->enabled)
200 if (!glthread->used)
209 ++glthread->pin_thread_counter % 128 == 0) {
215 util_set_thread_affinity(glthread->queue.threads[0],
225 struct glthread_batch *next = glthread->next_batch;
238 p_atomic_add(&glthread->stats.num_offloaded_items, glthread->used);
239 next->used = glthread->used;
241 util_queue_add_job(&glthread->queue, next, &next->fence,
243 glthread->last = glthread->next;
244 glthread->next = (glthread->next + 1) % MARSHAL_MAX_BATCHES;
245 glthread->next_batch = &glthread->batches[glthread->next];
246 glthread->used = 0;
258 struct glthread_state *glthread = &ctx->GLThread;
259 if (!glthread->enabled)
267 if (u_thread_is_self(glthread->queue.threads[0]))
270 struct glthread_batch *last = &glthread->batches[glthread->last];
271 struct glthread_batch *next = glthread->next_batch;
279 if (glthread->used) {
280 p_atomic_add(&glthread->stats.num_direct_items, glthread->used);
281 next->used = glthread->used;
282 glthread->used = 0;
298 p_atomic_inc(&glthread->stats.num_syncs);
306 /* Uncomment this if you want to know where glthread syncs. */
311 _mesa_error_glthread_safe(struct gl_context *ctx, GLenum error, bool glthread,
314 if (glthread) {