From: Kunal Joshi <kunal1.joshi@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Kunal Joshi <kunal1.joshi@intel.com>
Subject: [igt-dev] [PATCH i-g-t 1/2] RFC lib/igt_psr Added library functions for panel replay
Date: Mon, 6 Mar 2023 20:51:50 +0530 [thread overview]
Message-ID: <20230306152151.24200-2-kunal1.joshi@intel.com> (raw)
In-Reply-To: <20230306152151.24200-1-kunal1.joshi@intel.com>
Added helper functions for retieving panel replay
information from debugfs
Signed-off-by: Kunal Joshi <kunal1.joshi@intel.com>
---
lib/igt_psr.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++-
lib/igt_psr.h | 5 +++++
2 files changed, 66 insertions(+), 1 deletion(-)
diff --git a/lib/igt_psr.c b/lib/igt_psr.c
index a2d88031..ec39b480 100644
--- a/lib/igt_psr.c
+++ b/lib/igt_psr.c
@@ -37,6 +37,16 @@ bool psr_disabled_check(int debugfs_fd)
return strstr(buf, "PSR mode: disabled\n");
}
+bool pr_selective_fetch_check(int debugfs_fd)
+{
+ char buf[PSR_STATUS_MAX_LEN];
+
+ igt_debugfs_simple_read(debugfs_fd, "i915_edp_psr_status", buf,
+ sizeof(buf));
+
+ return strstr(buf, "PR selective fetch: enabled");
+}
+
bool psr2_selective_fetch_check(int debugfs_fd)
{
char buf[PSR_STATUS_MAX_LEN];
@@ -47,6 +57,27 @@ bool psr2_selective_fetch_check(int debugfs_fd)
return strstr(buf, "PSR2 selective fetch: enabled");
}
+static bool pr_active_check(int debugfs_fd, enum psr_mode mode)
+{
+ char buf[PSR_STATUS_MAX_LEN];
+ /*
+ * Fix PR_STATE once confimred what state source will be in
+ * when PR is active
+ */
+ const char *state = "PR_STATE";
+ int ret;
+
+ ret = igt_debugfs_simple_read(debugfs_fd, "i915_edp_psr_status",
+ buf, sizeof(buf));
+ if (ret < 0) {
+ igt_info("Could not read i915_edp_psr_status: %s\n",
+ strerror(-ret));
+ return false;
+ }
+
+ return strstr(buf, state);
+}
+
static bool psr_active_check(int debugfs_fd, enum psr_mode mode)
{
char buf[PSR_STATUS_MAX_LEN];
@@ -66,6 +97,11 @@ static bool psr_active_check(int debugfs_fd, enum psr_mode mode)
return strstr(buf, state);
}
+bool pr_wait_entry(int debugfs_fd, enum psr_mode mode)
+{
+ return igt_wait(pr_active_check(debugfs_fd, mode), 500, 20);
+}
+
/*
* For PSR1, we wait until PSR is active. We wait until DEEP_SLEEP for PSR2.
*/
@@ -162,6 +198,12 @@ static bool psr_set(int device, int debugfs_fd, int mode)
case PSR_MODE_2_SEL_FETCH:
debug_val = "0x4";
break;
+ case PR_MODE_1:
+ debug_val = "0x5";
+ break;
+ case PR_MODE_1_SEL_FETCH:
+ debug_val = "0x6";
+ break;
default:
/* Disables PSR */
debug_val = "0x1";
@@ -192,6 +234,20 @@ bool psr_disable(int device, int debugfs_fd)
return psr_set(device, debugfs_fd, -1);
}
+bool pr_sink_support(int device, 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 < 1)
+ return false;
+ else
+ return strstr(buf, "Sink support: yes [0x05]") ||
+ strstr(buf, "Sink support: yes [0x06]");
+}
+
bool psr_sink_support(int device, int debugfs_fd, enum psr_mode mode)
{
char buf[PSR_STATUS_MAX_LEN];
@@ -350,7 +406,11 @@ enum psr_mode psr_get_mode(int debugfs_fd)
return PSR_DISABLED;
}
- if (strstr(buf, "PSR2 selective fetch: enabled"))
+ if (strstr(buf, "PR selective fetch: enabled"))
+ return PR_MODE_1_SEL_FETCH;
+ else if (strstr(buf, "PR: enabled"))
+ return PR_MODE_1;
+ else if (strstr(buf, "PSR2 selective fetch: enabled"))
return PSR_MODE_2_SEL_FETCH;
else if (strstr(buf, "PSR2 enabled"))
return PSR_MODE_2;
diff --git a/lib/igt_psr.h b/lib/igt_psr.h
index 12ffc9d6..cbcef796 100644
--- a/lib/igt_psr.h
+++ b/lib/igt_psr.h
@@ -34,17 +34,22 @@ enum psr_mode {
PSR_MODE_1,
PSR_MODE_2,
PSR_MODE_2_SEL_FETCH,
+ PR_MODE_1,
+ PR_MODE_1_SEL_FETCH,
PSR_DISABLED,
};
bool psr_disabled_check(int debugfs_fd);
+bool pr_selective_fetch_check(int debugfs_fd);
bool psr2_selective_fetch_check(int debugfs_fd);
+bool pr_wait_entry(int debugfs_fd, enum psr_mode mode);
bool psr_wait_entry(int debugfs_fd, enum psr_mode mode);
bool psr_wait_update(int debugfs_fd, enum psr_mode mode);
bool psr_long_wait_update(int debugfs_fd, enum psr_mode mode);
bool psr_enable(int device, int debugfs_fd, enum psr_mode);
bool psr_disable(int device, int debugfs_fd);
bool psr_sink_support(int device, int debugfs_fd, enum psr_mode mode);
+bool pr_sink_support(int device, int debugfs_fd, enum psr_mode mode);
bool psr2_wait_su(int debugfs_fd, uint16_t *num_su_blocks);
void psr_print_debugfs(int debugfs_fd);
enum psr_mode psr_get_mode(int debugfs_fd);
--
2.25.1
next prev parent reply other threads:[~2023-03-06 15:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-06 15:21 [igt-dev] [PATCH i-g-t 0/2] RFC extend kms_psr2_sf for panel replay Kunal Joshi
2023-03-06 15:21 ` Kunal Joshi [this message]
2023-03-06 15:21 ` [igt-dev] [PATCH i-g-t 2/2] RFC tests/kms_psr2_sf Extended test to validate " Kunal Joshi
2023-03-06 16:22 ` [igt-dev] ✗ Fi.CI.BAT: failure for RFC extend kms_psr2_sf for " Patchwork
2023-06-20 11:45 ` [igt-dev] [PATCH i-g-t 0/2] " Hogander, Jouni
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=20230306152151.24200-2-kunal1.joshi@intel.com \
--to=kunal1.joshi@intel.com \
--cc=igt-dev@lists.freedesktop.org \
/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