From: "José Roberto de Souza" <jose.souza@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Jeevan B <jeevan.b@intel.com>
Subject: [igt-dev] [PATCH i-g-t 4/4] lib/igt_psr: Move "is enabled" implementation to lib
Date: Wed, 13 Nov 2019 14:39:31 -0800 [thread overview]
Message-ID: <20191113223931.174701-4-jose.souza@intel.com> (raw)
In-Reply-To: <20191113223931.174701-1-jose.souza@intel.com>
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@intel.com>
Cc: Anshuman Gupta <anshuman.gupta@intel.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@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 da4d66a7..378b3c05 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
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2019-11-13 22:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-13 22:39 [igt-dev] [PATCH i-g-t 1/4] lib/igt_psr: Unset errno when expected José Roberto de Souza
2019-11-13 22:39 ` [igt-dev] [PATCH i-g-t 2/4] tests/i915_pm_dc: Use psr_sink_support of reimplement it again José Roberto de Souza
2019-11-13 22:39 ` [igt-dev] [PATCH i-g-t 3/4] tests/i915_pm_dc: Simplify runtime pm handling José Roberto de Souza
2019-11-14 8:09 ` Arkadiusz Hiler
2019-11-13 22:39 ` José Roberto de Souza [this message]
2019-11-14 1:46 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/4] lib/igt_psr: Unset errno when expected Patchwork
2019-11-14 22:19 ` [igt-dev] ✗ Fi.CI.IGT: failure " 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=20191113223931.174701-4-jose.souza@intel.com \
--to=jose.souza@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=jeevan.b@intel.com \
/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