From 301ad44cdf1b868b1ab89096721da91fa8541fdc Mon Sep 17 00:00:00 2001 From: Tomeu Vizoso Date: Thu, 2 Mar 2017 10:37:11 +0100 Subject: 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 Reviewed-by: Robert Foss Acked-by: Chris Wilson --- tools/intel_infoframes.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'tools/intel_infoframes.c') diff --git a/tools/intel_infoframes.c b/tools/intel_infoframes.c index e03cb2c0..813430c9 100644 --- a/tools/intel_infoframes.c +++ b/tools/intel_infoframes.c @@ -1081,6 +1081,7 @@ printf("Options:\n" int main(int argc, char *argv[]) { int opt; + int drm_fd; int ret = 0; Transcoder transcoder = TRANSC_INVALID; DipType dip = DIP_INVALID; @@ -1107,8 +1108,11 @@ int main(int argc, char *argv[]) printf("WARNING: This is just a debugging tool! Don't expect it to work" " perfectly: the Kernel might undo our changes.\n"); + /* Just to make sure we open the right debugfs files */ + drm_fd = drm_open_driver_master(DRIVER_INTEL); + pci_dev = intel_get_pci_device(); - intel_register_access_init(pci_dev, 0); + intel_register_access_init(pci_dev, 0, drm_fd); intel_check_pch(); if (IS_GEN4(pci_dev->device_id)) @@ -1257,5 +1261,6 @@ int main(int argc, char *argv[]) out: intel_register_access_fini(); + close(drm_fd); return ret; } -- cgit v1.2.3