Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH i-g-t] i915/gem_spin_batch: Add test to resend spinner
Date: Tue, 16 Apr 2019 18:01:58 +0300	[thread overview]
Message-ID: <20190416150158.23416-1-mika.kuoppala@linux.intel.com> (raw)
In-Reply-To: <155542514280.25605.16703785038972529984@skylake-alporthouse-com>

Add subtests to resend the same spinner to same context
and to other context.

v2: other engines (Chris)

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
---
 tests/i915/gem_spin_batch.c | 67 ++++++++++++++++++++++++++++++++-----
 1 file changed, 58 insertions(+), 9 deletions(-)

diff --git a/tests/i915/gem_spin_batch.c b/tests/i915/gem_spin_batch.c
index 52410010..9afdbe09 100644
--- a/tests/i915/gem_spin_batch.c
+++ b/tests/i915/gem_spin_batch.c
@@ -66,6 +66,48 @@ static void spin(int fd, unsigned int engine, unsigned int timeout_sec)
 	assert_within_epsilon(timeout_100ms * loops, elapsed, MAX_ERROR);
 }
 
+#define RESUBMIT_NEW_CTX     (1 << 0)
+#define RESUBMIT_ALL_ENGINES (1 << 1)
+
+static void spin_resubmit(int fd, unsigned int engine, unsigned int flags)
+{
+	const uint32_t ctx0 = gem_context_create(fd);
+	const uint32_t ctx1 = (flags & RESUBMIT_NEW_CTX) ?
+		gem_context_create(fd) : ctx0;
+	igt_spin_t *spin = __igt_spin_batch_new(fd, .ctx = ctx0, .engine = engine);
+	unsigned int other;
+
+	struct drm_i915_gem_execbuffer2 eb = {
+		.buffer_count = 1,
+		.buffers_ptr = to_user_pointer(&spin->obj[1]),
+		.rsvd1 = ctx1,
+	};
+
+	if (flags & RESUBMIT_ALL_ENGINES) {
+		for_each_physical_engine(fd, other) {
+			if  (other == engine)
+				continue;
+
+			eb.flags = other;
+			gem_execbuf(fd, &eb);
+		}
+	} else {
+		eb.flags = engine;
+		gem_execbuf(fd, &eb);
+	}
+
+	igt_spin_batch_end(spin);
+
+	gem_sync(fd, spin->obj[1].handle);
+
+	igt_spin_batch_free(fd, spin);
+
+	if (ctx1 != ctx0)
+		gem_context_destroy(fd, ctx1);
+
+	gem_context_destroy(fd, ctx0);
+}
+
 static void spin_exit_handler(int sig)
 {
 	igt_terminate_spin_batches();
@@ -96,22 +138,29 @@ igt_main
 		fd = drm_open_driver(DRIVER_INTEL);
 		igt_require_gem(fd);
 		igt_fork_hang_detector(fd);
-		intel_detect_and_clear_missed_interrupts(fd);
 	}
 
 	for (e = intel_execution_engines; e->name; e++) {
-		igt_subtest_f("basic-%s", e->name) {
-			intel_detect_and_clear_missed_interrupts(fd);
+		igt_subtest_f("basic-%s", e->name)
 			spin(fd, e->exec_id, 3);
-			igt_assert_eq(intel_detect_and_clear_missed_interrupts(fd), 0);
-		}
+
+		igt_subtest_f("resubmit-%s", e->name)
+			spin_resubmit(fd, e->exec_id, 0);
+
+		igt_subtest_f("resubmit-new-%s", e->name)
+			spin_resubmit(fd, e->exec_id, RESUBMIT_NEW_CTX);
+
+		igt_subtest_f("resubmit-all-%s", e->name)
+			spin_resubmit(fd, e->exec_id, RESUBMIT_ALL_ENGINES);
+
+		igt_subtest_f("resubmit-new-all-%s", e->name)
+			spin_resubmit(fd, e->exec_id,
+				      RESUBMIT_NEW_CTX |
+				      RESUBMIT_ALL_ENGINES);
 	}
 
-	igt_subtest("spin-each") {
-		intel_detect_and_clear_missed_interrupts(fd);
+	igt_subtest("spin-each")
 		spin_on_all_engines(fd, 3);
-		igt_assert_eq(intel_detect_and_clear_missed_interrupts(fd), 0);
-	}
 
 	igt_fixture {
 		igt_stop_hang_detector();
-- 
2.17.1

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

  reply	other threads:[~2019-04-16 15:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-16 14:23 [PATCH i-g-t] i915/gem_spin_batch: Add test to resend spinner Mika Kuoppala
2019-04-16 14:32 ` Chris Wilson
2019-04-16 15:01   ` Mika Kuoppala [this message]
2019-04-16 15:11     ` Chris Wilson
2019-04-17 11:31       ` Mika Kuoppala
2019-04-16 16:34 ` ✓ Fi.CI.BAT: success for i915/gem_spin_batch: Add test to resend spinner (rev2) Patchwork
2019-04-17  0:14 ` ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190416150158.23416-1-mika.kuoppala@linux.intel.com \
    --to=mika.kuoppala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox