Avoid having to test for spin[0] existing by starting the load-loop with
it allocated.

References: https://bugs.freedesktop.org/show_bug.cgi?id=104060
Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>
---
 tests/pm_rps.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/tests/pm_rps.c b/tests/pm_rps.c
index 57633c547..8f16ea47f 100644
--- a/tests/pm_rps.c
+++ b/tests/pm_rps.c
@@ -231,24 +231,24 @@ 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);
                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]);
-- 
2.15.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to