[igt-dev] [CI 2/5] tests/psr: Avoid opening of already open debugfs dir

Dhinakaran Pandiyan dhinakaran.pandiyan at intel.com
Wed Sep 5 21:15:56 UTC 2018


The tests calls igt_debugfs_dir() to open the debugfs dir and further
along calls igt_debugfs_read() each time i915_edp_psr_status needs to be
read. As igt_debugfs_read() opens the directory unnecessarily, switch to
using the newly added igt_debugfs_simple_read()
v2: Commit message typo (Jose)

Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan at intel.com>
Reviewed-by: José Roberto de Souza <jose.souza at intel.com>
---
 lib/igt_psr.c                    |  2 +-
 tests/kms_frontbuffer_tracking.c |  3 ++-
 tests/kms_psr.c                  | 10 ++++++----
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/lib/igt_psr.c b/lib/igt_psr.c
index bc142632..6c5cf43d 100644
--- a/lib/igt_psr.c
+++ b/lib/igt_psr.c
@@ -30,7 +30,7 @@ bool psr_active(int fd, bool check_active)
 	bool active;
 	char buf[512];
 
-	igt_debugfs_read(fd, "i915_edp_psr_status", buf);
+	igt_debugfs_simple_read(fd, "i915_edp_psr_status", buf, sizeof(buf));
 	active = strstr(buf, "HW Enabled & Active bit: yes\n") &&
 		(strstr(buf, "SRDENT") || strstr(buf, "SLEEP"));
 	return check_active ? active : !active;
diff --git a/tests/kms_frontbuffer_tracking.c b/tests/kms_frontbuffer_tracking.c
index eab84926..e9abceb6 100644
--- a/tests/kms_frontbuffer_tracking.c
+++ b/tests/kms_frontbuffer_tracking.c
@@ -1632,7 +1632,8 @@ static void do_status_assertions(int flags)
 	if (flags & ASSERT_PSR_ENABLED)
 		igt_assert_f(psr_wait_entry(drm.fd), "PSR still disabled\n");
 	else if (flags & ASSERT_PSR_DISABLED)
-		igt_assert_f(psr_active(drm.fd, false), "PSR still enabled\n");
+		igt_assert_f(psr_active(drm.debugfs, false),
+			     "PSR still enabled\n");
 }
 
 static void __do_assertions(const struct test_mode *t, int flags,
diff --git a/tests/kms_psr.c b/tests/kms_psr.c
index 218b3960..3e64cf04 100644
--- a/tests/kms_psr.c
+++ b/tests/kms_psr.c
@@ -192,7 +192,8 @@ static bool sink_support(data_t *data)
 {
 	char buf[512];
 
-	igt_debugfs_read(data->drm_fd, "i915_edp_psr_status", buf);
+	igt_debugfs_simple_read(data->debugfs_fd, "i915_edp_psr_status",
+			 buf, sizeof(buf));
 
 	return data->with_psr_disabled ||
 		strstr(buf, "Sink_Support: yes\n");
@@ -203,7 +204,7 @@ static bool psr_wait_entry_if_enabled(data_t *data)
 	if (data->with_psr_disabled)
 		return true;
 
-	return psr_wait_entry(data->drm_fd);
+	return psr_wait_entry(data->debugfs_fd);
 }
 
 static inline void manual(const char *expected)
@@ -215,7 +216,8 @@ static bool drrs_disabled(data_t *data)
 {
 	char buf[512];
 
-	igt_debugfs_read(data->drm_fd, "i915_drrs_status", buf);
+	igt_debugfs_simple_read(data->debugfs_fd, "i915_drrs_status",
+			 buf, sizeof(buf));
 
 	return !strstr(buf, "DRRS Supported: Yes\n");
 }
@@ -292,7 +294,7 @@ static void run_test(data_t *data)
 		expected = "screen GREEN";
 		break;
 	}
-	igt_assert(psr_active(data->drm_fd, false));
+	igt_assert(psr_active(data->debugfs_fd, false));
 	manual(expected);
 }
 
-- 
2.17.1



More information about the igt-dev mailing list