summaryrefslogtreecommitdiff
path: root/lib/drmtest.c
diff options
context:
space:
mode:
authorMika Kuoppala <mika.kuoppala@intel.com>2014-03-25 12:21:44 +0200
committerMika Kuoppala <mika.kuoppala@intel.com>2014-04-10 17:40:48 +0300
commitbfa6fa9a4bfdd7988a1ed68c9c97f9cc53d0f50c (patch)
tree26240f18fdf6243ea20ab9fbe1b74d60d1f93245 /lib/drmtest.c
parent1c7ca57e531315f78f8ea3b9dce7bd92d7d79f64 (diff)
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 <mika.kuoppala@intel.com>
Diffstat (limited to 'lib/drmtest.c')
-rw-r--r--lib/drmtest.c16
1 files changed, 16 insertions, 0 deletions
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;