public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Anshuman Gupta via igt-dev <igt-dev@lists.freedesktop.org>
To: igt-dev@lists.freedesktop.org
Cc: jyoti.r.yadav@intel.com, anshuman.gupta@intel.com
Subject: [igt-dev] [PATCH i-g-t v5 1/5] lib/igt_pm: Moves Dmc_loaded() function into library
Date: Fri, 15 Feb 2019 14:16:02 +0530	[thread overview]
Message-ID: <1550220366-21575-2-git-send-email-anshuman.gupta@intel.com> (raw)
In-Reply-To: <1550220366-21575-1-git-send-email-anshuman.gupta@intel.com>

From: Jyoti Yadav <jyoti.r.yadav@intel.com>

It will be used by new test pm_dc.c which will validate Display C States.
So moving the same to igt_pm library.

v2: Simplify the comment section.
v3: Remove . from the subject line.
v4: Rebased, resolve conflicts in pm_rpm.c
    Included patch set version change log.
v5: Listing actual change in patch set changelog to make review easier.

Signed-off-by: Jyoti Yadav <jyoti.r.yadav@intel.com>
Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
---
 lib/igt_pm.c   | 28 ++++++++++++++++++++++++++++
 lib/igt_pm.h   |  1 +
 tests/pm_rpm.c | 17 +----------------
 3 files changed, 30 insertions(+), 16 deletions(-)

diff --git a/lib/igt_pm.c b/lib/igt_pm.c
index 4902723..8b87c58 100644
--- a/lib/igt_pm.c
+++ b/lib/igt_pm.c
@@ -38,6 +38,7 @@
 #include "drmtest.h"
 #include "igt_pm.h"
 #include "igt_aux.h"
+#include "igt_sysfs.h"
 
 /**
  * SECTION:igt_pm
@@ -620,3 +621,30 @@ bool igt_wait_for_pm_status(enum igt_runtime_pm_status status)
 {
 	return igt_wait(igt_get_runtime_pm_status() == status, 10000, 100);
 }
+
+/**
+ * dmc_loaded:
+ * @debugfs: fd to the debugfs dir.
+
+ * Check whether DMC FW is loaded or not. DMC FW is require for few Display C
+ * states like DC5 and DC6. FW does the Context Save and Restore during Display
+ * C States entry and exit.
+ *
+ * Returns:
+ * True if DMC FW is loaded otherwise false.
+ */
+bool igt_pm_dmc_loaded(int debugfs)
+{
+	igt_require(debugfs != -1);
+	char buf[15];
+	int len;
+
+	len = igt_sysfs_read(debugfs, "i915_dmc_info", buf, sizeof(buf) - 1);
+	if (len < 0)
+		return true; /* no CSR support, no DMC requirement */
+
+	buf[len] = '\0';
+
+	igt_info("DMC: %s\n", buf);
+	return strstr(buf, "fw loaded: yes");
+}
diff --git a/lib/igt_pm.h b/lib/igt_pm.h
index 10cc679..70d2380 100644
--- a/lib/igt_pm.h
+++ b/lib/igt_pm.h
@@ -50,5 +50,6 @@ bool igt_setup_runtime_pm(void);
 void igt_restore_runtime_pm(void);
 enum igt_runtime_pm_status igt_get_runtime_pm_status(void);
 bool igt_wait_for_pm_status(enum igt_runtime_pm_status status);
+bool igt_pm_dmc_loaded(int debugfs);
 
 #endif /* IGT_PM_H */
diff --git a/tests/pm_rpm.c b/tests/pm_rpm.c
index be296f5..2d7cb5e 100644
--- a/tests/pm_rpm.c
+++ b/tests/pm_rpm.c
@@ -710,21 +710,6 @@ static void setup_pc8(void)
 	has_pc8 = true;
 }
 
-static bool dmc_loaded(void)
-{
-	char buf[15];
-	int len;
-
-	len = igt_sysfs_read(debugfs, "i915_dmc_info", buf, sizeof(buf) - 1);
-	if (len < 0)
-	    return true; /* no CSR support, no DMC requirement */
-
-	buf[len] = '\0';
-
-	igt_info("DMC: %s\n", buf);
-	return strstr(buf, "fw loaded: yes");
-}
-
 static void dump_file(int dir, const char *filename)
 {
 	char *contents;
@@ -761,7 +746,7 @@ static bool setup_environment(void)
 	igt_info("Runtime PM support: %d\n", has_runtime_pm);
 	igt_info("PC8 residency support: %d\n", has_pc8);
 	igt_require(has_runtime_pm);
-	igt_require(dmc_loaded());
+	igt_require(igt_pm_dmc_loaded(debugfs));
 
 out:
 	disable_all_screens(&ms_data);
-- 
2.7.4

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

  reply	other threads:[~2019-02-15  8:49 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-15  8:46 [igt-dev] [PATCH i-g-t v5 0/5] DC states igt tests patch series Anshuman Gupta via igt-dev
2019-02-15  8:46 ` Anshuman Gupta via igt-dev [this message]
2019-02-15  8:46 ` [igt-dev] [PATCH i-g-t v5 2/5] tests/pm_dc: Added new test to verify Display C States Anshuman Gupta via igt-dev
2019-02-20 16:52   ` [igt-dev] [PATCH i-g-t v6 " Anshuman Gupta
2019-02-20 23:08     ` Dhinakaran Pandiyan
2019-02-15  8:46 ` [igt-dev] [PATCH i-g-t v5 3/5] tests/pm_dc: Added test for DC6 during PSR Anshuman Gupta via igt-dev
2019-02-15  8:46 ` [igt-dev] [PATCH i-g-t v5 4/5] tests/pm_dc: Added test for DC5 during DPMS Anshuman Gupta via igt-dev
2019-02-20 16:56   ` [igt-dev] [PATCH i-g-t v6 " Anshuman Gupta
2019-02-15  8:46 ` [igt-dev] [PATCH i-g-t v5 5/5] tests/pm_dc: Added test for DC6 " Anshuman Gupta via igt-dev
2019-02-16 20:42 ` [igt-dev] ✓ Fi.CI.BAT: success for DC states igt tests patch series Patchwork
2019-02-16 21:40 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2019-02-21 15:31   ` Imre Deak
2019-02-22 15:01     ` Anshuman Gupta
2019-02-25 10:42       ` Imre Deak
2019-02-26  6:07         ` Anshuman Gupta
2019-02-28 14:01           ` 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=1550220366-21575-2-git-send-email-anshuman.gupta@intel.com \
    --to=igt-dev@lists.freedesktop.org \
    --cc=anshuman.gupta@intel.com \
    --cc=jyoti.r.yadav@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