summaryrefslogtreecommitdiff
path: root/lib/igt_gt.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2015-06-15 14:51:54 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2015-06-15 16:05:07 +0100
commitc83299d1fda4b8c67562999d61817177d422d52e (patch)
tree4001143ab762f9cc45d73dece4ea643cc73518da /lib/igt_gt.c
parenta5633c406c4ae93abc7fce8ff59d2c021a6aa45e (diff)
lib: Use HAS_GPU_RESET rather than opencode our guess
Uses kernel commit 49e4d842f0d0892c3d26c93a81b9f22c1467030e Author: Chris Wilson <chris@chris-wilson.co.uk> Date: Mon Jun 15 12:23:48 2015 +0100 drm/i915: Report to userspace if we have a (presumed) working GPU reset to determine whether the kernel has a working GPU reset before injecting a hang (and so skip tests requring hang recovery if not available).
Diffstat (limited to 'lib/igt_gt.c')
-rw-r--r--lib/igt_gt.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/igt_gt.c b/lib/igt_gt.c
index deb55606..1dcc3c3b 100644
--- a/lib/igt_gt.c
+++ b/lib/igt_gt.c
@@ -26,6 +26,7 @@
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/ioctl.h>
#include <fcntl.h>
#include "drmtest.h"
@@ -47,6 +48,20 @@
* engines.
*/
+static bool has_gpu_reset(int fd)
+{
+ struct drm_i915_getparam gp;
+ int val = 0;
+
+ memset(&gp, 0, sizeof(gp));
+ gp.param = 35; /* HAS_GPU_RESET */
+ gp.value = &val;
+
+ if (ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp))
+ return intel_gen(intel_get_drm_devid(fd)) >= 5;
+
+ return val > 0;
+}
/**
* igt_require_hang_ring:
@@ -60,7 +75,7 @@
void igt_require_hang_ring(int fd, int ring)
{
gem_context_require_ban_period(fd);
- igt_require(intel_gen(intel_get_drm_devid(fd)) >= 5);
+ igt_require(has_gpu_reset(fd));
}
/**