summaryrefslogtreecommitdiff
path: root/lib/ioctl_wrappers.c
diff options
context:
space:
mode:
authorLukasz Fiedorowicz <lukasz.fiedorowicz@intel.com>2017-05-25 09:40:54 +0200
committerPetri Latvala <petri.latvala@intel.com>2017-05-31 17:04:37 +0300
commit9fc445dabf788516d9f6d4956a05277bda1e7f04 (patch)
tree7d06cb94367c0a062aaa8f22402da23d554a625d /lib/ioctl_wrappers.c
parentd9dcfc3a91cc197d07433cc4fbaaa76929b38e29 (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/ioctl_wrappers.c')
-rw-r--r--lib/ioctl_wrappers.c33
1 files changed, 33 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