[PATCH i-g-t 5/5] lib: Use drm-uapi/i915_drm.h instead of local defines.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The MMAP_V2 is replaced by just using MMAP, since the official header
has the updated struct.  The gem_create_v2 and gem_get_aperture are
left as is, because they seem to not be reflected in the UABI header!

Signed-off-by: Eric Anholt <eric@xxxxxxxxxx>
---
 benchmarks/Makefile.am |  6 ++++-
 benchmarks/gem_wsim.c  |  6 ++---
 lib/i915/gem_context.c | 46 ++++++++++++++++------------------
 lib/i915/gem_context.h | 19 +++-----------
 lib/igt_gt.c           | 38 ++++++++++++++--------------
 lib/ioctl_wrappers.c   | 67 ++++++++++++++------------------------------------
 tests/Makefile.am      |  3 ++-
 tests/gem_ctx_param.c  | 38 ++++++++++++++--------------
 8 files changed, 92 insertions(+), 131 deletions(-)

diff --git a/benchmarks/Makefile.am b/benchmarks/Makefile.am
index d066112a32a2..9f2671be192b 100644
--- a/benchmarks/Makefile.am
+++ b/benchmarks/Makefile.am
@@ -8,7 +8,11 @@ if HAVE_LIBDRM_INTEL
 benchmarks_PROGRAMS += $(LIBDRM_INTEL_BENCHMARKS)
 endif
 
-AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/lib
+AM_CPPFLAGS = \
+	-I$(top_srcdir) \
+	-I$(top_srcdir)/include/drm-uapi \
+	-I$(top_srcdir)/lib
+
 AM_CFLAGS = $(DRM_CFLAGS) $(CWARNFLAGS) $(CAIRO_CFLAGS) $(LIBUNWIND_CFLAGS) \
 	    $(WERROR_CFLAGS) -D_GNU_SOURCE
 LDADD = $(top_builddir)/lib/libintel_tools.la
diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c
index 82fe6ba9ec5f..063f3ca37f00 100644
--- a/benchmarks/gem_wsim.c
+++ b/benchmarks/gem_wsim.c
@@ -893,9 +893,9 @@ prepare_workload(unsigned int id, struct workload *wrk, unsigned int flags)
 			}
 
 			if (wrk->prio) {
-				struct local_i915_gem_context_param param = {
-					.context = arg.ctx_id,
-					.param = 0x6,
+				struct drm_i915_gem_context_param param = {
+					.ctx_id = arg.ctx_id,
+					.param = I915_CONTEXT_PARAM_PRIORITY,
 					.value = wrk->prio,
 				};
 				gem_context_set_param(fd, &param);
diff --git a/lib/i915/gem_context.c b/lib/i915/gem_context.c
index 6d9edf5e3263..8f383a9726ec 100644
--- a/lib/i915/gem_context.c
+++ b/lib/i915/gem_context.c
@@ -100,11 +100,9 @@ void gem_context_destroy(int fd, uint32_t ctx_id)
 	do_ioctl(fd, DRM_IOCTL_I915_GEM_CONTEXT_DESTROY, &destroy);
 }
 
-int __gem_context_get_param(int fd, struct local_i915_gem_context_param *p)
+int __gem_context_get_param(int fd, struct drm_i915_gem_context_param *p)
 {
-#define LOCAL_I915_GEM_CONTEXT_GETPARAM       0x34
-#define LOCAL_IOCTL_I915_GEM_CONTEXT_GETPARAM DRM_IOWR (DRM_COMMAND_BASE + LOCAL_I915_GEM_CONTEXT_GETPARAM, struct local_i915_gem_context_param)
-	if (igt_ioctl(fd, LOCAL_IOCTL_I915_GEM_CONTEXT_GETPARAM, p))
+	if (igt_ioctl(fd, DRM_IOCTL_I915_GEM_CONTEXT_GETPARAM, p))
 		return -errno;
 
 	errno = 0;
@@ -119,17 +117,15 @@ int __gem_context_get_param(int fd, struct local_i915_gem_context_param *p)
  * This wraps the CONTEXT_GET_PARAM ioctl, which is used to get a context
  * parameter.
  */
-void gem_context_get_param(int fd, struct local_i915_gem_context_param *p)
+void gem_context_get_param(int fd, struct drm_i915_gem_context_param *p)
 {
 	igt_assert(__gem_context_get_param(fd, p) == 0);
 }
 
 
-int __gem_context_set_param(int fd, struct local_i915_gem_context_param *p)
+int __gem_context_set_param(int fd, struct drm_i915_gem_context_param *p)
 {
-#define LOCAL_I915_GEM_CONTEXT_SETPARAM       0x35
-#define LOCAL_IOCTL_I915_GEM_CONTEXT_SETPARAM DRM_IOWR (DRM_COMMAND_BASE + LOCAL_I915_GEM_CONTEXT_SETPARAM, struct local_i915_gem_context_param)
-	if (igt_ioctl(fd, LOCAL_IOCTL_I915_GEM_CONTEXT_SETPARAM, p))
+	if (igt_ioctl(fd, DRM_IOCTL_I915_GEM_CONTEXT_SETPARAM, p))
 		return -errno;
 
 	errno = 0;
@@ -143,7 +139,7 @@ int __gem_context_set_param(int fd, struct local_i915_gem_context_param *p)
  * This wraps the CONTEXT_SET_PARAM ioctl, which is used to set a context
  * parameter.
  */
-void gem_context_set_param(int fd, struct local_i915_gem_context_param *p)
+void gem_context_set_param(int fd, struct drm_i915_gem_context_param *p)
 {
 	igt_assert(__gem_context_set_param(fd, p) == 0);
 }
@@ -158,14 +154,14 @@ void gem_context_set_param(int fd, struct local_i915_gem_context_param *p)
  */
 void gem_context_require_param(int fd, uint64_t param)
 {
-	struct local_i915_gem_context_param p;
+	struct drm_i915_gem_context_param p;
 
-	p.context = 0;
+	p.ctx_id = 0;
 	p.param = param;
 	p.value = 0;
 	p.size = 0;
 
-	igt_require(igt_ioctl(fd, LOCAL_IOCTL_I915_GEM_CONTEXT_GETPARAM, &p) == 0);
+	igt_require(igt_ioctl(fd, DRM_IOCTL_I915_GEM_CONTEXT_GETPARAM, &p) == 0);
 }
 
 void gem_context_require_bannable(int fd)
@@ -174,31 +170,31 @@ void gem_context_require_bannable(int fd)
 	static int has_bannable = -1;
 
 	if (has_bannable < 0) {
-		struct local_i915_gem_context_param p;
+		struct drm_i915_gem_context_param p;
 
-		p.context = 0;
-		p.param = LOCAL_CONTEXT_PARAM_BANNABLE;
+		p.ctx_id = 0;
+		p.param = I915_CONTEXT_PARAM_BANNABLE;
 		p.value = 0;
 		p.size = 0;
 
-		has_bannable = igt_ioctl(fd, LOCAL_IOCTL_I915_GEM_CONTEXT_GETPARAM, &p) == 0;
+		has_bannable = igt_ioctl(fd, DRM_IOCTL_I915_GEM_CONTEXT_GETPARAM, &p) == 0;
 	}
 
 	if (has_ban_period < 0) {
-		struct local_i915_gem_context_param p;
+		struct drm_i915_gem_context_param p;
 
-		p.context = 0;
-		p.param = LOCAL_CONTEXT_PARAM_BAN_PERIOD;
+		p.ctx_id = 0;
+		p.param = I915_CONTEXT_PARAM_BAN_PERIOD;
 		p.value = 0;
 		p.size = 0;
 
-		has_ban_period = igt_ioctl(fd, LOCAL_IOCTL_I915_GEM_CONTEXT_GETPARAM, &p) == 0;
+		has_ban_period = igt_ioctl(fd, DRM_IOCTL_I915_GEM_CONTEXT_GETPARAM, &p) == 0;
 	}
 
 	igt_require(has_ban_period || has_bannable);
 }
 
-#define LOCAL_I915_CONTEXT_PARAM_PRIORITY 0x6
+#define DRM_I915_CONTEXT_PARAM_PRIORITY 0x6
 
 /**
  * __gem_context_set_priority:
@@ -214,12 +210,12 @@ void gem_context_require_bannable(int fd)
  */
 int __gem_context_set_priority(int fd, uint32_t ctx_id, int prio)
 {
-	struct local_i915_gem_context_param p;
+	struct drm_i915_gem_context_param p;
 
 	memset(&p, 0, sizeof(p));
-	p.context = ctx_id;
+	p.ctx_id = ctx_id;
 	p.size = 0;
-	p.param = LOCAL_I915_CONTEXT_PARAM_PRIORITY;
+	p.param = DRM_I915_CONTEXT_PARAM_PRIORITY;
 	p.value = prio;
 
 	return __gem_context_set_param(fd, &p);
diff --git a/lib/i915/gem_context.h b/lib/i915/gem_context.h
index a2339c4b6da2..96106b718ffb 100644
--- a/lib/i915/gem_context.h
+++ b/lib/i915/gem_context.h
@@ -27,23 +27,12 @@
 uint32_t gem_context_create(int fd);
 void gem_context_destroy(int fd, uint32_t ctx_id);
 int __gem_context_destroy(int fd, uint32_t ctx_id);
-struct local_i915_gem_context_param {
-	uint32_t context;
-	uint32_t size;
-	uint64_t param;
-#define LOCAL_CONTEXT_PARAM_BAN_PERIOD	0x1
-#define LOCAL_CONTEXT_PARAM_NO_ZEROMAP	0x2
-#define LOCAL_CONTEXT_PARAM_GTT_SIZE	0x3
-#define LOCAL_CONTEXT_PARAM_NO_ERROR_CAPTURE	0x4
-#define LOCAL_CONTEXT_PARAM_BANNABLE	0x5
-	uint64_t value;
-};
 void gem_context_require_bannable(int fd);
 void gem_context_require_param(int fd, uint64_t param);
-void gem_context_get_param(int fd, struct local_i915_gem_context_param *p);
-void gem_context_set_param(int fd, struct local_i915_gem_context_param *p);
-int __gem_context_set_param(int fd, struct local_i915_gem_context_param *p);
-int __gem_context_get_param(int fd, struct local_i915_gem_context_param *p);
+void gem_context_get_param(int fd, struct drm_i915_gem_context_param *p);
+void gem_context_set_param(int fd, struct drm_i915_gem_context_param *p);
+int __gem_context_set_param(int fd, struct drm_i915_gem_context_param *p);
+int __gem_context_get_param(int fd, struct drm_i915_gem_context_param *p);
 
 #define LOCAL_I915_CONTEXT_MAX_USER_PRIORITY	1023
 #define LOCAL_I915_CONTEXT_DEFAULT_PRIORITY	0
diff --git a/lib/igt_gt.c b/lib/igt_gt.c
index 89727d22dd5c..64a2dfd62da7 100644
--- a/lib/igt_gt.c
+++ b/lib/igt_gt.c
@@ -126,15 +126,15 @@ void igt_require_hang_ring(int fd, int ring)
 
 static unsigned context_get_ban(int fd, unsigned ctx)
 {
-	struct local_i915_gem_context_param param;
+	struct drm_i915_gem_context_param param;
 
-	param.param = LOCAL_CONTEXT_PARAM_BANNABLE;
+	param.param = I915_CONTEXT_PARAM_BANNABLE;
 	param.value = 0;
 	param.size = 0;
 
 	if (__gem_context_get_param(fd, &param) == -EINVAL) {
 		igt_assert(param.value == 0);
-		param.param = LOCAL_CONTEXT_PARAM_BAN_PERIOD;
+		param.param = I915_CONTEXT_PARAM_BAN_PERIOD;
 		gem_context_get_param(fd, &param);
 	}
 
@@ -143,24 +143,24 @@ static unsigned context_get_ban(int fd, unsigned ctx)
 
 static void context_set_ban(int fd, unsigned ctx, unsigned ban)
 {
-	struct local_i915_gem_context_param param;
+	struct drm_i915_gem_context_param param;
 
 	memset(&param, 0, sizeof(param));
-	param.context = ctx;
+	param.ctx_id = ctx;
 	param.value = ban;
 	param.size = 0;
-	param.param = LOCAL_CONTEXT_PARAM_BANNABLE;
+	param.param = I915_CONTEXT_PARAM_BANNABLE;
 
 	if(__gem_context_set_param(fd, &param) == -EINVAL) {
 		igt_assert(param.value == ban);
-		param.param = LOCAL_CONTEXT_PARAM_BAN_PERIOD;
+		param.param = I915_CONTEXT_PARAM_BAN_PERIOD;
 		gem_context_set_param(fd, &param);
 	}
 }
 
 igt_hang_t igt_allow_hang(int fd, unsigned ctx, unsigned flags)
 {
-	struct local_i915_gem_context_param param;
+	struct drm_i915_gem_context_param param;
 	unsigned ban;
 
 	igt_assert(igt_sysfs_set_parameter
@@ -172,11 +172,11 @@ igt_hang_t igt_allow_hang(int fd, unsigned ctx, unsigned flags)
 	if (!igt_check_boolean_env_var("IGT_HANG_WITHOUT_RESET", false))
 		igt_require(has_gpu_reset(fd));
 
-	param.context = ctx;
+	param.ctx_id = ctx;
 	param.size = 0;
 
 	if ((flags & HANG_ALLOW_CAPTURE) == 0) {
-		param.param = LOCAL_CONTEXT_PARAM_NO_ERROR_CAPTURE;
+		param.param = I915_CONTEXT_PARAM_NO_ERROR_CAPTURE;
 		param.value = 1;
 		/* Older kernels may not have NO_ERROR_CAPTURE, in which case
 		 * we just eat the error state in post-hang (and hope we eat
@@ -198,9 +198,9 @@ void igt_disallow_hang(int fd, igt_hang_t arg)
 	context_set_ban(fd, arg.ctx, arg.ban);
 
 	if ((arg.flags & HANG_ALLOW_CAPTURE) == 0) {
-		struct local_i915_gem_context_param param = {
-			.context = arg.ctx,
-			.param = LOCAL_CONTEXT_PARAM_NO_ERROR_CAPTURE,
+		struct drm_i915_gem_context_param param = {
+			.ctx_id = arg.ctx,
+			.param = I915_CONTEXT_PARAM_NO_ERROR_CAPTURE,
 			.value = 0,
 		};
 		__gem_context_set_param(fd, &param);
@@ -272,7 +272,7 @@ igt_hang_t igt_hang_ctx(int fd,
 	struct drm_i915_gem_relocation_entry reloc;
 	struct drm_i915_gem_execbuffer2 execbuf;
 	struct drm_i915_gem_exec_object2 exec;
-	struct local_i915_gem_context_param param;
+	struct drm_i915_gem_context_param param;
 	uint32_t b[16];
 	unsigned ban;
 	unsigned len;
@@ -282,11 +282,11 @@ igt_hang_t igt_hang_ctx(int fd,
 	/* check if non-default ctx submission is allowed */
 	igt_require(ctx == 0 || has_ctx_exec(fd, ring, ctx));
 
-	param.context = ctx;
+	param.ctx_id = ctx;
 	param.size = 0;
 
 	if ((flags & HANG_ALLOW_CAPTURE) == 0) {
-		param.param = LOCAL_CONTEXT_PARAM_NO_ERROR_CAPTURE;
+		param.param = I915_CONTEXT_PARAM_NO_ERROR_CAPTURE;
 		param.value = 1;
 		/* Older kernels may not have NO_ERROR_CAPTURE, in which case
 		 * we just eat the error state in post-hang (and hope we eat
@@ -371,9 +371,9 @@ void igt_post_hang_ring(int fd, igt_hang_t arg)
 	context_set_ban(fd, arg.ctx, arg.ban);
 
 	if ((arg.flags & HANG_ALLOW_CAPTURE) == 0) {
-		struct local_i915_gem_context_param param = {
-			.context = arg.ctx,
-			.param = LOCAL_CONTEXT_PARAM_NO_ERROR_CAPTURE,
+		struct drm_i915_gem_context_param param = {
+			.ctx_id = arg.ctx,
+			.param = I915_CONTEXT_PARAM_NO_ERROR_CAPTURE,
 			.value = 0,
 		};
 		__gem_context_set_param(fd, &param);
diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
index d98e7660a96f..118dcefe7936 100644
--- a/lib/ioctl_wrappers.c
+++ b/lib/ioctl_wrappers.c
@@ -197,21 +197,9 @@ void gem_set_tiling(int fd, uint32_t handle, uint32_t tiling, uint32_t stride)
 	igt_assert(__gem_set_tiling(fd, handle, tiling, stride) == 0);
 }
 
-struct local_drm_i915_gem_caching {
-	uint32_t handle;
-	uint32_t caching;
-};
-
-#define LOCAL_DRM_I915_GEM_SET_CACHEING    0x2f
-#define LOCAL_DRM_I915_GEM_GET_CACHEING    0x30
-#define LOCAL_DRM_IOCTL_I915_GEM_SET_CACHEING \
-	DRM_IOW(DRM_COMMAND_BASE + LOCAL_DRM_I915_GEM_SET_CACHEING, struct local_drm_i915_gem_caching)
-#define LOCAL_DRM_IOCTL_I915_GEM_GET_CACHEING \
-	DRM_IOWR(DRM_COMMAND_BASE + LOCAL_DRM_I915_GEM_GET_CACHEING, struct local_drm_i915_gem_caching)
-
 static int __gem_set_caching(int fd, uint32_t handle, uint32_t caching)
 {
-	struct local_drm_i915_gem_caching arg;
+	struct drm_i915_gem_caching arg;
 	int err;
 
 	memset(&arg, 0, sizeof(arg));
@@ -219,7 +207,7 @@ static int __gem_set_caching(int fd, uint32_t handle, uint32_t caching)
 	arg.caching = caching;
 
 	err = 0;
-	if (igt_ioctl(fd, LOCAL_DRM_IOCTL_I915_GEM_SET_CACHEING, &arg)) {
+	if (igt_ioctl(fd, DRM_IOCTL_I915_GEM_SET_CACHING, &arg)) {
 		err = -errno;
 		igt_assert(errno == ENOTTY || errno == EINVAL);
 	}
@@ -254,12 +242,12 @@ void gem_set_caching(int fd, uint32_t handle, uint32_t caching)
  */
 uint32_t gem_get_caching(int fd, uint32_t handle)
 {
-	struct local_drm_i915_gem_caching arg;
+	struct drm_i915_gem_caching arg;
 	int ret;
 
 	memset(&arg, 0, sizeof(arg));
 	arg.handle = handle;
-	ret = ioctl(fd, LOCAL_DRM_IOCTL_I915_GEM_GET_CACHEING, &arg);
+	ret = ioctl(fd, DRM_IOCTL_I915_GEM_GET_CACHING, &arg);
 	igt_assert(ret == 0);
 	errno = 0;
 
@@ -616,9 +604,6 @@ 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
@@ -630,7 +615,7 @@ void gem_execbuf(int fd, struct drm_i915_gem_execbuffer2 *execbuf)
 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))
+	if (igt_ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2_WR, execbuf))
 		err = -errno;
 	errno = 0;
 	return err;
@@ -710,17 +695,6 @@ int gem_munmap(void *ptr, uint64_t size)
 	return ret;
 }
 
-struct local_i915_gem_mmap_v2 {
-	uint32_t handle;
-	uint32_t pad;
-	uint64_t offset;
-	uint64_t size;
-	uint64_t addr_ptr;
-	uint64_t flags;
-#define I915_MMAP_WC 0x1
-};
-#define LOCAL_IOCTL_I915_GEM_MMAP_v2 DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP, struct local_i915_gem_mmap_v2)
-
 bool gem_mmap__has_wc(int fd)
 {
 	static int has_wc = -1;
@@ -744,7 +718,7 @@ bool gem_mmap__has_wc(int fd)
 
 		/* Do we have the new mmap_ioctl with DOMAIN_WC? */
 		if (mmap_version >= 1 && gtt_version >= 2) {
-			struct local_i915_gem_mmap_v2 arg;
+			struct drm_i915_gem_mmap arg;
 
 			/* Does this device support wc-mmaps ? */
 			memset(&arg, 0, sizeof(arg));
@@ -752,7 +726,7 @@ bool gem_mmap__has_wc(int fd)
 			arg.offset = 0;
 			arg.size = 4096;
 			arg.flags = I915_MMAP_WC;
-			has_wc = igt_ioctl(fd, LOCAL_IOCTL_I915_GEM_MMAP_v2, &arg) == 0;
+			has_wc = igt_ioctl(fd, DRM_IOCTL_I915_GEM_MMAP, &arg) == 0;
 			gem_close(fd, arg.handle);
 		}
 		errno = 0;
@@ -778,7 +752,7 @@ bool gem_mmap__has_wc(int fd)
  */
 void *__gem_mmap__wc(int fd, uint32_t handle, uint64_t offset, uint64_t size, unsigned prot)
 {
-	struct local_i915_gem_mmap_v2 arg;
+	struct drm_i915_gem_mmap arg;
 
 	if (!gem_mmap__has_wc(fd)) {
 		errno = ENOSYS;
@@ -790,7 +764,7 @@ void *__gem_mmap__wc(int fd, uint32_t handle, uint64_t offset, uint64_t size, un
 	arg.offset = offset;
 	arg.size = size;
 	arg.flags = I915_MMAP_WC;
-	if (igt_ioctl(fd, LOCAL_IOCTL_I915_GEM_MMAP_v2, &arg))
+	if (igt_ioctl(fd, DRM_IOCTL_I915_GEM_MMAP, &arg))
 		return NULL;
 
 	VG(VALGRIND_MAKE_MEM_DEFINED(from_user_pointer(arg.addr_ptr), arg.size));
@@ -896,16 +870,16 @@ int gem_madvise(int fd, uint32_t handle, int state)
 
 int __gem_userptr(int fd, void *ptr, int size, int read_only, uint32_t flags, uint32_t *handle)
 {
-	struct local_i915_gem_userptr userptr;
+	struct drm_i915_gem_userptr userptr;
 
 	memset(&userptr, 0, sizeof(userptr));
 	userptr.user_ptr = to_user_pointer(ptr);
 	userptr.user_size = size;
 	userptr.flags = flags;
 	if (read_only)
-		userptr.flags |= LOCAL_I915_USERPTR_READ_ONLY;
+		userptr.flags |= I915_USERPTR_READ_ONLY;
 
-	if (igt_ioctl(fd, LOCAL_IOCTL_I915_GEM_USERPTR, &userptr))
+	if (igt_ioctl(fd, DRM_IOCTL_I915_GEM_USERPTR, &userptr))
 		return -errno;
 
 	*handle = userptr.handle;
@@ -1179,7 +1153,6 @@ bool gem_has_blt(int fd)
 	return has_blt;
 }
 
-#define LOCAL_I915_PARAM_HAS_VEBOX 22
 /**
  * gem_has_vebox:
  * @fd: open i915 drm file descriptor
@@ -1195,11 +1168,11 @@ bool gem_has_vebox(int fd)
 {
 	static int has_vebox = -1;
 	if (has_vebox < 0)
-		has_vebox =  has_param(fd, LOCAL_I915_PARAM_HAS_VEBOX);
+		has_vebox =  has_param(fd, I915_PARAM_HAS_VEBOX);
 	return has_vebox;
 }
 
-#define LOCAL_I915_PARAM_HAS_BSD2 31
+#define I915_PARAM_HAS_BSD2 31
 /**
  * gem_has_bsd2:
  * @fd: open i915 drm file descriptor
@@ -1214,7 +1187,7 @@ bool gem_has_bsd2(int fd)
 {
 	static int has_bsd2 = -1;
 	if (has_bsd2 < 0)
-		has_bsd2 = has_param(fd, LOCAL_I915_PARAM_HAS_BSD2);
+		has_bsd2 = has_param(fd, I915_PARAM_HAS_BSD2);
 	return has_bsd2;
 }
 
@@ -1296,7 +1269,7 @@ uint64_t gem_aperture_size(int fd)
 	static uint64_t aperture_size = 0;
 
 	if (aperture_size == 0) {
-		struct local_i915_gem_context_param p;
+		struct drm_i915_gem_context_param p;
 
 		memset(&p, 0, sizeof(p));
 		p.param = 0x3;
@@ -1357,7 +1330,6 @@ uint64_t gem_global_aperture_size(int fd)
 	return aperture.aper_size;
 }
 
-#define LOCAL_I915_PARAM_HAS_EXEC_SOFTPIN 37
 /**
  * gem_has_softpin:
  * @fd: open i915 drm file descriptor
@@ -1375,7 +1347,7 @@ bool gem_has_softpin(int fd)
 		struct drm_i915_getparam gp;
 
 		memset(&gp, 0, sizeof(gp));
-		gp.param = LOCAL_I915_PARAM_HAS_EXEC_SOFTPIN;
+		gp.param = I915_PARAM_HAS_EXEC_SOFTPIN;
 		gp.value = &has_softpin;
 
 		has_softpin = 0;
@@ -1386,7 +1358,6 @@ bool gem_has_softpin(int fd)
 	return has_softpin;
 }
 
-#define LOCAL_PARAM_HAS_EXEC_FENCE 44
 /**
  * gem_has_exec_fence:
  * @fd: open i915 drm file descriptor
@@ -1404,7 +1375,7 @@ bool gem_has_exec_fence(int fd)
 		struct drm_i915_getparam gp;
 
 		memset(&gp, 0, sizeof(gp));
-		gp.param = LOCAL_PARAM_HAS_EXEC_FENCE;
+		gp.param = I915_PARAM_HAS_EXEC_FENCE;
 		gp.value = &has_exec_fence;
 
 		has_exec_fence = 0;
@@ -1676,7 +1647,7 @@ int __kms_addfb(int fd, uint32_t handle, uint32_t width, uint32_t height,
 		uint32_t stride, uint32_t pixel_format, uint64_t modifier,
 		uint32_t flags, uint32_t *buf_id)
 {
-	struct local_drm_mode_fb_cmd2 f;
+	struct drm_mode_fb_cmd2 f;
 	int ret;
 
 	igt_require_fb_modifiers(fd);
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 27acfb358582..36f7d7a0b10a 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -84,7 +84,7 @@ EXTRA_DIST = \
 
 CLEANFILES = $(EXTRA_PROGRAMS) test-list.txt test-list-full.txt .gitignore
 
-AM_CFLAGS = $(DRM_CFLAGS) $(CWARNFLAGS) -Wno-unused-result $(DEBUG_CFLAGS)\
+AM_CFLAGS = $(CWARNFLAGS) -Wno-unused-result $(DEBUG_CFLAGS)\
 	-I$(top_srcdir)/include/drm-uapi \
 	-I$(srcdir)/.. \
 	-I$(srcdir)/../lib \
@@ -92,6 +92,7 @@ AM_CFLAGS = $(DRM_CFLAGS) $(CWARNFLAGS) -Wno-unused-result $(DEBUG_CFLAGS)\
 	-DIGT_SRCDIR=\""$(abs_srcdir)"\" \
 	-DIGT_DATADIR=\""$(pkgdatadir)"\" \
 	-D_GNU_SOURCE \
+	$(DRM_CFLAGS) \
 	$(LIBUNWIND_CFLAGS) $(WERROR_CFLAGS) \
 	$(NULL)
 
diff --git a/tests/gem_ctx_param.c b/tests/gem_ctx_param.c
index efdaf191a1ed..c20ae1eefea1 100644
--- a/tests/gem_ctx_param.c
+++ b/tests/gem_ctx_param.c
@@ -30,7 +30,7 @@ IGT_TEST_DESCRIPTION("Basic test for context set/get param input validation.");
 
 igt_main
 {
-	struct local_i915_gem_context_param arg;
+	struct drm_i915_gem_context_param arg;
 	int fd;
 	uint32_t ctx;
 
@@ -41,46 +41,46 @@ igt_main
 		ctx = gem_context_create(fd);
 	}
 
-	arg.param = LOCAL_CONTEXT_PARAM_BAN_PERIOD;
+	arg.param = I915_CONTEXT_PARAM_BAN_PERIOD;
 
 	/* XXX start to enforce ban period returning -EINVAL when
 	 * transition has been done */
 	if (__gem_context_get_param(fd, &arg) == -EINVAL)
-		arg.param = LOCAL_CONTEXT_PARAM_BANNABLE;
+		arg.param = I915_CONTEXT_PARAM_BANNABLE;
 
 	igt_subtest("basic") {
-		arg.context = ctx;
+		arg.ctx_id = ctx;
 		gem_context_get_param(fd, &arg);
 		gem_context_set_param(fd, &arg);
 	}
 
 	igt_subtest("basic-default") {
-		arg.context = 0;
+		arg.ctx_id = 0;
 		gem_context_get_param(fd, &arg);
 		gem_context_set_param(fd, &arg);
 	}
 
 	igt_subtest("invalid-ctx-get") {
-		arg.context = 2;
+		arg.ctx_id = 2;
 		igt_assert_eq(__gem_context_get_param(fd, &arg), -ENOENT);
 	}
 
 	igt_subtest("invalid-ctx-set") {
-		arg.context = ctx;
+		arg.ctx_id = ctx;
 		gem_context_get_param(fd, &arg);
-		arg.context = 2;
+		arg.ctx_id = 2;
 		igt_assert_eq(__gem_context_set_param(fd, &arg), -ENOENT);
 	}
 
 	igt_subtest("invalid-size-get") {
-		arg.context = ctx;
+		arg.ctx_id = ctx;
 		arg.size = 8;
 		gem_context_get_param(fd, &arg);
 		igt_assert(arg.size == 0);
 	}
 
 	igt_subtest("invalid-size-set") {
-		arg.context = ctx;
+		arg.ctx_id = ctx;
 		gem_context_get_param(fd, &arg);
 		arg.size = 8;
 		igt_assert_eq(__gem_context_set_param(fd, &arg), -EINVAL);
@@ -91,7 +91,7 @@ igt_main
 		igt_fork(child, 1) {
 			igt_drop_root();
 
-			arg.context = ctx;
+			arg.ctx_id = ctx;
 			gem_context_get_param(fd, &arg);
 			arg.value--;
 			igt_assert_eq(__gem_context_set_param(fd, &arg), -EPERM);
@@ -101,19 +101,19 @@ igt_main
 	}
 
 	igt_subtest("root-set") {
-		arg.context = ctx;
+		arg.ctx_id = ctx;
 		gem_context_get_param(fd, &arg);
 		arg.value--;
 		gem_context_set_param(fd, &arg);
 	}
 
-	arg.param = LOCAL_CONTEXT_PARAM_NO_ZEROMAP;
+	arg.param = I915_CONTEXT_PARAM_NO_ZEROMAP;
 
 	igt_subtest("non-root-set-no-zeromap") {
 		igt_fork(child, 1) {
 			igt_drop_root();
 
-			arg.context = ctx;
+			arg.ctx_id = ctx;
 			gem_context_get_param(fd, &arg);
 			arg.value--;
 			gem_context_set_param(fd, &arg);
@@ -123,14 +123,14 @@ igt_main
 	}
 
 	igt_subtest("root-set-no-zeromap-enabled") {
-		arg.context = ctx;
+		arg.ctx_id = ctx;
 		gem_context_get_param(fd, &arg);
 		arg.value = 1;
 		gem_context_set_param(fd, &arg);
 	}
 
 	igt_subtest("root-set-no-zeromap-disabled") {
-		arg.context = ctx;
+		arg.ctx_id = ctx;
 		gem_context_get_param(fd, &arg);
 		arg.value = 0;
 		gem_context_set_param(fd, &arg);
@@ -140,15 +140,15 @@ igt_main
 	 * to catch ABI extensions. Don't "fix" this testcase without adding all
 	 * the tests for the new param first.
 	 */
-	arg.param = LOCAL_CONTEXT_PARAM_BANNABLE + 1;
+	arg.param = I915_CONTEXT_PARAM_BANNABLE + 1;
 
 	igt_subtest("invalid-param-get") {
-		arg.context = ctx;
+		arg.ctx_id = ctx;
 		igt_assert_eq(__gem_context_get_param(fd, &arg), -EINVAL);
 	}
 
 	igt_subtest("invalid-param-set") {
-		arg.context = ctx;
+		arg.ctx_id = ctx;
 		igt_assert_eq(__gem_context_set_param(fd, &arg), -EINVAL);
 	}
 
-- 
2.15.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux