[Intel-gfx] [PATCH i-g-t 2/2] tests/pm_rps: Add waitboost-softlimit test

Radoslaw Szwichtenberg radoslaw.szwichtenberg at intel.com
Fri Feb 24 10:58:53 UTC 2017


Test verifies that frequency gets boosted to gt_boost_freq_mhz
even though gt_max_freq_mhz is lower than gt_boost_freq_mhz.

Cc: Arkadiusz Hiler <arkadiusz.hiler at intel.com>
Cc: Michal Winiarski <michal.winiarski at intel.com>
Signed-off-by: Radoslaw Szwichtenberg <radoslaw.szwichtenberg at intel.com>
---
 tests/pm_rps.c | 33 ++++++++++++++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/tests/pm_rps.c b/tests/pm_rps.c
index 7aa66a8..3cbbeeb 100644
--- a/tests/pm_rps.c
+++ b/tests/pm_rps.c
@@ -50,6 +50,7 @@ enum {
 	RP0,
 	RP1,
 	RPn,
+	BOOST,
 	NUMFREQ
 };
 
@@ -60,7 +61,14 @@ struct junk {
 	const char *mode;
 	FILE *filp;
 } stuff[] = {
-	{ "cur", "r", NULL }, { "min", "rb+", NULL }, { "max", "rb+", NULL }, { "RP0", "r", NULL }, { "RP1", "r", NULL }, { "RPn", "r", NULL }, { NULL, NULL, NULL }
+	{ "cur", "r", NULL },
+	{ "min", "rb+", NULL },
+	{ "max", "rb+", NULL },
+	{ "RP0", "r", NULL },
+	{ "RP1", "r", NULL },
+	{ "RPn", "r", NULL },
+	{"boost", "rb+", NULL },
+	{ NULL, NULL, NULL }
 };
 
 static int readval(FILE *filp)
@@ -614,6 +622,27 @@ static void waitboost(bool reset)
 	close(fd);
 }
 
+static void waitboost_softlimit(void)
+{
+	int boost_freqs[NUMFREQ];
+	int fmid = (origfreqs[RPn] + origfreqs[RP0]) / 2;
+	int fd = drm_open_driver(DRIVER_INTEL);
+	fmid = get_hw_rounded_freq(fmid);
+
+	igt_debug("Set min and max to midpoint\n");
+	writeval(stuff[MIN].filp, fmid);
+	writeval(stuff[MAX].filp, fmid);
+
+	/* When we wait upon the GPU, we want to temporarily boost it
+	 * to maximum.
+	 */
+	boost_freq(fd, boost_freqs);
+
+	igt_assert_eq(boost_freqs[CUR], boost_freqs[BOOST]);
+
+	close(fd);
+}
+
 static void pm_rps_exit_handler(int sig)
 {
 	if (origfreqs[MIN] > readval(stuff[MAX].filp)) {
@@ -679,4 +708,6 @@ igt_main
 	igt_subtest("reset")
 		waitboost(true);
 
+	igt_subtest("waitboost-softlimit")
+		waitboost_softlimit();
 }
-- 
2.9.3



More information about the Intel-gfx mailing list