[igt-dev] [PATCH i-g-t 04/20] tests/psr: Store the debugfs file descriptor

Dhinakaran Pandiyan dhinakaran.pandiyan at intel.com
Wed Apr 11 02:37:16 UTC 2018


It will be reused to enable PSR debug in the later patches.

Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan at intel.com>
---
 tests/kms_psr_sink_crc.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/tests/kms_psr_sink_crc.c b/tests/kms_psr_sink_crc.c
index 1657ee8a..35c7b845 100644
--- a/tests/kms_psr_sink_crc.c
+++ b/tests/kms_psr_sink_crc.c
@@ -65,6 +65,7 @@ static const char *op_str(enum operations op)
 
 typedef struct {
 	int drm_fd;
+	int debugfs_fd;
 	int test_plane;
 	enum operations op;
 	uint32_t devid;
@@ -224,16 +225,14 @@ static bool wait_psr_entry(data_t *data)
 	return false;
 }
 
-static void get_sink_crc(data_t *data, char *crc) {
-	int dir;
-
+static void get_sink_crc(data_t *data, char *crc)
+{
 	if (igt_interactive_debug)
 		return;
 
-	dir = igt_debugfs_dir(data->drm_fd);
-	igt_require_f(igt_sysfs_scanf(dir, "i915_sink_crc_eDP1", "%s\n", crc),
+	igt_require_f(igt_sysfs_scanf(data->debugfs_fd, "i915_sink_crc_eDP1",
+				      "%s\n", crc),
 		      "Sink CRC is unreliable on this machine. Try manual debug with --interactive-debug=no-crc\n");
-	close(dir);
 
 	igt_debug("%s\n", crc);
 
@@ -508,6 +507,7 @@ int main(int argc, char *argv[])
 
 	igt_fixture {
 		data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
+		data.debugfs_fd = igt_debugfs_dir(data.drm_fd);
 		kmstest_set_vt_graphics_mode();
 		data.devid = intel_get_drm_devid(data.drm_fd);
 
@@ -619,6 +619,7 @@ int main(int argc, char *argv[])
 	}
 
 	igt_fixture {
+		close(data.debugfs_fd);
 		drm_intel_bufmgr_destroy(data.bufmgr);
 		display_fini(&data);
 	}
-- 
2.14.1



More information about the igt-dev mailing list