diff options
author | Eric Anholt <[email protected]> | 2015-03-23 17:26:40 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2015-03-24 10:39:12 -0700 |
commit | af3d7471943d54e692f2dd7448321a4f96e56ed2 (patch) | |
tree | 493052e8ab687b82cdf84ff638086b801e3c7ef9 /src/gallium/drivers/vc4/vc4_bufmgr.c | |
parent | 9bafcf630ab009b3b39bbe3c0f4370386bc5a6b2 (diff) |
vc4: Make a new #define for making code conditional on the simulator.
I'd like to compile as much of the device-specific code as possible
when building for simulator, and using if (using_simulator) instead of
ifdefs helps.
Diffstat (limited to 'src/gallium/drivers/vc4/vc4_bufmgr.c')
-rw-r--r-- | src/gallium/drivers/vc4/vc4_bufmgr.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/gallium/drivers/vc4/vc4_bufmgr.c b/src/gallium/drivers/vc4/vc4_bufmgr.c index 8c5ee64224f..007786481e8 100644 --- a/src/gallium/drivers/vc4/vc4_bufmgr.c +++ b/src/gallium/drivers/vc4/vc4_bufmgr.c @@ -318,13 +318,19 @@ vc4_wait_seqno(struct vc4_screen *screen, uint64_t seqno, uint64_t timeout_ns) if (screen->finished_seqno >= seqno) return true; -#ifndef USE_VC4_SIMULATOR struct drm_vc4_wait_seqno wait; memset(&wait, 0, sizeof(wait)); wait.seqno = seqno; wait.timeout_ns = timeout_ns; - int ret = drmIoctl(screen->fd, DRM_IOCTL_VC4_WAIT_SEQNO, &wait); + int ret; + if (!using_vc4_simulator) + ret = drmIoctl(screen->fd, DRM_IOCTL_VC4_WAIT_SEQNO, &wait); + else { + wait.seqno = screen->finished_seqno; + ret = 0; + } + if (ret == -ETIME) { return false; } else if (ret != 0) { @@ -334,15 +340,11 @@ vc4_wait_seqno(struct vc4_screen *screen, uint64_t seqno, uint64_t timeout_ns) screen->finished_seqno = wait.seqno; return true; } -#else - return true; -#endif } bool vc4_bo_wait(struct vc4_bo *bo, uint64_t timeout_ns) { -#ifndef USE_VC4_SIMULATOR struct vc4_screen *screen = bo->screen; struct drm_vc4_wait_bo wait; @@ -350,7 +352,12 @@ vc4_bo_wait(struct vc4_bo *bo, uint64_t timeout_ns) wait.handle = bo->handle; wait.timeout_ns = timeout_ns; - int ret = drmIoctl(screen->fd, DRM_IOCTL_VC4_WAIT_BO, &wait); + int ret; + if (!using_vc4_simulator) + ret = drmIoctl(screen->fd, DRM_IOCTL_VC4_WAIT_BO, &wait); + else + ret = 0; + if (ret == -ETIME) { return false; } else if (ret != 0) { @@ -359,9 +366,6 @@ vc4_bo_wait(struct vc4_bo *bo, uint64_t timeout_ns) } else { return true; } -#else - return true; -#endif } void * |