[igt-dev] [PATCH i-g-t v3 2/4] igt/i915/i915_pm_lpsp check lpsp relevance on non edp panel.

Anshuman Gupta anshuman.gupta at intel.com
Tue Apr 16 13:35:36 UTC 2019


Earlier on HSW/BDW it was assumed that only eDP panel will act
as lpsp. But that is not true now.
So checking whether a non edp panel can act as lpsp or not.

Cc: imre.deak at intel.com
Signed-off-by: Anshuman Gupta <anshuman.gupta at intel.com>
---
 tests/i915/i915_pm_lpsp.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 56 insertions(+), 1 deletion(-)

diff --git a/tests/i915/i915_pm_lpsp.c b/tests/i915/i915_pm_lpsp.c
index 020f8b3..b09d9a0 100644
--- a/tests/i915/i915_pm_lpsp.c
+++ b/tests/i915/i915_pm_lpsp.c
@@ -36,6 +36,7 @@
 
 #define   HSW_PWR_WELL_CTL_REQ(pw_idx)          (0x2 << ((pw_idx) * 2))
 #define   HSW_PWR_WELL_CTL_STATE(pw_idx)        (0x1 << ((pw_idx) * 2))
+#define   LPSP_PORT				'A'
 
 int no_lpsp_pw_idx;
 
@@ -69,6 +70,56 @@ static bool lpsp_is_enabled(int drm_fd)
 	return !((val & mask) == mask);
 }
 
+static bool parse_port(FILE *file, char *info, char port)
+{
+	int ret;
+	bool is_port_found = false;
+
+	while (fgets(info, 256, file)) {
+		if (strstr(info, "encoder") && strstr(info, "DDI")) {
+			ret = sscanf(info, "%*s %*s %*s %*s %c", &port);
+			igt_assert_eq(ret, 1);
+			is_port_found = true;
+			break;
+		}
+	}
+	return is_port_found;
+}
+
+static bool non_edp_lpsp_check(int device)
+{
+	char tmp[256];
+	char port;
+	FILE *file;
+	int line;
+	int fd;
+	bool is_lpsp = false;
+
+	fd = igt_debugfs_open(device, "i915_display_info", O_RDONLY);
+	file = fdopen(fd, "r");
+	igt_skip_on(!file);
+
+	line = 0;
+	while (fgets(tmp, 256, file)) {
+		if (strstr(tmp, "CRTC") && line > 0) {
+			if (strstr(tmp, "pipe: A") &&
+			    strstr(tmp, "active=yes")) {
+				igt_require(parse_port(file, tmp, port));
+				if (port == LPSP_PORT)
+					is_lpsp =  true;
+				else
+					is_lpsp = false;
+				break;
+			}
+		}
+		line++;
+	}
+
+	fclose(file);
+	close(fd);
+	return is_lpsp;
+}
+
 /* The LPSP mode is all about an enabled pipe, but we expect to also be in the
  * low power mode when no pipes are enabled, so do this check anyway. */
 static void screens_disabled_subtest(int drm_fd, drmModeResPtr drm_res)
@@ -203,7 +254,11 @@ static void non_edp_subtest(int drm_fd, drmModeResPtr drm_res,
 			    &connector->connector_id, 1, mode);
 	igt_assert_eq(rc, 0);
 
-	igt_assert(!lpsp_is_enabled(drm_fd));
+	if (non_edp_lpsp_check(drm_fd) ||
+	    connector->connector_type == DRM_MODE_CONNECTOR_DSI)
+		igt_assert(lpsp_is_enabled(drm_fd));
+	else
+		igt_assert(!lpsp_is_enabled(drm_fd));
 }
 
 #define MAX_CONNECTORS 32
-- 
2.7.4



More information about the igt-dev mailing list