summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2017-12-11 12:35:35 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2017-12-20 11:01:33 +0000
commitd3bcc7d0a51a898b4fb1625d529907319d235ee7 (patch)
tree519042022157d3f8c954fc885e0995d5398d9be5 /tests
parentda0889bfacff106fb3ecb7049a7a21f78b4b301b (diff)
igt/pm_rps: Always allocate spin[0]
Avoid having to test for spin[0] existing by starting the load-loop with it allocated. v2: Preallocate the spin[1] as well for high load. References: https://bugs.freedesktop.org/show_bug.cgi?id=104060 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104318 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Radoslaw Szwichtenberg <radoslaw.szwichtenberg@intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/pm_rps.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/tests/pm_rps.c b/tests/pm_rps.c
index 57633c54..a48ca368 100644
--- a/tests/pm_rps.c
+++ b/tests/pm_rps.c
@@ -206,6 +206,8 @@ static void load_helper_set_load(enum load load)
lh.load = load;
kill(lh.igt_proc.pid, SIGUSR2);
+
+ usleep(1000); /* wait for load-helper to switch */
}
static void load_helper_run(enum load load)
@@ -231,24 +233,26 @@ static void load_helper_run(enum load load)
igt_debug("Applying %s load...\n", lh.load ? "high" : "low");
+ spin[0] = igt_spin_batch_new(drm_fd, 0, 0, 0);
+ if (lh.load == HIGH)
+ spin[1] = __igt_spin_batch_new(drm_fd, 0, 0, 0);
while (!lh.exit) {
- if (spin[0]) {
- handle = spin[0]->handle;
- igt_spin_batch_end(spin[0]);
- while (gem_bo_busy(drm_fd, handle))
- usleep(100);
- igt_spin_batch_free(drm_fd, spin[0]);
+ handle = spin[0]->handle;
+ igt_spin_batch_end(spin[0]);
+ while (gem_bo_busy(drm_fd, handle))
usleep(100);
- }
+
+ igt_spin_batch_free(drm_fd, spin[0]);
+ usleep(100);
+
spin[0] = spin[1];
spin[lh.load == HIGH] =
- igt_spin_batch_new(drm_fd, 0, 0, 0);
+ __igt_spin_batch_new(drm_fd, 0, 0, 0);
}
- if (spin[0]) {
- handle = spin[0]->handle;
- igt_spin_batch_end(spin[0]);
- }
+ handle = spin[0]->handle;
+ igt_spin_batch_end(spin[0]);
+
if (spin[1]) {
handle = spin[1]->handle;
igt_spin_batch_end(spin[1]);