aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/vc4/vc4_cl.h
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.h
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.h')
-rw-r--r--src/gallium/drivers/vc4/vc4_cl.h17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/gallium/drivers/vc4/vc4_cl.h b/src/gallium/drivers/vc4/vc4_cl.h
index 86cd0c797a6..33b37298406 100644
--- a/src/gallium/drivers/vc4/vc4_cl.h
+++ b/src/gallium/drivers/vc4/vc4_cl.h
@@ -35,13 +35,12 @@ struct vc4_bo;
struct vc4_cl {
void *base;
void *next;
- void *end;
+ uint32_t size;
uint32_t reloc_next;
uint32_t reloc_count;
};
void vc4_init_cl(struct vc4_context *vc4, struct vc4_cl *cl);
-void vc4_grow_cl(struct vc4_cl *cl);
void vc4_reset_cl(struct vc4_cl *cl);
void vc4_dump_cl(void *cl, uint32_t size, bool is_render);
uint32_t vc4_gem_hindex(struct vc4_context *vc4, struct vc4_bo *bo);
@@ -49,8 +48,7 @@ uint32_t vc4_gem_hindex(struct vc4_context *vc4, struct vc4_bo *bo);
static inline void
cl_u8(struct vc4_cl *cl, uint8_t n)
{
- if (cl->next + 1 > cl->end)
- vc4_grow_cl(cl);
+ assert((cl->next - cl->base) + 1 <= cl->size);
*(uint8_t *)cl->next = n;
cl->next++;
@@ -59,8 +57,7 @@ cl_u8(struct vc4_cl *cl, uint8_t n)
static inline void
cl_u16(struct vc4_cl *cl, uint32_t n)
{
- if (cl->next + 2 > cl->end)
- vc4_grow_cl(cl);
+ assert((cl->next - cl->base) + 2 <= cl->size);
*(uint16_t *)cl->next = n;
cl->next += 2;
@@ -69,8 +66,7 @@ cl_u16(struct vc4_cl *cl, uint32_t n)
static inline void
cl_u32(struct vc4_cl *cl, uint32_t n)
{
- if (cl->next + 4 > cl->end)
- vc4_grow_cl(cl);
+ assert((cl->next - cl->base) + 4 <= cl->size);
*(uint32_t *)cl->next = n;
cl->next += 4;
@@ -79,8 +75,7 @@ cl_u32(struct vc4_cl *cl, uint32_t n)
static inline void
cl_ptr(struct vc4_cl *cl, void *ptr)
{
- if (cl->next + sizeof(void *) > cl->end)
- vc4_grow_cl(cl);
+ assert((cl->next - cl->base) + sizeof(void *) <= cl->size);
*(void **)cl->next = ptr;
cl->next += sizeof(void *);
@@ -134,4 +129,6 @@ cl_reloc(struct vc4_context *vc4, struct vc4_cl *cl,
cl_reloc_hindex(cl, vc4_gem_hindex(vc4, bo), offset);
}
+void cl_ensure_space(struct vc4_cl *cl, uint32_t size);
+
#endif /* VC4_CL_H */