mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-08 16:36:14 +00:00
lib: Allow to override the device id at run time
Using the same environment variable as libdrm so one doesn't have to remember two different things. This is helpful to run a test under a fake identity, to, say, dump an aub file. Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
This commit is contained in:
parent
75f52a6e3b
commit
aa2bd8a692
@ -54,12 +54,18 @@ intel_get_drm_devid(int fd)
|
||||
int ret;
|
||||
struct drm_i915_getparam gp;
|
||||
uint32_t devid;
|
||||
char *override;
|
||||
|
||||
gp.param = I915_PARAM_CHIPSET_ID;
|
||||
gp.value = (int *)&devid;
|
||||
override = getenv("INTEL_DEVID_OVERRIDE");
|
||||
if (override) {
|
||||
devid = strtod(override, NULL);
|
||||
} else {
|
||||
gp.param = I915_PARAM_CHIPSET_ID;
|
||||
gp.value = (int *)&devid;
|
||||
|
||||
ret = ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp, sizeof(gp));
|
||||
assert(ret == 0);
|
||||
ret = ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp, sizeof(gp));
|
||||
assert(ret == 0);
|
||||
}
|
||||
|
||||
return devid;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user