[PATCH i-g-t 2/3] lib/igt_psr: Make psr_set and psr_active_check to handle ET modes

Jouni Högander jouni.hogander at intel.com
Thu Jan 30 08:42:47 UTC 2025


Currently psr_set and psr_active_check do not handle ET modes.
Change them both to handle them.

Signed-off-by: Jouni Högander <jouni.hogander at intel.com>
---
 lib/igt_psr.c | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/lib/igt_psr.c b/lib/igt_psr.c
index 9e0dc17a6..2a46a43b4 100644
--- a/lib/igt_psr.c
+++ b/lib/igt_psr.c
@@ -97,7 +97,8 @@ static bool psr_active_check(int debugfs_fd, enum psr_mode mode, igt_output_t *o
 	bool active;
 	int ret;
 
-	if (mode == PR_MODE || mode == PR_MODE_SEL_FETCH) {
+	if (mode == PR_MODE || mode == PR_MODE_SEL_FETCH ||
+	    mode == PR_MODE_SEL_FETCH_ET) {
 		igt_assert_f(output, "Output not given\n");
 		c = output->config.connector;
 		if (c->connector_type == DRM_MODE_CONNECTOR_DisplayPort)
@@ -106,7 +107,8 @@ static bool psr_active_check(int debugfs_fd, enum psr_mode mode, igt_output_t *o
 			state = "SLEEP";
 	} else if (mode == PSR_MODE_1)
 		state = "SRDENT";
-	else if (mode == PSR_MODE_2 || mode == PSR_MODE_2_SEL_FETCH)
+	else if (mode == PSR_MODE_2 || mode == PSR_MODE_2_SEL_FETCH ||
+		 mode == PSR_MODE_2_SEL_FETCH_ET)
 		state = "DEEP_SLEEP";
 	else
 		igt_assert_f(false, "Invalid psr mode\n");
@@ -220,6 +222,8 @@ static void restore_psr_debugfs(int sig)
 	psr_write(psr_restore_debugfs_fd, "0", NULL);
 }
 
+#define ET_DISABLE_BIT (1 << 5)
+#define PR_DISABLE_BIT (1 << 6)
 static bool psr_set(int device, int debugfs_fd, int mode, igt_output_t *output)
 {
 	int ret;
@@ -239,7 +243,10 @@ 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 {
-		int debug_val = mode <= PSR_MODE_2_SEL_FETCH ? 0x40 : 0;
+		int debug_val = mode <= PSR_MODE_2_SEL_FETCH ? PR_DISABLE_BIT : 0;
+
+		if (mode != PSR_MODE_2_SEL_FETCH_ET && mode != PR_MODE_SEL_FETCH_ET)
+			debug_val |= ET_DISABLE_BIT;
 
 		switch (mode) {
 		case PSR_MODE_1:
@@ -250,7 +257,9 @@ static bool psr_set(int device, int debugfs_fd, int mode, igt_output_t *output)
 			debug_val |= 0x2;
 				break;
 		case PSR_MODE_2_SEL_FETCH:
+		case PSR_MODE_2_SEL_FETCH_ET:
 		case PR_MODE_SEL_FETCH:
+		case PR_MODE_SEL_FETCH_ET:
 			debug_val |= 0x4;
 			break;
 		default:
@@ -258,16 +267,19 @@ static bool psr_set(int device, int debugfs_fd, int mode, igt_output_t *output)
 			debug_val = 0x1;
 		}
 
-		/* old debugfs interface doesn't recognize Panel Replay disable bit */
+		/*
+		 * old debugfs interface doesn't recognize Panel
+		 * Replay/ET 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))
+			if (!(debug_val & (PR_DISABLE_BIT | ET_DISABLE_BIT)))
 				break;
 
-			debug_val &= ~0x40;
+			debug_val &= ~(PR_DISABLE_BIT | ET_DISABLE_BIT);
 		} while (ret <= 0);
 		igt_require_f(ret > 0, "PSR2 SF feature not available\n");
 	}
-- 
2.43.0



More information about the Intel-gfx-trybot mailing list