public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Subject: [igt-dev] [CI 2/5] tests/psr: Avoid opening of already open debugfs dir
Date: Wed,  5 Sep 2018 14:15:56 -0700	[thread overview]
Message-ID: <20180905211559.30713-2-dhinakaran.pandiyan@intel.com> (raw)
In-Reply-To: <20180905211559.30713-1-dhinakaran.pandiyan@intel.com>

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@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@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

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2018-09-05 21:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-05 21:15 [igt-dev] [CI 1/5] lib/debugfs: Function to read debugfs with the directory already open Dhinakaran Pandiyan
2018-09-05 21:15 ` Dhinakaran Pandiyan [this message]
2018-09-05 21:15 ` [igt-dev] [CI 3/5] tests/fbcon_fbt: Avoid opening debugfs dir repeatedly Dhinakaran Pandiyan
2018-09-05 21:15 ` [igt-dev] [CI 4/5] tests/psr: Test PSR1 in kms_psr Dhinakaran Pandiyan
2018-09-05 21:15 ` [igt-dev] [CI 5/5] tests/fbcon_fbt: Enable PSR1 via debugfs Dhinakaran Pandiyan
2018-09-05 22:58 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [CI,1/5] lib/debugfs: Function to read debugfs with the directory already open Patchwork
2018-09-06  8:10 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180905211559.30713-2-dhinakaran.pandiyan@intel.com \
    --to=dhinakaran.pandiyan@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox