Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Kunal Joshi <kunal1.joshi@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Kunal Joshi <kunal1.joshi@intel.com>,
	Arun R Murthy <arun.r.murthy@intel.com>
Subject: [igt-dev] [PATCH i-g-t 2/5] lib/igt_psr: modified function for pr compaitability
Date: Fri, 20 Oct 2023 11:35:00 +0530	[thread overview]
Message-ID: <20231020060503.870173-3-kunal1.joshi@intel.com> (raw)
In-Reply-To: <20231020060503.870173-1-kunal1.joshi@intel.com>

modified psr_active_check and psr_sink_support for
pr cases.

note :- this will be usefull for eDP PR not needed for DP PR

Cc: Jouni Högander <jouni.hogander@intel.com>
Cc: Animesh Manna <animesh.manna@intel.com>
Cc: Arun R Murthy <arun.r.murthy@intel.com>
Signed-off-by: Kunal Joshi <kunal1.joshi@intel.com>
---
 lib/igt_psr.c | 64 +++++++++++++++++++++++++++++++--------------------
 1 file changed, 39 insertions(+), 25 deletions(-)

diff --git a/lib/igt_psr.c b/lib/igt_psr.c
index 13f7c567d..acacfa31f 100644
--- a/lib/igt_psr.c
+++ b/lib/igt_psr.c
@@ -50,7 +50,7 @@ bool psr2_selective_fetch_check(int debugfs_fd)
 static bool psr_active_check(int debugfs_fd, enum psr_mode mode)
 {
 	char buf[PSR_STATUS_MAX_LEN];
-	const char *state = mode == PSR_MODE_1 ? "SRDENT" : "DEEP_SLEEP";
+	const char *state = mode == PSR_MODE_1 || PR_MODE ? "SRDENT" : "DEEP_SLEEP";
 	int ret;
 
 	ret = igt_debugfs_simple_read(debugfs_fd, "i915_edp_psr_status",
@@ -162,6 +162,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:
+			debug_val = "0x5";
+			break;
+		case PR_MODE_SEL_FETCH:
+			debug_val = "0x6";
+			break;
 		default:
 			/* Disables PSR */
 			debug_val = "0x1";
@@ -194,29 +200,35 @@ bool psr_disable(int device, int debugfs_fd)
 
 bool psr_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;
-
-	if (mode == PSR_MODE_1)
-		return strstr(buf, "Sink_Support: yes\n") ||
-		       strstr(buf, "Sink support: yes");
-	else
-		/*
-		 * i915 requires PSR version 0x03 that is PSR2 + SU with
-		 * Y-coordinate to support PSR2
-		 *
-		 * or
-		 *
-		 * PSR version 0x4 that is PSR2 + SU w/ Y-coordinate and SU
-		 * Region Early Transport to support PSR2 (eDP 1.5)
-		 */
-		return strstr(buf, "Sink support: yes [0x03]") ||
-		       strstr(buf, "Sink support: yes [0x04]");
+	char *line;
+    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;
+
+    line = strstr(buf, "Sink support: ");
+    if (!line)
+        return false;
+
+    if (mode == PSR_MODE_1)
+        return strstr(line, "PSR = yes");
+    else if (mode == PSR_MODE_2 || mode == PSR_MODE_2_SEL_FETCH)
+        /*
+         * i915 requires PSR version 0x03 that is PSR2 + SU with
+         * Y-coordinate to support PSR2
+         *
+         * or
+         *
+         * PSR version 0x4 that is PSR2 + SU w/ Y-coordinate and SU
+         * Region Early Transport to support PSR2 (eDP 1.5)
+         */
+        return strstr(line, "PSR = yes") &&
+               (strstr(line, "[0x03]") || strstr(line, "[0x04]"));
+    else
+        return strstr(line, "Panel Replay = yes");
 }
 
 #define PSR2_SU_BLOCK_STR_LOOKUP "PSR2 SU blocks:\n0\t"
@@ -350,7 +362,9 @@ enum psr_mode psr_get_mode(int debugfs_fd)
 		return PSR_DISABLED;
 	}
 
-	if (strstr(buf, "PSR2 selective fetch: enabled"))
+	if (strstr(buf, "Panel Replay Enabled"))
+		return PR_MODE;
+	else if (strstr(buf, "PSR2 selective fetch: enabled"))
 		return PSR_MODE_2_SEL_FETCH;
 	else if (strstr(buf, "PSR2 enabled"))
 		return PSR_MODE_2;
-- 
2.25.1

  parent reply	other threads:[~2023-10-20  5:57 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-20  6:04 [igt-dev] [PATCH i-g-t 0/5] extend kms_psr test to validate pr Kunal Joshi
2023-10-20  6:04 ` [igt-dev] [PATCH i-g-t 1/5] lib/igt_psr: added enum for panel replay Kunal Joshi
2023-10-20  6:05 ` Kunal Joshi [this message]
2023-10-20  6:05 ` [igt-dev] [PATCH i-g-t 3/5] lib/igt_psr: added function to check output supports pr Kunal Joshi
2023-10-20 12:13   ` Hogander, Jouni
2023-10-25  6:01     ` Joshi, Kunal1
2023-10-25  7:05       ` Hogander, Jouni
2023-10-25  7:12         ` Joshi, Kunal1
2023-10-20  6:05 ` [igt-dev] [PATCH i-g-t 4/5] lib/igt_psr: added function to check active dp pr Kunal Joshi
2023-10-20 12:15   ` Hogander, Jouni
2023-10-25  6:16     ` Joshi, Kunal1
2023-10-25  7:07       ` Hogander, Jouni
2023-10-25  7:13         ` Joshi, Kunal1
2023-10-20  6:05 ` [igt-dev] [PATCH i-g-t 5/5] tests/intel/kms_psr: made test compaitable with pr Kunal Joshi
2023-10-23  6:54   ` Hogander, Jouni
2023-10-25  6:19     ` Joshi, Kunal1
2023-10-25  6:49     ` Joshi, Kunal1
2023-10-23 22:39 ` [igt-dev] ✗ Fi.CI.BAT: failure for extend kms_psr test to validate pr Patchwork
2023-10-23 23:37 ` [igt-dev] ✗ CI.xeBAT: " 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=20231020060503.870173-3-kunal1.joshi@intel.com \
    --to=kunal1.joshi@intel.com \
    --cc=arun.r.murthy@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