diff mbox

[i-g-t,2/2] tests/pm_rps: Add waitboost-softlimit test

Message ID 20170224105853.5717-2-radoslaw.szwichtenberg@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Szwichtenberg, Radoslaw Feb. 24, 2017, 10:58 a.m. UTC
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@intel.com>
Cc: Michal Winiarski <michal.winiarski@intel.com>
Signed-off-by: Radoslaw Szwichtenberg <radoslaw.szwichtenberg@intel.com>
---
 tests/pm_rps.c | 33 ++++++++++++++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

Comments

Chris Wilson Feb. 24, 2017, 11:36 a.m. UTC | #1
On Fri, Feb 24, 2017 at 11:58:53AM +0100, Radoslaw Szwichtenberg wrote:
> Test verifies that frequency gets boosted to gt_boost_freq_mhz
> even though gt_max_freq_mhz is lower than gt_boost_freq_mhz.

And the converse check would be good, that setting boost to min prevents
boosting.
-Chris
diff mbox

Patch

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();
 }