summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/vc4/vc4_bufmgr.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2014-07-18 13:06:01 -0700
committerEric Anholt <eric@anholt.net>2014-08-11 14:40:45 -0700
commita3cd3c0d198374647df3db83198e8ce0cddcb6b7 (patch)
treead6f36cbf7b4c8bf081b0ea4c62620ef62e97282 /src/gallium/drivers/vc4/vc4_bufmgr.c
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_bufmgr.c')
-rw-r--r--src/gallium/drivers/vc4/vc4_bufmgr.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/gallium/drivers/vc4/vc4_bufmgr.c b/src/gallium/drivers/vc4/vc4_bufmgr.c
index 6cf7d163dd0..653787e1905 100644
--- a/src/gallium/drivers/vc4/vc4_bufmgr.c
+++ b/src/gallium/drivers/vc4/vc4_bufmgr.c
@@ -60,7 +60,10 @@ vc4_bo_alloc(struct vc4_screen *screen, uint32_t size, const char *name)
bo->handle = create.handle;
assert(create.size >= size);
#else /* USE_VC4_SIMULATOR */
- bo->map = vc4_simulator_alloc(screen, size);
+ static int next_handle = 0;
+ bo->handle = next_handle++;
+
+ bo->map = malloc(size);
#endif /* USE_VC4_SIMULATOR */
return bo;
@@ -77,6 +80,8 @@ vc4_bo_free(struct vc4_bo *bo)
int ret = drmIoctl(screen->fd, DRM_IOCTL_GEM_CLOSE, &c);
if (ret != 0)
fprintf(stderr, "close object %d: %s\n", bo->handle, strerror(errno));
+#else
+ free(bo->map);
#endif
free(bo);
@@ -107,7 +112,7 @@ vc4_bo_open_name(struct vc4_screen *screen, uint32_t name,
vc4_bo_map(bo);
bo->simulator_winsys_map = bo->map;
bo->simulator_winsys_stride = winsys_stride;
- bo->map = vc4_simulator_alloc(screen, bo->size);
+ bo->map = malloc(bo->size);
#endif
return bo;