diff options
| author | Lukasz Fiedorowicz <lukasz.fiedorowicz@intel.com> | 2017-05-25 09:40:54 +0200 |
|---|---|---|
| committer | Petri Latvala <petri.latvala@intel.com> | 2017-05-31 17:04:37 +0300 |
| commit | 9fc445dabf788516d9f6d4956a05277bda1e7f04 (patch) | |
| tree | 7d06cb94367c0a062aaa8f22402da23d554a625d /lib | |
| parent | d9dcfc3a91cc197d07433cc4fbaaa76929b38e29 (diff) | |
lib: Moving gem_execbuf_wr to ioctl_wrappers
gem_execbuf_wr was duplicated in multiple places.
Moving everything to lib/
Signed-off-by: Lukasz Fiedorowicz <lukasz.fiedorowicz@intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/ioctl_wrappers.c | 33 | ||||
| -rw-r--r-- | lib/ioctl_wrappers.h | 2 |
2 files changed, 35 insertions, 0 deletions
diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c index 48bdcc56..0816a7b6 100644 --- a/lib/ioctl_wrappers.c +++ b/lib/ioctl_wrappers.c @@ -624,6 +624,39 @@ void gem_execbuf(int fd, struct drm_i915_gem_execbuffer2 *execbuf) igt_assert_eq(__gem_execbuf(fd, execbuf), 0); } +#define LOCAL_IOCTL_I915_GEM_EXECBUFFER2_WR \ + DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER2, struct drm_i915_gem_execbuffer2) + +/** + * __gem_execbuf_wr: + * @fd: open i915 drm file descriptor + * @execbuf: execbuffer data structure + * + * This wraps the EXECBUFFER2_WR ioctl, which submits a batchbuffer for the gpu to + * run. This is allowed to fail, with -errno returned. + */ +int __gem_execbuf_wr(int fd, struct drm_i915_gem_execbuffer2 *execbuf) +{ + int err = 0; + if (igt_ioctl(fd, LOCAL_IOCTL_I915_GEM_EXECBUFFER2_WR, execbuf)) + err = -errno; + errno = 0; + return err; +} + +/** + * gem_execbuf_wr: + * @fd: open i915 drm file descriptor + * @execbuf: execbuffer data structure + * + * This wraps the EXECBUFFER2_WR ioctl, which submits a batchbuffer for the gpu to + * run. + */ +void gem_execbuf_wr(int fd, struct drm_i915_gem_execbuffer2 *execbuf) +{ + igt_assert_eq(__gem_execbuf_wr(fd, execbuf), 0); +} + /** * __gem_mmap__gtt: * @fd: open i915 drm file descriptor diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h index d6d8bad2..e1279d94 100644 --- a/lib/ioctl_wrappers.h +++ b/lib/ioctl_wrappers.h @@ -74,6 +74,8 @@ uint32_t __gem_create_stolen(int fd, uint64_t size); uint32_t gem_create_stolen(int fd, uint64_t size); uint32_t __gem_create(int fd, int size); uint32_t gem_create(int fd, uint64_t size); +void gem_execbuf_wr(int fd, struct drm_i915_gem_execbuffer2 *execbuf); +int __gem_execbuf_wr(int fd, struct drm_i915_gem_execbuffer2 *execbuf); void gem_execbuf(int fd, struct drm_i915_gem_execbuffer2 *execbuf); int __gem_execbuf(int fd, struct drm_i915_gem_execbuffer2 *execbuf); |
