diff options
author | Eric Anholt <[email protected]> | 2015-07-10 14:46:42 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2015-07-14 11:31:57 -0700 |
commit | a0d3915663fb7cbd3c1a5561450e256e00ecf11b (patch) | |
tree | 547186d4059f86df6a86b7387151b987ed1e3127 /src/gallium/drivers/vc4/vc4_cl.c | |
parent | 748bf459b46b44e184ee1d425ce612da61a0800e (diff) |
vc4: Make a helper function for getting the current offset in the CL.
I needed to rewrite this a bit for safety checking in the next commit.
Despite being a static inline of the same thing that was being done, we
lose 36 bytes of code for some reason.
Diffstat (limited to 'src/gallium/drivers/vc4/vc4_cl.c')
-rw-r--r-- | src/gallium/drivers/vc4/vc4_cl.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/gallium/drivers/vc4/vc4_cl.c b/src/gallium/drivers/vc4/vc4_cl.c index 0700e885cbf..97f6b89024c 100644 --- a/src/gallium/drivers/vc4/vc4_cl.c +++ b/src/gallium/drivers/vc4/vc4_cl.c @@ -36,11 +36,12 @@ vc4_init_cl(struct vc4_context *vc4, struct vc4_cl *cl) void cl_ensure_space(struct vc4_cl *cl, uint32_t space) { - if ((cl->next - cl->base) + space <= cl->size) + uint32_t offset = cl_offset(cl); + + if (offset + 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->size = size; @@ -60,9 +61,7 @@ vc4_gem_hindex(struct vc4_context *vc4, struct vc4_bo *bo) uint32_t hindex; uint32_t *current_handles = vc4->bo_handles.base; - for (hindex = 0; - hindex < (vc4->bo_handles.next - vc4->bo_handles.base) / 4; - hindex++) { + for (hindex = 0; hindex < cl_offset(&vc4->bo_handles) / 4; hindex++) { if (current_handles[hindex] == bo->handle) return hindex; } |