From bfa6fa9a4bfdd7988a1ed68c9c97f9cc53d0f50c Mon Sep 17 00:00:00 2001 From: Mika Kuoppala Date: Tue, 25 Mar 2014 12:21:44 +0200 Subject: lib: add igt_get_stop_rings and igt_set_stop_rings Multiple tests are introducing hangs by fidding with i915_ring_stop debugfs entry. Signed-off-by: Mika Kuoppala --- lib/drmtest.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'lib/drmtest.c') diff --git a/lib/drmtest.c b/lib/drmtest.c index b1bf5892..2c9cf62c 100644 --- a/lib/drmtest.c +++ b/lib/drmtest.c @@ -88,6 +88,18 @@ is_intel(int fd) return IS_INTEL(devid); } +static void check_stop_rings(void) +{ + enum stop_ring_flags flags; + flags = igt_get_stop_rings(); + igt_warn_on_f(flags != 0, + "i915_ring_stop flags on exit 0x%x, can't quiescent gpu cleanly\n", + flags); + + if (flags) + igt_set_stop_rings(STOP_RING_NONE); +} + #define LOCAL_I915_EXEC_VEBOX (4 << 0) /** * gem_quiescent_gpu: @@ -108,6 +120,8 @@ void gem_quiescent_gpu(int fd) struct drm_i915_gem_execbuffer2 execbuf; struct drm_i915_gem_exec_object2 gem_exec[1]; + check_stop_rings(); + handle = gem_create(fd, 4096); gem_write(fd, handle, 0, batch, sizeof(batch)); @@ -252,6 +266,7 @@ static void quiescent_gpu_at_exit(int sig) if (at_exit_drm_fd < 0) return; + check_stop_rings(); gem_quiescent_gpu(at_exit_drm_fd); close(at_exit_drm_fd); at_exit_drm_fd = -1; @@ -262,6 +277,7 @@ static void quiescent_gpu_at_exit_render(int sig) if (at_exit_drm_render_fd < 0) return; + check_stop_rings(); gem_quiescent_gpu(at_exit_drm_render_fd); close(at_exit_drm_render_fd); at_exit_drm_render_fd = -1; -- cgit v1.2.3