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_gpu_top.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_gpu_top.c')
-rw-r--r-- | tools/intel_gpu_top.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c index 4f327c6d..78488764 100644 --- a/tools/intel_gpu_top.c +++ b/tools/intel_gpu_top.c @@ -46,6 +46,7 @@ #include "instdone.h" #include "intel_reg.h" #include "intel_chipset.h" +#include "drmtest.h" #define FORCEWAKE 0xA18C #define FORCEWAKE_ACK 0x130090 @@ -410,6 +411,7 @@ usage(const char *appname) int main(int argc, char **argv) { uint32_t devid; + int drm_fd; struct pci_device *pci_dev; struct ring render_ring = { .name = "render", @@ -510,8 +512,11 @@ int main(int argc, char **argv) top_bits_sorted[i] = &top_bits[i]; } + /* Just to make sure we open the right debugfs files */ + drm_fd = drm_open_driver_master(DRIVER_INTEL); + /* Grab access to the registers */ - intel_register_access_init(pci_dev, 0); + intel_register_access_init(pci_dev, 0, drm_fd); ring_init(&render_ring); if (IS_GEN4(devid) || IS_GEN5(devid)) @@ -714,5 +719,6 @@ int main(int argc, char **argv) fclose(output); intel_register_access_fini(); + close(drm_fd); return 0; } |