[igt-dev] [PATCH i-g-t CI 4/4] lib/igt_psr: Move "is enabled" implementation to lib
José Roberto de Souza
jose.souza at intel.com
Thu Nov 14 22:45:24 UTC 2019
i915_pm_dc have implemented a function to check if PSR2 is enabled,
that may be util to future tests so move it to PSR lib.
Cc: Jeevan B <jeevan.b at intel.com>
Cc: Anshuman Gupta <anshuman.gupta at intel.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler at intel.com>
Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler at intel.com>
Signed-off-by: José Roberto de Souza <jose.souza at intel.com>
---
lib/igt_psr.c | 16 ++++++++++++++++
lib/igt_psr.h | 1 +
tests/i915/i915_pm_dc.c | 13 +------------
3 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/lib/igt_psr.c b/lib/igt_psr.c
index 83ccacdd..32d69fea 100644
--- a/lib/igt_psr.c
+++ b/lib/igt_psr.c
@@ -210,3 +210,19 @@ bool psr2_wait_su(int debugfs_fd, uint16_t *num_su_blocks)
{
return igt_wait(psr2_read_last_num_su_blocks_val(debugfs_fd, num_su_blocks), 40, 1);
}
+
+bool psr_enabled(int debugfs_fd, enum psr_mode mode)
+{
+ char buf[PSR_STATUS_MAX_LEN];
+ int ret;
+
+ ret = igt_debugfs_simple_read(debugfs_fd, "i915_edp_psr_status", buf,
+ sizeof(buf));
+ if (ret < 0)
+ return false;
+
+ if (mode == PSR_MODE_1)
+ return strstr(buf, "PSR mode: PSR1 enabled");
+ else
+ return strstr(buf, "PSR mode: PSR2 enabled");
+}
diff --git a/lib/igt_psr.h b/lib/igt_psr.h
index ca385736..9885cb11 100644
--- a/lib/igt_psr.h
+++ b/lib/igt_psr.h
@@ -42,5 +42,6 @@ bool psr_enable(int debugfs_fd, enum psr_mode);
bool psr_disable(int debugfs_fd);
bool psr_sink_support(int debugfs_fd, enum psr_mode);
bool psr2_wait_su(int debugfs_fd, uint16_t *num_su_blocks);
+bool psr_enabled(int debugfs_fd, enum psr_mode mode);
#endif
diff --git a/tests/i915/i915_pm_dc.c b/tests/i915/i915_pm_dc.c
index 02b08189..2cf357a2 100644
--- a/tests/i915/i915_pm_dc.c
+++ b/tests/i915/i915_pm_dc.c
@@ -84,16 +84,6 @@ static void display_fini(data_t *data)
igt_display_fini(&data->display);
}
-static bool edp_psr2_enabled(data_t *data)
-{
- char buf[512];
-
- igt_debugfs_simple_read(data->debugfs_fd, "i915_edp_psr_status",
- buf, sizeof(buf));
-
- return strstr(buf, "PSR mode: PSR2 enabled") != NULL;
-}
-
static void cleanup_dc_psr(data_t *data)
{
igt_plane_t *primary;
@@ -298,8 +288,7 @@ static void setup_dc3co(data_t *data)
{
data->op_psr_mode = PSR_MODE_2;
psr_enable(data->debugfs_fd, data->op_psr_mode);
- igt_require_f(edp_psr2_enabled(data),
- "PSR2 is not enabled\n");
+ igt_require(psr_enabled(data->debugfs_fd, PSR_MODE_2));
}
static void test_dc3co_vpb_simulation(data_t *data)
--
2.24.0
More information about the igt-dev
mailing list