[Intel-gfx] [PATCH i-g-t] tests/pm_rps: Add handling of idle frequency exposed via sysfs
Michał Winiarski
michal.winiarski at intel.com
Tue May 17 13:55:44 UTC 2016
Signed-off-by: Michał Winiarski <michal.winiarski at intel.com>
---
tests/pm_rps.c | 36 ++++++++++++++++++++++++++++++++----
1 file changed, 32 insertions(+), 4 deletions(-)
diff --git a/tests/pm_rps.c b/tests/pm_rps.c
index c3d4417..a0e6655 100644
--- a/tests/pm_rps.c
+++ b/tests/pm_rps.c
@@ -45,6 +45,7 @@ static int drm_fd;
static const char sysfs_base_path[] = "/sys/class/drm/card%d/gt_%s_freq_mhz";
enum {
CUR,
+ IDL,
MIN,
MAX,
RP0,
@@ -60,7 +61,7 @@ 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 }, {"idl", "rb+", NULL }, { "min", "rb+", NULL }, { "max", "rb+", NULL }, { "RP0", "r", NULL }, { "RP1", "r", NULL }, { "RPn", "r", NULL }, { NULL, NULL, NULL }
};
static int readval(FILE *filp)
@@ -145,6 +146,7 @@ static int do_writeval(FILE *filp, int val, int lerrno, bool readback_check)
static void checkit(const int *freqs)
{
igt_assert_lte(freqs[MIN], freqs[MAX]);
+ igt_assert_lte(freqs[IDL], freqs[MIN]);
igt_assert_lte(freqs[CUR], freqs[MAX]);
igt_assert_lte(freqs[RPn], freqs[CUR]);
igt_assert_lte(freqs[RPn], freqs[MIN]);
@@ -160,6 +162,7 @@ static void matchit(const int *freqs1, const int *freqs2)
igt_assert_eq(freqs1[CUR], freqs2[CUR]);
igt_assert_eq(freqs1[MIN], freqs2[MIN]);
igt_assert_eq(freqs1[MAX], freqs2[MAX]);
+ igt_assert_eq(freqs1[IDL], freqs2[IDL]);
igt_assert_eq(freqs1[RP0], freqs2[RP0]);
igt_assert_eq(freqs1[RP1], freqs2[RP1]);
igt_assert_eq(freqs1[RPn], freqs2[RPn]);
@@ -379,19 +382,44 @@ static void min_max_config(void (*check)(void), bool load_gpu)
do_load_gpu();
check();
- igt_debug("\nSet min=RPn and max=RP0...\n");
+ igt_debug("\nSet idle=RPn, min=RPn and max=RP0...\n");
+ writeval(stuff[IDL].filp, origfreqs[RPn]);
writeval(stuff[MIN].filp, origfreqs[RPn]);
writeval(stuff[MAX].filp, origfreqs[RP0]);
if (load_gpu)
do_load_gpu();
check();
+ igt_debug("\nIncrease idle above min (invalid)...\n");
+ writeval_inval(stuff[IDL].filp, origfreqs[RPn] + 100);
+ if (load_gpu)
+ do_load_gpu();
+ check();
+
igt_debug("\nIncrease min to midpoint...\n");
writeval(stuff[MIN].filp, fmid);
if (load_gpu)
do_load_gpu();
check();
+ igt_debug("\nIncrease idle to midpoint...\n");
+ writeval(stuff[IDL].filp, fmid);
+ if (load_gpu)
+ do_load_gpu();
+ check();
+
+ igt_debug("\nDecrease min below idle (invalid)...\n");
+ writeval_inval(stuff[MIN].filp, fmid - 100);
+ if (load_gpu)
+ do_load_gpu();
+ check();
+
+ igt_debug("\nDecrease idle to RPn...\n");
+ writeval(stuff[IDL].filp, origfreqs[RPn]);
+ if (load_gpu)
+ do_load_gpu();
+ check();
+
igt_debug("\nIncrease min to RP0...\n");
writeval(stuff[MIN].filp, origfreqs[RP0]);
if (load_gpu)
@@ -476,13 +504,13 @@ static void idle_check(void)
read_freqs(freqs);
dump(freqs);
checkit(freqs);
- if (freqs[CUR] == freqs[RPn])
+ if (freqs[CUR] == freqs[IDL])
break;
usleep(1000 * IDLE_WAIT_TIMESTEP_MSEC);
wait += IDLE_WAIT_TIMESTEP_MSEC;
} while (wait < IDLE_WAIT_TIMEOUT_MSEC);
- igt_assert_eq(freqs[CUR], freqs[RPn]);
+ igt_assert_eq(freqs[CUR], freqs[IDL]);
igt_debug("Required %d msec to reach cur=idle\n", wait);
}
--
2.8.0
More information about the Intel-gfx
mailing list