[Intel-gfx] [PATCH i-g-t 3/3] i915/gem_softpin: Replace constant loop with timeout

Chris Wilson chris at chris-wilson.co.uk
Sat Oct 5 10:55:56 UTC 2019


Rather than do a fixed amount of work that takes *forever*, run for a
fixed amount of time.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 tests/i915/gem_softpin.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tests/i915/gem_softpin.c b/tests/i915/gem_softpin.c
index c29097ad3..032056c08 100644
--- a/tests/i915/gem_softpin.c
+++ b/tests/i915/gem_softpin.c
@@ -102,14 +102,14 @@ static void test_softpin(int fd)
 	struct drm_i915_gem_exec_object2 object;
 	uint64_t offset, end;
 	uint32_t last_handle;
-	int loop;
+	unsigned long count = 0;
 
 	last_handle = gem_create(fd, size);
 
 	memset(&execbuf, 0, sizeof(execbuf));
 	execbuf.buffers_ptr = to_user_pointer(&object);
 	execbuf.buffer_count = 1;
-	for (loop = 0; loop < 1024; loop++) {
+	igt_until_timeout(30) {
 		memset(&object, 0, sizeof(object));
 		object.handle = gem_create(fd, 2*size);
 		gem_write(fd, object.handle, 0, &bbe, sizeof(bbe));
@@ -134,7 +134,9 @@ static void test_softpin(int fd)
 		}
 
 		last_handle = object.handle;
+		count++;
 	}
+	igt_info("Completd %lu cycles\n", count);
 }
 
 static void test_overlap(int fd)
-- 
2.23.0



More information about the Intel-gfx mailing list