public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Anshuman Gupta <anshuman.gupta@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: animesh.manna@intel.com
Subject: [igt-dev] [PATCH i-g-t v3 2/4] igt/i915/i915_pm_lpsp check lpsp relevance on non edp panel.
Date: Tue, 16 Apr 2019 19:05:36 +0530	[thread overview]
Message-ID: <1555421738-15223-3-git-send-email-anshuman.gupta@intel.com> (raw)
In-Reply-To: <1555421738-15223-1-git-send-email-anshuman.gupta@intel.com>

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@intel.com
Signed-off-by: Anshuman Gupta <anshuman.gupta@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

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2019-04-16 13:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-16 13:35 [igt-dev] [PATCH i-g-t v3 0/4] igt/i915/i915_pm_lpsp enable pm_lpsp for platforms till Gen11 v3 Anshuman Gupta
2019-04-16 13:35 ` [igt-dev] [PATCH i-g-t v3 1/4] igt/i915/i915_pm_lpsp enable pm_lpsp for platforms till Gen11 Anshuman Gupta
2019-04-17  6:20   ` Animesh Manna
2019-04-16 13:35 ` Anshuman Gupta [this message]
2019-04-16 13:35 ` [igt-dev] [PATCH i-g-t v3 3/4] igt/i915/i915_pm_lpsp skip edp-panel-fitter test Anshuman Gupta
2019-04-16 13:35 ` [igt-dev] [PATCH i-g-t v3 4/4] DO_NOT_MERGE add i915_pm_lpsp subtests to CI fast feedback list Anshuman Gupta
2019-04-16 14:17 ` [igt-dev] ✗ Fi.CI.BAT: failure for igt/i915/i915_pm_lpsp enable pm_lpsp for platforms till Gen11 v3 Patchwork
2019-04-24  5:46   ` Gupta, Anshuman
2019-04-24  8:21     ` Imre Deak

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=1555421738-15223-3-git-send-email-anshuman.gupta@intel.com \
    --to=anshuman.gupta@intel.com \
    --cc=animesh.manna@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