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

Anshuman Gupta anshuman.gupta at intel.com
Thu May 9 11:58:02 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.

v2: CI igt fixures.
v3: CI igt fixture.

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

diff --git a/tests/i915/i915_pm_lpsp.c b/tests/i915/i915_pm_lpsp.c
index 1abe587..f699edc 100644
--- a/tests/i915/i915_pm_lpsp.c
+++ b/tests/i915/i915_pm_lpsp.c
@@ -38,6 +38,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'
 
 #define DUMP_DBGFS(file1, file2, fd)			\
 	"%s:\n%s\n%s:\n%s\n", file1,			\
@@ -79,6 +80,55 @@ static bool lpsp_is_enabled(uint32_t devid)
 	return !(val & mask);
 }
 
+static bool is_non_edp_ddia_port(FILE *file, char *info)
+{
+	int ret;
+	char ddi[256];
+	char port;
+	bool ddi_a_port = false;
+
+	while (fgets(info, 256, file)) {
+		if (strstr(info, "encoder")) {
+			ret = sscanf(info, "%*s %*s %*s %s %c", ddi, &port);
+			igt_assert_eq(ret, 2);
+			if (!strcmp(ddi, "DDI") && port == LPSP_PORT)
+				ddi_a_port = true;
+		}
+		if (strstr(info, "connector") && strstr(info, "eDP"))
+			ddi_a_port = false;
+	}
+	return ddi_a_port;
+}
+
+static bool non_edp_lpsp_check(int device)
+{
+	char tmp[256];
+	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")) {
+				is_lpsp = is_non_edp_ddia_port(file, tmp);
+				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,
@@ -221,9 +271,20 @@ static void non_edp_subtest(int drm_fd, drmModeResPtr drm_res, uint32_t devid,
 	rc = drmModeSetCrtc(drm_fd, crtc_id, buffer_id, 0, 0,
 			    &connector->connector_id, 1, mode);
 	igt_assert_eq(rc, 0);
-	igt_assert_f(!lpsp_is_enabled(devid),
-		     DUMP_DBGFS("i915_runtime_pm_status",
-				"i915_power_domain_info", fd));
+
+	if (non_edp_lpsp_check(drm_fd) ||
+	    connector->connector_type == DRM_MODE_CONNECTOR_DSI)
+		/* Some times delayed audio codec disabling causes to fail the.
+		 * the test. Using igt_wait to check lpsp after
+		 * drm_mode_setcrtc().
+		 */
+		igt_assert_f(igt_wait(lpsp_is_enabled(devid), 1000, 100),
+			     DUMP_DBGFS("i915_runtime_pm_status",
+					"i915_power_domain_info", fd));
+	else
+		igt_assert_f(!lpsp_is_enabled(devid),
+			     DUMP_DBGFS("i915_runtime_pm_status",
+					"i915_power_domain_info", fd));
 }
 
 #define MAX_CONNECTORS 32
-- 
2.7.4



More information about the igt-dev mailing list