diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2015-02-18 15:58:06 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2015-02-18 16:04:12 +0000 |
commit | eaa7e6183cedee10acfa321ac3c66bfe58c0ed5a (patch) | |
tree | 20a84d07613de8b3df42e09a1c45c44a5805c19b /lib/drmtest.c | |
parent | a22548fec06faba738a2d59b45b54704e4757685 (diff) |
lib: Cache DRM device id to reduce number of ioctls
The DRM device id for the igfx is fixed, since there can only be one in
the system. So once we query it for the first time we can safely report
that value on every subsequent request, cutting out a lot of noisy
ioctls from inside tests.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib/drmtest.c')
-rw-r--r-- | lib/drmtest.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/drmtest.c b/lib/drmtest.c index 1d6e882c..ee5c1232 100644 --- a/lib/drmtest.c +++ b/lib/drmtest.c @@ -73,6 +73,8 @@ * and [batchbuffer](intel-gpu-tools-intel-batchbuffer.html) libraries as dependencies. */ +uint16_t __drm_device_id; + static int is_i915_device(int fd) { drm_version_t version; @@ -101,7 +103,11 @@ is_intel(int fd) if (ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp, sizeof(gp))) return 0; - return IS_INTEL(devid); + if (!IS_INTEL(devid)) + return 0; + + __drm_device_id = devid; + return 1; } static void check_stop_rings(void) |