diff options
author | Tomeu Vizoso <tomeu.vizoso@collabora.com> | 2017-03-02 10:37:11 +0100 |
---|---|---|
committer | Tomeu Vizoso <tomeu.vizoso@collabora.com> | 2017-03-21 15:50:54 +0100 |
commit | 301ad44cdf1b868b1ab89096721da91fa8541fdc (patch) | |
tree | ef18781db6cadae7f8f49f1fc449dc56b33448ec /tools/intel_forcewaked.c | |
parent | e7a0d06730f77842998368660fb45fe5c1738fda (diff) |
lib: Open debugfs files for the given DRM device
When opening a DRM debugfs file, locate the right path based on the
given DRM device FD.
This is needed so, in setups with more than one DRM device, any
operations on debugfs files affect the expected DRM device.
v2: - rebased and fixed new API additions
v3: - updated chamelium test, which was missed previously
- use the minor of the device for the debugfs path, not the major
- have a proper exit handler for calling igt_hpd_storm_reset with the
right device fd.
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Robert Foss <robert.foss@collabora.com>
Acked-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'tools/intel_forcewaked.c')
-rw-r--r-- | tools/intel_forcewaked.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/intel_forcewaked.c b/tools/intel_forcewaked.c index 01ca0253..aa8e3f8b 100644 --- a/tools/intel_forcewaked.c +++ b/tools/intel_forcewaked.c @@ -36,6 +36,7 @@ #include <unistd.h> #include "intel_io.h" #include "intel_chipset.h" +#include "drmtest.h" bool daemonized; @@ -63,6 +64,7 @@ is_alive(void) { int main(int argc, char *argv[]) { + int drm_fd; int ret; if (argc > 2 || (argc == 2 && !strncmp(argv[1], "-h", 2))) { @@ -79,7 +81,10 @@ int main(int argc, char *argv[]) INFO_PRINT("started daemon"); } - ret = intel_register_access_init(intel_get_pci_device(), 1); + /* Just to make sure we open the right debugfs files */ + drm_fd = drm_open_driver_master(DRIVER_INTEL); + + ret = intel_register_access_init(intel_get_pci_device(), 1, drm_fd); if (ret) { INFO_PRINT("Couldn't init register access\n"); exit(1); @@ -90,13 +95,14 @@ int main(int argc, char *argv[]) if (!is_alive()) { INFO_PRINT("gpu reset? restarting daemon\n"); intel_register_access_fini(); - ret = intel_register_access_init(intel_get_pci_device(), 1); + ret = intel_register_access_init(intel_get_pci_device(), 1, drm_fd); if (ret) INFO_PRINT("Reg access init fail\n"); } sleep(1); } intel_register_access_fini(); + close(drm_fd); INFO_PRINT("Forcewake unlock\n"); if (daemonized) { |