Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Jouni Högander" <jouni.hogander@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: kunal1.joshi@intel.com, "Jouni Högander" <jouni.hogander@intel.com>
Subject: [PATCH i-g-t 1/4] lib/igt_psr: Set Panel Replay disable bit for PSR modes
Date: Tue, 21 May 2024 12:02:30 +0300	[thread overview]
Message-ID: <20240521090233.1998323-2-jouni.hogander@intel.com> (raw)
In-Reply-To: <20240521090233.1998323-1-jouni.hogander@intel.com>

Set Panel Replay disable bit for PSR_MODE_* to prevent using Panel Replay
for panels supporting it.

Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
---
 lib/igt_psr.c | 32 +++++++++++++++++++-------------
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/lib/igt_psr.c b/lib/igt_psr.c
index 6008b73a6..964f18487 100644
--- a/lib/igt_psr.c
+++ b/lib/igt_psr.c
@@ -163,30 +163,36 @@ static bool psr_set(int device, int debugfs_fd, int mode, igt_output_t *output)
 		 */
 		ret = psr_modparam_set(device, mode >= PSR_MODE_1);
 	} else {
-		const char *debug_val;
+		int debug_val = mode <= PSR_MODE_2_SEL_FETCH ? 0x40 : 0;
 
 		switch (mode) {
 		case PSR_MODE_1:
-			debug_val = "0x3";
-			break;
+		case PR_MODE:
+			debug_val |= 0x3;
+				break;
 		case PSR_MODE_2:
-			debug_val = "0x2";
-			break;
+			debug_val |= 0x2;
+				break;
 		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";
+			debug_val |= 0x4;
 			break;
 		default:
 			/* Disables PSR */
-			debug_val = "0x1";
+			debug_val = 0x1;
 		}
 
-		ret = psr_write(debugfs_fd, debug_val, output);
+		/* old debugfs interface doesn't recognize Panel Replay disable bit */
+		do {
+			char debug_str[8];
+
+			sprintf(debug_str, "0x%x", debug_val);
+			ret = psr_write(debugfs_fd, debug_str, output);
+			if (!(debug_val & 0x40))
+				break;
+
+			debug_val &= ~0x40;
+		} while (ret <= 0);
 		igt_require_f(ret > 0, "PSR2 SF feature not available\n");
 	}
 
-- 
2.34.1


  reply	other threads:[~2024-05-21  9:03 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-21  9:02 [PATCH i-g-t 0/4] Panel Replay eDP changes Jouni Högander
2024-05-21  9:02 ` Jouni Högander [this message]
2024-05-23  9:59   ` [i-g-t,1/4] lib/igt_psr: Set Panel Replay disable bit for PSR modes Joshi, Kunal1
2024-05-21  9:02 ` [PATCH i-g-t 2/4] lib/igt_psr: Psr status debugfs interface print "enabled" not "Enabled" Jouni Högander
2024-05-30  5:33   ` [i-g-t,2/4] " Joshi, Kunal1
2024-05-21  9:02 ` [PATCH i-g-t 3/4] lib/igt_psr: Handle PR_MODE2_SEL_FETCH and eDP PR_* in psr active check Jouni Högander
2024-05-30  5:35   ` [i-g-t,3/4] " Joshi, Kunal1
2024-05-21  9:02 ` [PATCH i-g-t 4/4] tests/intel/kms_psr_stress_test: Provide output to psr_wait_entry Jouni Högander
2024-05-30  5:36   ` [i-g-t,4/4] " Joshi, Kunal1
2024-05-21 11:39 ` ✓ Fi.CI.BAT: success for Panel Replay eDP changes Patchwork
2024-05-21 11:42 ` ✓ CI.xeBAT: " Patchwork
2024-05-21 14:03 ` ✓ CI.xeFULL: " Patchwork
2024-05-22  5:00 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-05-30 11:04 ` ✓ Fi.CI.IGT: success " 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=20240521090233.1998323-2-jouni.hogander@intel.com \
    --to=jouni.hogander@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=kunal1.joshi@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