Commit 0eb4d05e authored by Dhinakaran Pandiyan's avatar Dhinakaran Pandiyan

tests/psr: Avoid opening of already open debugfs dir

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's avatarDhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Reviewed-by: José Roberto de Souza's avatarJosé Roberto de Souza <jose.souza@intel.com>
parent 219b578b
......@@ -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;
......
......@@ -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,
......
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment