[Intel-gfx] [PATCH IGT 06/11] lib: Add function to return PSR active status
Jim Bride
jim.bride at linux.intel.com
Tue Jul 11 22:48:31 UTC 2017
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 at 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(-)
diff --git a/lib/igt_psr.c b/lib/igt_psr.c
index c5c9b4c..d849961 100644
--- a/lib/igt_psr.c
+++ b/lib/igt_psr.c
@@ -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;
+}
diff --git a/lib/igt_psr.h b/lib/igt_psr.h
index 98774c8..b678329 100644
--- a/lib/igt_psr.h
+++ b/lib/igt_psr.h
@@ -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 */
diff --git a/tests/kms_fbcon_fbt.c b/tests/kms_fbcon_fbt.c
index d0ed9f5..41ab36d 100644
--- a/tests/kms_fbcon_fbt.c
+++ b/tests/kms_fbcon_fbt.c
@@ -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)
diff --git a/tests/kms_frontbuffer_tracking.c b/tests/kms_frontbuffer_tracking.c
index 347dcc1..b202297 100644
--- a/tests/kms_frontbuffer_tracking.c
+++ b/tests/kms_frontbuffer_tracking.c
@@ -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)
diff --git a/tests/kms_psr_sink_crc.c b/tests/kms_psr_sink_crc.c
index 952a109..0c27fc7 100644
--- a/tests/kms_psr_sink_crc.c
+++ b/tests/kms_psr_sink_crc.c
@@ -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)
--
2.7.4
More information about the Intel-gfx
mailing list