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 --- tests/gem_mocs_settings.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'tests/gem_mocs_settings.c') diff --git a/tests/gem_mocs_settings.c b/tests/gem_mocs_settings.c index 9faf6c54..a96aa66d 100644 --- a/tests/gem_mocs_settings.c +++ b/tests/gem_mocs_settings.c @@ -383,7 +383,7 @@ static void default_context_tests(unsigned mode) switch (mode) { case NONE: break; - case RESET: igt_force_gpu_reset(); break; + case RESET: igt_force_gpu_reset(fd); break; case SUSPEND: igt_system_suspend_autoresume(SUSPEND_STATE_MEM, SUSPEND_TEST_NONE); break; case HIBERNATE: igt_system_suspend_autoresume(SUSPEND_STATE_DISK, @@ -424,7 +424,7 @@ static void default_dirty_tests(unsigned mode) switch (mode) { case NONE: break; - case RESET: igt_force_gpu_reset(); break; + case RESET: igt_force_gpu_reset(fd); break; case SUSPEND: igt_system_suspend_autoresume(SUSPEND_STATE_MEM, SUSPEND_TEST_NONE); break; case HIBERNATE: igt_system_suspend_autoresume(SUSPEND_STATE_DISK, @@ -449,7 +449,7 @@ static void context_save_restore_test(unsigned mode) switch (mode) { case NONE: break; - case RESET: igt_force_gpu_reset(); break; + case RESET: igt_force_gpu_reset(fd); break; case SUSPEND: igt_system_suspend_autoresume(SUSPEND_STATE_MEM, SUSPEND_TEST_NONE); break; case HIBERNATE: igt_system_suspend_autoresume(SUSPEND_STATE_DISK, @@ -494,7 +494,7 @@ static void context_dirty_test(unsigned mode) switch (mode) { case NONE: break; - case RESET: igt_force_gpu_reset(); break; + case RESET: igt_force_gpu_reset(fd); break; case SUSPEND: igt_system_suspend_autoresume(SUSPEND_STATE_MEM, SUSPEND_TEST_NONE); break; case HIBERNATE: igt_system_suspend_autoresume(SUSPEND_STATE_DISK, @@ -514,10 +514,14 @@ static void context_dirty_test(unsigned mode) static void run_tests(unsigned mode) { struct pci_device *pci_dev; + int fd; pci_dev = intel_get_pci_device(); igt_require(pci_dev); - intel_register_access_init(pci_dev, 0); + + fd = drm_open_driver_master(DRIVER_INTEL); + intel_register_access_init(pci_dev, 0, fd); + close(fd); default_context_tests(mode); default_dirty_tests(mode); -- cgit v1.2.3