[igt-dev] [PATCH i-g-t] i915/gem_ctx_persistence: Sanitycheck execbuf state harder for 'queued'

Chris Wilson chris at chris-wilson.co.uk
Wed Oct 30 23:59:34 UTC 2019


And initialise fence to -1 to avoid closing stdin (fd:0)!

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 tests/i915/gem_ctx_persistence.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/tests/i915/gem_ctx_persistence.c b/tests/i915/gem_ctx_persistence.c
index 9273da159..fa6ee7516 100644
--- a/tests/i915/gem_ctx_persistence.c
+++ b/tests/i915/gem_ctx_persistence.c
@@ -363,10 +363,10 @@ static void test_nonpersistent_file(int i915)
 
 static void test_nonpersistent_queued(int i915, unsigned int engine)
 {
-	int count = gem_measure_ring_inflight(i915, engine, 0);
+	const int count = gem_measure_ring_inflight(i915, engine, 0);
 	igt_spin_t *spin;
+	int fence = -1;
 	uint32_t ctx;
-	int fence;
 
 	/*
 	 * Not only must the immediate batch be cancelled, but
@@ -383,10 +383,13 @@ static void test_nonpersistent_queued(int i915, unsigned int engine)
 			    .flags = IGT_SPIN_FENCE_OUT);
 
 	for (int i = 0; i < count - 1; i++) {
+		spin->execbuf.rsvd2 = 0;
 		if (fence != -1)
 			close(fence);
-		spin->execbuf.rsvd2 = 0;
+
+		igt_assert(spin->execbuf.flags & I915_EXEC_FENCE_OUT);
 		gem_execbuf_wr(i915, &spin->execbuf);
+
 		igt_assert(spin->execbuf.rsvd2);
 		fence = spin->execbuf.rsvd2 >> 32;
 	}
@@ -396,8 +399,7 @@ static void test_nonpersistent_queued(int i915, unsigned int engine)
 	igt_assert_eq(sync_fence_wait(fence, MSEC_PER_SEC / 5), 0);
 	igt_assert_eq(sync_fence_status(fence), -EIO);
 
-	spin->handle = 0;
-	igt_spin_free(-1, spin);
+	igt_spin_free(i915, spin);
 }
 
 static void sendfd(int socket, int fd)
-- 
2.24.0.rc1



More information about the igt-dev mailing list