[i-g-t] igt/gem_blits: Check for blitter support before use
diff mbox series

Message ID 20190913163955.15993-1-chris@chris-wilson.co.uk
State New
Headers show
Series
  • [i-g-t] igt/gem_blits: Check for blitter support before use
Related show

Commit Message

Chris Wilson Sept. 13, 2019, 4:39 p.m. UTC
Not all HW supports XY blitter commands, so check before use. In
particular, this makes it easier to debug the kernel.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.auld@intel.com>
---
 lib/i915/gem_submission.c                   | 28 +++++++++++++++++++++
 lib/i915/gem_submission.h                   |  9 +++++++
 tests/i915/gem_bad_blit.c                   |  1 +
 tests/i915/gem_evict_alignment.c            |  1 +
 tests/i915/gem_evict_everything.c           |  1 +
 tests/i915/gem_linear_blits.c               |  1 +
 tests/i915/gem_persistent_relocs.c          |  1 +
 tests/i915/gem_reloc_vs_gpu.c               |  1 +
 tests/i915/gem_request_retire.c             |  1 +
 tests/i915/gem_set_tiling_vs_blt.c          |  1 +
 tests/i915/gem_softpin.c                    |  1 +
 tests/i915/gem_tiled_blits.c                |  1 +
 tests/i915/gem_tiled_fence_blits.c          |  1 +
 tests/i915/gem_tiled_partial_pwrite_pread.c |  1 +
 tests/i915/gem_userptr_blits.c              |  1 +
 15 files changed, 50 insertions(+)

Patch
diff mbox series

diff --git a/lib/i915/gem_submission.c b/lib/i915/gem_submission.c
index 7602d7f68..4f9464931 100644
--- a/lib/i915/gem_submission.c
+++ b/lib/i915/gem_submission.c
@@ -225,3 +225,31 @@  void gem_test_engine(int i915, unsigned int engine)
 	igt_assert(!is_wedged(i915));
 	close(i915);
 }
+
+int gem_cmdparser_version(int i915, uint32_t engine)
+{
+	int version = 0;
+	drm_i915_getparam_t gp = {
+		.param = I915_PARAM_CMD_PARSER_VERSION,
+		.value = &version,
+	};
+
+	ioctl(i915, DRM_IOCTL_I915_GETPARAM, &gp);
+	return version;
+}
+
+bool gem_has_blitter(int i915)
+{
+	unsigned int blt;
+
+	blt = 0;
+	if (intel_gen(intel_get_drm_devid(i915)) >= 6)
+		blt = I915_EXEC_BLT;
+
+	return gem_has_ring(i915, blt);
+}
+
+void gem_require_blitter(int i915)
+{
+	igt_require(gem_has_blitter(i915));
+}
diff --git a/lib/i915/gem_submission.h b/lib/i915/gem_submission.h
index 1f1d63fe5..6deb7e2d0 100644
--- a/lib/i915/gem_submission.h
+++ b/lib/i915/gem_submission.h
@@ -35,6 +35,15 @@  bool gem_has_semaphores(int fd);
 bool gem_has_execlists(int fd);
 bool gem_has_guc_submission(int fd);
 
+int gem_cmdparser_version(int i915, uint32_t engine);
+static inline bool gem_has_cmdparser(int i915, uint32_t engine)
+{
+	return gem_cmdparser_version(i915, engine) > 0;
+}
+
+bool gem_has_blitter(int i915);
+void gem_require_blitter(int i915);
+
 void gem_test_engine(int fd, unsigned int engine);
 
 int gem_reopen_driver(int fd);
diff --git a/tests/i915/gem_bad_blit.c b/tests/i915/gem_bad_blit.c
index 45dfc809b..27a34038c 100644
--- a/tests/i915/gem_bad_blit.c
+++ b/tests/i915/gem_bad_blit.c
@@ -98,6 +98,7 @@  igt_simple_main
 
 	fd = drm_open_driver(DRIVER_INTEL);
 	igt_require_gem(fd);
+	gem_require_blitter(fd);
 
 	bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
 	drm_intel_bufmgr_gem_enable_reuse(bufmgr);
diff --git a/tests/i915/gem_evict_alignment.c b/tests/i915/gem_evict_alignment.c
index 140d55837..da13fb656 100644
--- a/tests/i915/gem_evict_alignment.c
+++ b/tests/i915/gem_evict_alignment.c
@@ -195,6 +195,7 @@  igt_main
 	igt_fixture {
 		fd = drm_open_driver(DRIVER_INTEL);
 		igt_require_gem(fd);
+		gem_require_blitter(fd);
 		igt_fork_hang_detector(fd);
 	}
 
