summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/marshal.h
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2017-06-21 13:53:23 +0200
committerMarek Olšák <[email protected]>2017-06-26 02:17:03 +0200
commitd1513edaa00b476f87c4dd397c3746f17f19196a (patch)
tree08c8f018f0eaa7d74085fc47f119cf859b730c48 /src/mesa/main/marshal.h
parent1e37a5054b1f47a0e95183bd99b8c6a3a8be4725 (diff)
mesa/glthread: switch to u_queue and redesign the batch management
This mirrors exactly how u_threaded_context works. If you understand this, you also understand u_threaded_context. Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/mesa/main/marshal.h')
-rw-r--r--src/mesa/main/marshal.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/mesa/main/marshal.h b/src/mesa/main/marshal.h
index a6cff8bcbfd..999c75e3ea6 100644
--- a/src/mesa/main/marshal.h
+++ b/src/mesa/main/marshal.h
@@ -53,15 +53,17 @@ _mesa_glthread_allocate_command(struct gl_context *ctx,
size_t size)
{
struct glthread_state *glthread = ctx->GLThread;
+ struct glthread_batch *next = &glthread->batches[glthread->next];
struct marshal_cmd_base *cmd_base;
const size_t aligned_size = ALIGN(size, 8);
- if (unlikely(glthread->batch->used + size > MARSHAL_MAX_CMD_SIZE))
+ if (unlikely(next->used + size > MARSHAL_MAX_CMD_SIZE)) {
_mesa_glthread_flush_batch(ctx);
+ next = &glthread->batches[glthread->next];
+ }
- cmd_base = (struct marshal_cmd_base *)
- &glthread->batch->buffer[glthread->batch->used];
- glthread->batch->used += aligned_size;
+ cmd_base = (struct marshal_cmd_base *)&next->buffer[next->used];
+ next->used += aligned_size;
cmd_base->cmd_id = cmd_id;
cmd_base->cmd_size = aligned_size;
return cmd_base;