[PATCH i-g-t] i915: Mark up a few more tests that only target GGTT

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

 



If a test is only targeting the GGTT API and its corner cases, it can
only run if we have a mappable aperture.

Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
Cc: Antonio Argenziano <antonio.argenziano@xxxxxxxxx>
---
 lib/i915/gem_mman.c             | 19 +++++++++++++++++++
 lib/i915/gem_mman.h             |  3 +++
 tests/i915/gem_gtt_cpu_tlb.c    |  1 +
 tests/i915/gem_gtt_hog.c        |  1 +
 tests/i915/gem_gtt_speed.c      |  2 ++
 tests/i915/gem_mmap_gtt.c       |  5 +----
 tests/i915/gem_tiled_swapping.c |  1 +
 7 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/lib/i915/gem_mman.c b/lib/i915/gem_mman.c
index 3cf9a6bbd..76d0be82e 100644
--- a/lib/i915/gem_mman.c
+++ b/lib/i915/gem_mman.c
@@ -252,3 +252,22 @@ void *gem_mmap__cpu(int fd, uint32_t handle, uint64_t offset, uint64_t size, uns
 	igt_assert(ptr);
 	return ptr;
 }
+
+bool gem_has_ggtt(int i915)
+{
+	struct drm_i915_gem_mmap_gtt arg = {};
+	int err;
+
+	err = 0;
+	if (ioctl(i915, DRM_IOCTL_I915_GEM_MMAP_GTT, &arg))
+		err = errno;
+	errno = 0;
+
+	return errno != ENODEV;
+}
+
+void gem_require_ggtt(int i915)
+{
+	igt_require_f(gem_has_ggtt(i915),
+		      "HW & kernel support for indirect detiling aperture\n");
+}
diff --git a/lib/i915/gem_mman.h b/lib/i915/gem_mman.h
index f7242ed77..67891c8de 100644
--- a/lib/i915/gem_mman.h
+++ b/lib/i915/gem_mman.h
@@ -35,6 +35,9 @@ void *gem_mmap__wc(int fd, uint32_t handle, uint64_t offset, uint64_t size, unsi
 #define I915_GEM_DOMAIN_WC 0x80
 #endif
 
+bool gem_has_ggtt(int i915);
+void gem_require_ggtt(int i915);
+
 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);
 void *__gem_mmap__wc(int fd, uint32_t handle, uint64_t offset, uint64_t size, unsigned prot);
diff --git a/tests/i915/gem_gtt_cpu_tlb.c b/tests/i915/gem_gtt_cpu_tlb.c
index cf3c543df..a4cbb1034 100644
--- a/tests/i915/gem_gtt_cpu_tlb.c
+++ b/tests/i915/gem_gtt_cpu_tlb.c
@@ -79,6 +79,7 @@ igt_simple_main
 	igt_skip_on_simulation();
 
 	fd = drm_open_driver(DRIVER_INTEL);
+	gem_require_ggtt(fd);
 
 	handle = gem_create(fd, OBJ_SIZE);
 
diff --git a/tests/i915/gem_gtt_hog.c b/tests/i915/gem_gtt_hog.c
index ca730649c..7a6273936 100644
--- a/tests/i915/gem_gtt_hog.c
+++ b/tests/i915/gem_gtt_hog.c
@@ -161,6 +161,7 @@ igt_simple_main
 	/* check for an intel gpu before goint nuts. */
 	int fd = drm_open_driver(DRIVER_INTEL);
 	igt_require_gem(fd);
+	gem_require_ggtt(fd);
 	close(fd);
 
 	igt_skip_on_simulation();
diff --git a/tests/i915/gem_gtt_speed.c b/tests/i915/gem_gtt_speed.c
index dfa7216cc..0cdd51dc3 100644
--- a/tests/i915/gem_gtt_speed.c
+++ b/tests/i915/gem_gtt_speed.c
@@ -124,7 +124,9 @@ igt_simple_main_args("s:", NULL, help_str, opt_handler, NULL)
 
 	buf = malloc(size);
 	memset(buf, 0, size);
+
 	fd = drm_open_driver(DRIVER_INTEL);
+	gem_require_ggtt(fd);
 
 	handle = gem_create(fd, size);
 	igt_assert(handle);
diff --git a/tests/i915/gem_mmap_gtt.c b/tests/i915/gem_mmap_gtt.c
index ac25f13e2..d31c73ed4 100644
--- a/tests/i915/gem_mmap_gtt.c
+++ b/tests/i915/gem_mmap_gtt.c
@@ -1020,8 +1020,6 @@ igt_main
 		OBJECT_SIZE = 1 * 1024 * 1024;
 
 	igt_fixture {
-		struct drm_i915_gem_mmap_gtt arg = {};
-
 		fd = drm_open_driver(DRIVER_INTEL);
 
 		/*
@@ -1029,8 +1027,7 @@ igt_main
 		 * detiling access from untrusted userspace to the objects,
 		 * the kernel does an early rejection of the mmap_gtt ioctl.
 		 */
-		igt_require_f(mmap_ioctl(fd, &arg) != -ENODEV,
-			      "HW & kernel support for indirect detiling aperture\n");
+		gem_require_ggtt(fd);
 	}
 
 	igt_subtest("bad-object") {
diff --git a/tests/i915/gem_tiled_swapping.c b/tests/i915/gem_tiled_swapping.c
index 1b70c1e51..3a95c9469 100644
--- a/tests/i915/gem_tiled_swapping.c
+++ b/tests/i915/gem_tiled_swapping.c
@@ -175,6 +175,7 @@ igt_main
 		current_tiling_mode = I915_TILING_X;
 
 		fd = drm_open_driver(DRIVER_INTEL);
+		gem_require_ggtt(fd);
 
 		intel_purge_vm_caches(fd);
 		check_memory_layout(fd);
-- 
2.24.0

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




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux