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>
This commit is contained in:
Mika Kuoppala
2014-03-25 12:21:44 +02:00
parent 1c7ca57e53
commit bfa6fa9a4b
3 changed files with 157 additions and 0 deletions
+16
View File
@@ -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;