diff options
author | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2013-11-25 17:31:13 +0200 |
---|---|---|
committer | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2013-11-27 16:21:28 +0200 |
commit | 49f4860d5c94afffecfac3fcda999bea59d5f929 (patch) | |
tree | 1d97bedc4317d1bec172125ecb45324bd26d5111 | |
parent | 525788a7360cca116b00819c14ee11c5913ffd42 (diff) |
lib: Add gem_bo_busy
Move gem_bo_busy() from gem_wait_render_timeout.c to lib.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
-rw-r--r-- | lib/drmtest.c | 10 | ||||
-rw-r--r-- | lib/drmtest.h | 2 | ||||
-rw-r--r-- | tests/gem_wait_render_timeout.c | 11 |
3 files changed, 12 insertions, 11 deletions
diff --git a/lib/drmtest.c b/lib/drmtest.c index 65441281..8f6c74eb 100644 --- a/lib/drmtest.c +++ b/lib/drmtest.c @@ -641,6 +641,16 @@ void gem_sw_finish(int fd, uint32_t handle) do_ioctl(fd, DRM_IOCTL_I915_GEM_SW_FINISH, &finish); } +bool gem_bo_busy(int fd, uint32_t handle) +{ + struct drm_i915_gem_busy busy; + + busy.handle = handle; + + do_ioctl(fd, DRM_IOCTL_I915_GEM_BUSY, &busy); + + return !!busy.busy; +} /* prime */ int prime_handle_to_fd(int fd, uint32_t handle) diff --git a/lib/drmtest.h b/lib/drmtest.h index 1a243b1d..5e831e5f 100644 --- a/lib/drmtest.h +++ b/lib/drmtest.h @@ -87,6 +87,8 @@ uint32_t gem_context_create(int fd); void gem_sw_finish(int fd, uint32_t handle); +bool gem_bo_busy(int fd, uint32_t handle); + /* feature test helpers */ bool gem_uses_aliasing_ppgtt(int fd); int gem_available_fences(int fd); diff --git a/tests/gem_wait_render_timeout.c b/tests/gem_wait_render_timeout.c index ae317298..3253d7ff 100644 --- a/tests/gem_wait_render_timeout.c +++ b/tests/gem_wait_render_timeout.c @@ -80,17 +80,6 @@ gem_bo_wait_timeout(int fd, uint32_t handle, uint64_t *timeout_ns) return ret ? -errno : 0; } -static bool -gem_bo_busy(int fd, uint32_t handle) -{ - struct drm_i915_gem_busy busy; - - busy.handle = handle; - do_or_die(drmIoctl(fd, DRM_IOCTL_I915_GEM_BUSY, &busy)); - - return !!busy.busy; -} - static void blt_color_fill(struct intel_batchbuffer *batch, drm_intel_bo *buf, const unsigned int pages) |