summaryrefslogtreecommitdiff
path: root/tests/pm_rc6_residency.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2018-02-09 14:29:26 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2018-02-09 20:41:42 +0000
commit8b9f68a13442c9307ef602cb9f0282e0c4ec43e2 (patch)
tree7866d469f31d1e63554d96db7410e0391d3bfa67 /tests/pm_rc6_residency.c
parent4f29dca555cc20af092c563c39ba2b62dfa1972c (diff)
igt/pm_rc6_residency: Check debugfs existence before reading
During the startup, we try to determine if the system supports rc6 prior to testing. However, the startup check asserts the residency debugfs exists, instead of testing for a requirement. v2: Throw in some passing indentation cleanups. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Antonio Argenziano <antonio.argenziano@intel.com>
Diffstat (limited to 'tests/pm_rc6_residency.c')
-rw-r--r--tests/pm_rc6_residency.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/tests/pm_rc6_residency.c b/tests/pm_rc6_residency.c
index 01eeaa30..abc30ac6 100644
--- a/tests/pm_rc6_residency.c
+++ b/tests/pm_rc6_residency.c
@@ -60,6 +60,15 @@ static unsigned long get_rc6_enabled_mask(void)
return enabled;
}
+static bool has_rc6_residency(const char *name)
+{
+ unsigned long residency;
+ char path[128];
+
+ sprintf(path, "power/%s_residency_ms", name);
+ return igt_sysfs_scanf(sysfs, path, "%lu", &residency) == 1;
+}
+
static unsigned long read_rc6_residency(const char *name)
{
unsigned long residency;
@@ -129,15 +138,15 @@ static void measure_residencies(int devid, unsigned int mask,
*/
read_residencies(devid, mask, &end);
igt_debug("time=%d: rc6=(%d, %d), rc6p=%d, rc6pp=%d\n",
- end.duration, end.rc6, end.media_rc6, end.rc6p, end.rc6pp);
+ end.duration, end.rc6, end.media_rc6, end.rc6p, end.rc6pp);
for (retry = 0; retry < 2; retry++) {
start = end;
sleep(SLEEP_DURATION);
read_residencies(devid, mask, &end);
igt_debug("time=%d: rc6=(%d, %d), rc6p=%d, rc6pp=%d\n",
- end.duration,
- end.rc6, end.media_rc6, end.rc6p, end.rc6pp);
+ end.duration,
+ end.rc6, end.media_rc6, end.rc6p, end.rc6pp);
if (end.rc6 >= start.rc6 &&
end.media_rc6 >= start.media_rc6 &&
@@ -171,9 +180,9 @@ static bool wait_for_rc6(void)
unsigned long start, now;
/* First wait for roughly an RC6 Evaluation Interval */
- usleep(160 * 1000);
+ usleep(160 * 1000);
- /* Then poll for RC6 to start ticking */
+ /* Then poll for RC6 to start ticking */
now = read_rc6_residency("rc6");
do {
start = now;
@@ -201,6 +210,8 @@ igt_main
devid = intel_get_drm_devid(fd);
sysfs = igt_sysfs_open(fd, NULL);
+ igt_require(has_rc6_residency("rc6"));
+
/* Make sure rc6 counters are running */
igt_drop_caches_set(fd, DROP_IDLE);
igt_require(wait_for_rc6());