[Intel-gfx] [PATCH igt 8/9] igt/gem_workarounds: Convert to real GPU hang injection

Chris Wilson chris at chris-wilson.co.uk
Sat Dec 12 12:02:54 PST 2015


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

diff --git a/tests/gem_workarounds.c b/tests/gem_workarounds.c
index 87c798b..90d4005 100644
--- a/tests/gem_workarounds.c
+++ b/tests/gem_workarounds.c
@@ -64,47 +64,16 @@ static struct intel_wa_reg *wa_regs;
 
 static void wait_gpu(void)
 {
-	struct drm_i915_gem_execbuffer2 execbuf;
-	struct drm_i915_gem_exec_object2 gem_exec;
-	uint32_t b[2] = {MI_BATCH_BUFFER_END};
-
-	memset(&gem_exec, 0, sizeof(gem_exec));
-	gem_exec.handle = gem_create(drm_fd, 4096);
-	gem_write(drm_fd, gem_exec.handle, 0, b, sizeof(b));
-
-	memset(&execbuf, 0, sizeof(execbuf));
-	execbuf.buffers_ptr = (uintptr_t)&gem_exec;
-	execbuf.buffer_count = 1;
-	execbuf.batch_len = sizeof(b);
-
-	drmIoctl(drm_fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
-
-	gem_sync(drm_fd, gem_exec.handle);
-
-	gem_close(drm_fd, gem_exec.handle);
+	int fd = drm_open_driver(DRIVER_INTEL);
+	gem_quiescent_gpu(fd);
+	close(fd);
 }
 
 static void test_hang_gpu(void)
 {
-	int retry_count = 30;
-	enum stop_ring_flags flags;
-
-	igt_assert(retry_count);
-	igt_set_stop_rings(STOP_RING_DEFAULTS);
-
-	wait_gpu();
-
-	while(retry_count--) {
-		flags = igt_get_stop_rings();
-		if (flags == 0)
-			break;
-		igt_info("gpu hang not yet cleared, retries left %d\n", retry_count);
-		sleep(1);
-	}
-
-	flags = igt_get_stop_rings();
-	if (flags)
-		igt_set_stop_rings(STOP_RING_NONE);
+	int fd = drm_open_driver(DRIVER_INTEL);
+	igt_post_hang_ring(fd, igt_hang_ring(fd, I915_EXEC_DEFAULT));
+	close(fd);
 }
 
 static void test_suspend_resume(void)
-- 
2.6.3



More information about the Intel-gfx mailing list