summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2015-07-09 22:42:22 -0700
committerEric Anholt <eric@anholt.net>2015-07-14 11:31:57 -0700
commite4c540f6d09390013a9cb66060a29f236ad7dcfc (patch)
tree3cbdd627a44d4fd73bf25b02badb0fc49e321cda
parentab80519b3cd08401dff2d07343064a27f32b33ca (diff)
vc4: Store reloc pointers as pointers, not offsets.
Now that we don't resize the CL as we build (it's set up at the top by vc4_start_draw()), we can store the pointers instead of offsets from the base. Saves a bit of math in emitting relocs (about 60 bytes of code).
-rw-r--r--src/gallium/drivers/vc4/vc4_cl.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/gallium/drivers/vc4/vc4_cl.h b/src/gallium/drivers/vc4/vc4_cl.h
index 4a50e79094..4974da1530 100644
--- a/src/gallium/drivers/vc4/vc4_cl.h
+++ b/src/gallium/drivers/vc4/vc4_cl.h
@@ -36,8 +36,8 @@ struct vc4_bo;
struct vc4_cl {
void *base;
void *next;
+ void *reloc_next;
uint32_t size;
- uint32_t reloc_next;
uint32_t reloc_count;
};
@@ -128,7 +128,7 @@ cl_start_reloc(struct vc4_cl *cl, uint32_t n)
cl->reloc_count = n;
cl_u8(cl, VC4_PACKET_GEM_HANDLES);
- cl->reloc_next = cl->next - cl->base;
+ cl->reloc_next = cl->next;
cl_u32(cl, 0); /* Space where hindex will be written. */
cl_u32(cl, 0); /* Space where hindex will be written. */
}
@@ -138,7 +138,7 @@ cl_start_shader_reloc(struct vc4_cl *cl, uint32_t n)
{
assert(cl->reloc_count == 0);
cl->reloc_count = n;
- cl->reloc_next = cl->next - cl->base;
+ cl->reloc_next = cl->next;
/* Space where hindex will be written. */
cl->next += n * 4;
@@ -147,7 +147,7 @@ cl_start_shader_reloc(struct vc4_cl *cl, uint32_t n)
static inline void
cl_reloc_hindex(struct vc4_cl *cl, uint32_t hindex, uint32_t offset)
{
- *(uint32_t *)(cl->base + cl->reloc_next) = hindex;
+ *(uint32_t *)cl->reloc_next = hindex;
cl->reloc_next += 4;
cl->reloc_count--;
@@ -158,7 +158,7 @@ cl_reloc_hindex(struct vc4_cl *cl, uint32_t hindex, uint32_t offset)
static inline void
cl_aligned_reloc_hindex(struct vc4_cl *cl, uint32_t hindex, uint32_t offset)
{
- *(uint32_t *)(cl->base + cl->reloc_next) = hindex;
+ *(uint32_t *)cl->reloc_next = hindex;
cl->reloc_next += 4;
cl->reloc_count--;