summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/glthread.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2013-02-15 16:33:33 -0800
committerTimothy Arceri <[email protected]>2017-03-16 14:14:19 +1100
commit47f819d3cb89ab90914181e3c61744ac1f16e056 (patch)
treeb093a34150d1a28d5422a2b5201d354e8a078fc6 /src/mesa/main/glthread.c
parent1d6b71c5c6264f9cc0f7ae7c35d27b5c88f3f8bf (diff)
mesa: Statically allocate glthread command buffer in the batch struct.
This avoids an extra pointer dereference in the marshalling functions, which, with the instruction count doing in the low 30s, could actually matter for main-thread performance. Acked-by: Timothy Arceri <[email protected]> Acked-by: Marek Olšák <[email protected]> Tested-by: Dieter Nützel <[email protected]> Tested-by: Mike Lothian <[email protected]>
Diffstat (limited to 'src/mesa/main/glthread.c')
-rw-r--r--src/mesa/main/glthread.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/mesa/main/glthread.c b/src/mesa/main/glthread.c
index c4d1031f4c6..8f300d46344 100644
--- a/src/mesa/main/glthread.c
+++ b/src/mesa/main/glthread.c
@@ -45,10 +45,10 @@ glthread_allocate_batch(struct gl_context *ctx)
struct glthread_state *glthread = ctx->GLThread;
/* TODO: handle memory allocation failure. */
- glthread->batch = calloc(1, sizeof(*glthread->batch));
+ glthread->batch = malloc(sizeof(*glthread->batch));
if (!glthread->batch)
return;
- glthread->batch->buffer = malloc(MARSHAL_MAX_CMD_SIZE);
+ memset(glthread->batch, 0, offsetof(struct glthread_batch, buffer));
}
static void
@@ -63,7 +63,6 @@ glthread_unmarshal_batch(struct gl_context *ctx, struct glthread_batch *batch)
assert(pos == batch->used);
- free(batch->buffer);
free(batch);
}