[Intel-gfx] [PATCH igt 2/2] igt/perf_pmu: Replace hard-coded sleep before rc6 with a probe
Chris Wilson
chris at chris-wilson.co.uk
Tue Dec 5 10:56:02 UTC 2017
Instead of trying to sleep for 2 evaluations intervals and then assuming
that rc6 is working, poll the rc6 residency instead.
References: https://bugs.freedesktop.org/show_bug.cgi?id=103929
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
---
tests/perf_pmu.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/tests/perf_pmu.c b/tests/perf_pmu.c
index e872f4e55..65bc734da 100644
--- a/tests/perf_pmu.c
+++ b/tests/perf_pmu.c
@@ -1008,6 +1008,20 @@ static unsigned long rc6_enable_us(void)
return 2 * 160 * 1000;
}
+static bool wait_for_rc6(int fd)
+{
+ struct timespec tv = {};
+ uint64_t start, now;
+
+ start = pmu_read_single(fd);
+ do {
+ usleep(50);
+ now = pmu_read_single(fd);
+ } while (start == now && !igt_seconds_elapsed(&tv));
+
+ return start != now;
+}
+
static void
test_rc6(int gem_fd)
{
@@ -1019,7 +1033,7 @@ test_rc6(int gem_fd)
fd = open_pmu(I915_PMU_RC6_RESIDENCY);
gem_quiescent_gpu(gem_fd);
- usleep(rc6_enable_us()); /* wait for the rc6 cycle counter to kick in */
+ igt_require(wait_for_rc6(fd));
/* Go idle and check full RC6. */
prev = pmu_read_single(fd);
--
2.15.1
More information about the Intel-gfx
mailing list