@@ -83,3 +83,22 @@ bool igt_psr_possible(int fd)
return igt_psr_source_support(fd) && igt_psr_sink_support(fd);
}
+
+/**
+ * igt_psr_active:
+ *
+ * Returns true if PSR is active on the panel.
+ */
+bool igt_psr_active(int fd)
+{
+ char buf[BUFSIZE];
+ bool actret = false;
+ bool hwactret = false;
+
+ igt_debugfs_read(fd, "i915_edp_psr_status", buf);
+ hwactret = (strstr(buf, "HW Enabled & Active bit: yes\n") != NULL);
+ actret = (strstr(buf, "Active: yes\n") != NULL);
+ igt_debug("hwactret: %s actret: %s\n", hwactret ? "true" : "false",
+ actret ? "true" : "false");
+ return hwactret && actret;
+}
@@ -30,5 +30,6 @@
bool igt_psr_source_support(int fd);
bool igt_psr_sink_support(int fd);
bool igt_psr_possible(int fd);
+bool igt_psr_active(int fd);
#endif /* IGT_PSR_H */
@@ -159,10 +159,7 @@ static bool connector_can_psr(drmModeConnectorPtr connector)
static bool psr_is_enabled(int fd)
{
- char buf[256];
-
- igt_debugfs_read(fd, "i915_edp_psr_status", buf);
- return strstr(buf, "\nActive: yes\n");
+ return igt_psr_active(fd);
}
static bool psr_wait_until_enabled(int fd)
@@ -800,11 +800,7 @@ static void fbc_print_status(void)
static bool psr_is_enabled(void)
{
- char buf[256];
-
- debugfs_read("i915_edp_psr_status", buf);
- return strstr(buf, "\nActive: yes\n") &&
- strstr(buf, "\nHW Enabled & Active bit: yes\n");
+ return igt_psr_active(drm.fd);
}
static void psr_print_status(void)
@@ -200,12 +200,9 @@ static bool psr_possible(data_t *data)
static bool psr_active(data_t *data)
{
- char buf[512];
-
- igt_debugfs_read(data->drm_fd, "i915_edp_psr_status", buf);
return running_with_psr_disabled ||
- strstr(buf, "HW Enabled & Active bit: yes\n");
+ igt_psr_active(data->drm_fd);
}
static bool wait_psr_entry(data_t *data)
Add igt_psr_active() which returns whether PSR is active or not and modify tests to use this function. Signed-off-by: Jim Bride <jim.bride@linux.intel.com> --- lib/igt_psr.c | 19 +++++++++++++++++++ lib/igt_psr.h | 1 + tests/kms_fbcon_fbt.c | 5 +---- tests/kms_frontbuffer_tracking.c | 6 +----- tests/kms_psr_sink_crc.c | 5 +---- 5 files changed, 23 insertions(+), 13 deletions(-)