@@ -40,6 +40,31 @@
#define VG(x) do {} while (0)
#endif
+/**
+ * gem_mmap__gtt_version:
+ * @fd: open i915 drm file descriptor
+ *
+ * This functions wraps up an IOCTL to obtain MMAP_GTT interface version
+ *
+ * Returns: MMAP_GTT interface version, kernel error code on failure.
+ */
+int gem_mmap__gtt_version(int fd)
+{
+ int result = -EIO;
+ struct drm_i915_getparam gp = {
+ .param = I915_PARAM_MMAP_GTT_VERSION,
+ .value = &result,
+ };
+
+ if (ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp)) {
+ result = -errno;
+ igt_assume(result);
+ }
+
+ errno = 0;
+ return result;
+}
+
/**
* __gem_mmap__gtt:
* @fd: open i915 drm file descriptor
@@ -25,6 +25,7 @@
#ifndef GEM_MMAN_H
#define GEM_MMAN_H
+int gem_mmap__gtt_version(int fd);
void *gem_mmap__gtt(int fd, uint32_t handle, uint64_t size, unsigned prot);
void *gem_mmap__cpu(int fd, uint32_t handle, uint64_t offset, uint64_t size, unsigned prot);