diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-01-19 22:13:36 +0100 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-01-19 22:13:36 +0100 |
commit | 7d2ba073adef9c4c6f7a679befa2a5d19cbf4735 (patch) | |
tree | 3e9e91d716adb53dcfdcb878386443fbbc9b333e | |
parent | 71f1f9eafd68c82382d165028ae73035742bb730 (diff) |
lib: add __gem_create
Useful for when a gem_create ioctl is expected to fail.
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r-- | lib/drmtest.c | 15 | ||||
-rw-r--r-- | lib/drmtest.h | 1 |
2 files changed, 16 insertions, 0 deletions
diff --git a/lib/drmtest.c b/lib/drmtest.c index 246f2f74..8bc70a35 100644 --- a/lib/drmtest.c +++ b/lib/drmtest.c @@ -540,6 +540,21 @@ void gem_sync(int fd, uint32_t handle) gem_set_domain(fd, handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); } +uint32_t __gem_create(int fd, int size) +{ + struct drm_i915_gem_create create; + int ret; + + create.handle = 0; + create.size = size; + ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create); + + if (ret < 0) + return 0; + else + return create.handle; +} + uint32_t gem_create(int fd, int size) { struct drm_i915_gem_create create; diff --git a/lib/drmtest.h b/lib/drmtest.h index 0240a053..d42a6f77 100644 --- a/lib/drmtest.h +++ b/lib/drmtest.h @@ -72,6 +72,7 @@ void gem_read(int fd, uint32_t handle, uint32_t offset, void *buf, uint32_t size void gem_set_domain(int fd, uint32_t handle, uint32_t read_domains, uint32_t write_domain); void gem_sync(int fd, uint32_t handle); +uint32_t __gem_create(int fd, int size); uint32_t gem_create(int fd, int size); void gem_execbuf(int fd, struct drm_i915_gem_execbuffer2 *execbuf); |