[Intel-gfx] [PATCH i-g-t] lib: Be strict in applying verification for spin batch

Chris Wilson chris at chris-wilson.co.uk
Thu Jan 24 07:31:41 UTC 2019


We want to test batch promotion fully, so be strict in asking for it.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala at intel.com>
---
 lib/i915/gem_submission.c | 12 ++++++++++++
 lib/i915/gem_submission.h |  6 ++++++
 lib/igt_dummyload.c       |  5 +++++
 3 files changed, 23 insertions(+)

diff --git a/lib/i915/gem_submission.c b/lib/i915/gem_submission.c
index 2fd460d5e..0550a780a 100644
--- a/lib/i915/gem_submission.c
+++ b/lib/i915/gem_submission.c
@@ -229,3 +229,15 @@ 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;
+}
diff --git a/lib/i915/gem_submission.h b/lib/i915/gem_submission.h
index f94eabb20..137bce8d1 100644
--- a/lib/i915/gem_submission.h
+++ b/lib/i915/gem_submission.h
@@ -33,6 +33,12 @@ 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;
+}
+
 void gem_test_engine(int fd, unsigned int engine);
 
 int gem_reopen_driver(int fd);
diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c
index 982906f29..3bb78503a 100644
--- a/lib/igt_dummyload.c
+++ b/lib/igt_dummyload.c
@@ -40,6 +40,8 @@
 #include "sw_sync.h"
 #include "igt_vgem.h"
 
+#include "i915/gem_submission.h"
+
 /**
  * SECTION:igt_dummyload
  * @short_description: Library for submitting GPU workloads
@@ -313,6 +315,9 @@ igt_spin_batch_factory(int fd, const struct igt_spin_factory *opts)
 			igt_require(gem_can_store_dword(fd, opts->engine));
 	}
 
+	if (opts->flags & IGT_SPIN_POLL_RUN)
+		igt_require(!gem_cmdparser_version(fd, opts->engine));
+
 	spin = spin_batch_create(fd, opts);
 
 	igt_assert(gem_bo_busy(fd, spin->handle));
-- 
2.20.1



More information about the Intel-gfx mailing list