diff --git a/tests/i915/gem_evict_everything.c b/tests/i915/gem_evict_everything.c
index f36076482..2580a0b23 100644
--- a/tests/i915/gem_evict_everything.c
+++ b/tests/i915/gem_evict_everything.c
@@ -185,6 +185,7 @@  igt_main
 	igt_fixture {
 		fd = drm_open_driver(DRIVER_INTEL);
 		igt_require_gem(fd);
+		gem_require_blitter(fd);
 
 		size = 1024 * 1024;
 		count = gem_aperture_size(fd);
diff --git a/tests/i915/gem_linear_blits.c b/tests/i915/gem_linear_blits.c
index a5359288e..07ca2f29e 100644
--- a/tests/i915/gem_linear_blits.c
+++ b/tests/i915/gem_linear_blits.c
@@ -227,6 +227,7 @@  igt_main
 	igt_fixture {
 		fd = drm_open_driver(DRIVER_INTEL);
 		igt_require_gem(fd);
+		gem_require_blitter(fd);
 	}
 
 	igt_subtest("basic")
diff --git a/tests/i915/gem_persistent_relocs.c b/tests/i915/gem_persistent_relocs.c
index dff4e9a76..2ab7091ad 100644
--- a/tests/i915/gem_persistent_relocs.c
+++ b/tests/i915/gem_persistent_relocs.c
@@ -326,6 +326,7 @@  igt_main
 	igt_fixture {
 		fd = drm_open_driver(DRIVER_INTEL);
 		igt_require_gem(fd);
+		gem_require_blitter(fd);
 
 		bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
 		/* disable reuse, otherwise the test fails */
diff --git a/tests/i915/gem_reloc_vs_gpu.c b/tests/i915/gem_reloc_vs_gpu.c
index 328730a9b..46f145177 100644
--- a/tests/i915/gem_reloc_vs_gpu.c
+++ b/tests/i915/gem_reloc_vs_gpu.c
@@ -304,6 +304,7 @@  igt_main
 	igt_fixture {
 		fd = drm_open_driver(DRIVER_INTEL);
 		igt_require_gem(fd);
+		gem_require_blitter(fd);
 		bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
 		/* disable reuse, otherwise the test fails */
 		//drm_intel_bufmgr_gem_enable_reuse(bufmgr);
diff --git a/tests/i915/gem_request_retire.c b/tests/i915/gem_request_retire.c
index 304882e2b..7efea0b61 100644
--- a/tests/i915/gem_request_retire.c
+++ b/tests/i915/gem_request_retire.c
@@ -225,6 +225,7 @@  igt_main
 	igt_fixture {
 		fd = drm_open_driver(DRIVER_INTEL);
 		igt_require_gem(fd);
+		gem_require_blitter(fd);
 
 		gem_require_contexts(fd);
 	}
diff --git a/tests/i915/gem_set_tiling_vs_blt.c b/tests/i915/gem_set_tiling_vs_blt.c
index ae1af4ca9..012305472 100644
--- a/tests/i915/gem_set_tiling_vs_blt.c
+++ b/tests/i915/gem_set_tiling_vs_blt.c
@@ -233,6 +233,7 @@  igt_main
 
 		fd = drm_open_driver(DRIVER_INTEL);
 		igt_require_gem(fd);
+		gem_require_blitter(fd);
 
 		bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
 		drm_intel_bufmgr_gem_enable_reuse(bufmgr);
diff --git a/tests/i915/gem_softpin.c b/tests/i915/gem_softpin.c
index 42650e049..c29097ad3 100644
--- a/tests/i915/gem_softpin.c
+++ b/tests/i915/gem_softpin.c
@@ -483,6 +483,7 @@  igt_main
 	igt_fixture {
 		fd = drm_open_driver_master(DRIVER_INTEL);
 		igt_require_gem(fd);
+		gem_require_blitter(fd);
 		igt_require(gem_has_softpin(fd));
 		igt_require(gem_can_store_dword(fd, 0));
 	}
diff --git a/tests/i915/gem_tiled_blits.c b/tests/i915/gem_tiled_blits.c
index 28861d0b4..df0699f36 100644
--- a/tests/i915/gem_tiled_blits.c
+++ b/tests/i915/gem_tiled_blits.c
@@ -203,6 +203,7 @@  igt_main
 	igt_fixture {
 		fd = drm_open_driver(DRIVER_INTEL);
 		igt_require_gem(fd);
+		gem_require_blitter(fd);
 
 		bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
 		drm_intel_bufmgr_gem_enable_reuse(bufmgr);
diff --git a/tests/i915/gem_tiled_fence_blits.c b/tests/i915/gem_tiled_fence_blits.c
index aacd42b73..ef03c73b5 100644
--- a/tests/i915/gem_tiled_fence_blits.c
+++ b/tests/i915/gem_tiled_fence_blits.c
@@ -213,6 +213,7 @@  igt_main
 	igt_fixture {
 		fd = drm_open_driver(DRIVER_INTEL);
 		igt_require_gem(fd);
+		gem_require_blitter(fd);
 	}
 
 	igt_subtest("basic")
diff --git a/tests/i915/gem_tiled_partial_pwrite_pread.c b/tests/i915/gem_tiled_partial_pwrite_pread.c
index c2f44c9d8..3d160b0f7 100644
--- a/tests/i915/gem_tiled_partial_pwrite_pread.c
+++ b/tests/i915/gem_tiled_partial_pwrite_pread.c
@@ -269,6 +269,7 @@  igt_main
 	igt_fixture {
 		fd = drm_open_driver(DRIVER_INTEL);
 		igt_require_gem(fd);
+		gem_require_blitter(fd);
 
 		bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
 		//drm_intel_bufmgr_gem_enable_reuse(bufmgr);
diff --git a/tests/i915/gem_userptr_blits.c b/tests/i915/gem_userptr_blits.c
index 5f7770c93..3fad7d1b3 100644
--- a/tests/i915/gem_userptr_blits.c
+++ b/tests/i915/gem_userptr_blits.c
@@ -1832,6 +1832,7 @@  igt_main_args("c:", NULL, help_str, opt_handler, NULL)
 		fd = drm_open_driver(DRIVER_INTEL);
 		igt_assert(fd >= 0);
 		igt_require_gem(fd);
+		gem_require_blitter(fd);
 
 		size = sizeof(linear);