[2/5] igt/gem_ctx_switch: Do a warmup pass over all contexts

Submitted by Chris Wilson on Jan. 16, 2018, 3:09 p.m.

Details

Message ID 20180116150943.10748-2-chris@chris-wilson.co.uk
State New
Series "Series without cover letter"
Headers show

Commit Message

Chris Wilson Jan. 16, 2018, 3:09 p.m.
Ensure that we always use every context at least once before we start
running the stress-test.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/gem_ctx_switch.c | 7 +++++++
 1 file changed, 7 insertions(+)

Patch hide | download patch | download mbox

diff --git a/tests/gem_ctx_switch.c b/tests/gem_ctx_switch.c
index fdd67202f..159554e52 100644
--- a/tests/gem_ctx_switch.c
+++ b/tests/gem_ctx_switch.c
@@ -115,6 +115,13 @@  static void single(int fd, uint32_t handle,
 		struct timespec start, now;
 		unsigned int count = 0;
 
+		/* Warmup */
+		for (int i = 0; i < ARRAY_SIZE(contexts); i++) {
+			execbuf.rsvd1 = contexts[i];
+			gem_execbuf(fd, &execbuf);
+		}
+		gem_sync(fd, handle);
+
 		clock_gettime(CLOCK_MONOTONIC, &start);
 		do {
 			igt_while_interruptible(flags & INTERRUPTIBLE) {