summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/vc4/vc4_cl.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2014-12-22 10:09:10 -0800
committerEric Anholt <[email protected]>2014-12-24 10:28:26 -1000
commit229bf4475ff0a5dbeb9bc95250f7a40a983c2e28 (patch)
treec8fee66eec2853ab19740c42072ce7cce61a995b /src/gallium/drivers/vc4/vc4_cl.c
parent20e3a2430e0435b8ee4861553e5acd13c58cf90f (diff)
vc4: Optimize CL emits by doing size checks up front.
The optimizer obviously doesn't have the ability to rewrite these to skip the size checks per call, so we have to do it manually. Improves a norast benchmark on simulation by 0.779706% +/- 0.405838% (n=6087).
Diffstat (limited to 'src/gallium/drivers/vc4/vc4_cl.c')
-rw-r--r--src/gallium/drivers/vc4/vc4_cl.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/gallium/drivers/vc4/vc4_cl.c b/src/gallium/drivers/vc4/vc4_cl.c
index 36dd28c48c0..0700e885cbf 100644
--- a/src/gallium/drivers/vc4/vc4_cl.c
+++ b/src/gallium/drivers/vc4/vc4_cl.c
@@ -29,17 +29,21 @@ void
vc4_init_cl(struct vc4_context *vc4, struct vc4_cl *cl)
{
cl->base = ralloc_size(vc4, 1);
- cl->end = cl->next = cl->base;
+ cl->next = cl->base;
+ cl->size = 0;
}
void
-vc4_grow_cl(struct vc4_cl *cl)
+cl_ensure_space(struct vc4_cl *cl, uint32_t space)
{
- uint32_t size = MAX2((cl->end - cl->base) * 2, 4096);
+ if ((cl->next - cl->base) + space <= cl->size)
+ return;
+
+ uint32_t size = MAX2(cl->size + space, cl->size * 2);
uint32_t offset = cl->next -cl->base;
cl->base = reralloc(ralloc_parent(cl->base), cl->base, uint8_t, size);
- cl->end = cl->base + size;
+ cl->size = size;
cl->next = cl->base + offset;
}