summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/vc4/vc4_cl.h
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2014-07-18 13:06:01 -0700
committerEric Anholt <[email protected]>2014-08-11 14:40:45 -0700
commita3cd3c0d198374647df3db83198e8ce0cddcb6b7 (patch)
treead6f36cbf7b4c8bf081b0ea4c62620ef62e97282 /src/gallium/drivers/vc4/vc4_cl.h
parenta02c658908384b81e9d27e2555ba2fce2cc0f6a8 (diff)
vc4: Switch simulator to using kernel validator
This ensures that when I'm using the simulator, I get a closer match to what behavior on real hardware will be. It lets me rapidly iterate on the kernel validation code (which otherwise has a several-minute turnaround time), and helps catch buffer overflow bugs in the userspace driver faster.
Diffstat (limited to 'src/gallium/drivers/vc4/vc4_cl.h')
-rw-r--r--src/gallium/drivers/vc4/vc4_cl.h22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/gallium/drivers/vc4/vc4_cl.h b/src/gallium/drivers/vc4/vc4_cl.h
index a892444d9c7..3e7c4836569 100644
--- a/src/gallium/drivers/vc4/vc4_cl.h
+++ b/src/gallium/drivers/vc4/vc4_cl.h
@@ -28,10 +28,6 @@
#include "util/u_math.h"
-#ifdef USE_VC4_SIMULATOR
-#include "simpenrose/simpenrose.h"
-#endif
-
#include "vc4_packet.h"
struct vc4_bo;
@@ -80,6 +76,16 @@ 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);
+
+ *(void **)cl->next = ptr;
+ cl->next += sizeof(void *);
+}
+
+static inline void
cl_f(struct vc4_cl *cl, float f)
{
cl_u32(cl, fui(f));
@@ -92,12 +98,10 @@ cl_start_reloc(struct vc4_cl *cl, uint32_t n)
assert(cl->reloc_count == 0);
cl->reloc_count = n;
-#ifndef USE_VC4_SIMULATOR
cl_u8(cl, GEM_HANDLES);
cl->reloc_next = cl->next - cl->base;
cl_u32(cl, 0); /* Space where hindex will be written. */
cl_u32(cl, 0); /* Space where hindex will be written. */
-#endif
}
static inline void
@@ -107,22 +111,16 @@ cl_start_shader_reloc(struct vc4_cl *cl, uint32_t n)
cl->reloc_count = n;
cl->reloc_next = cl->next - cl->base;
-#ifndef USE_VC4_SIMULATOR
for (int i = 0; i < n; i++)
cl_u32(cl, 0); /* Space where hindex will be written. */
-#endif
}
static inline void
cl_reloc(struct vc4_context *vc4, struct vc4_cl *cl,
struct vc4_bo *bo, uint32_t offset)
{
-#ifndef USE_VC4_SIMULATOR
*(uint32_t *)(cl->base + cl->reloc_next) = vc4_gem_hindex(vc4, bo);
cl->reloc_next += 4;
-#else
- offset += simpenrose_hw_addr(bo->map);
-#endif
cl->reloc_count--;