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).
This commit is contained in:
Chris Wilson 2015-06-15 14:51:54 +01:00
parent a5633c406c
commit c83299d1fd

View File

@ -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));
}
/**