If the relative timeout to igt_spin_set_timeout() is in the past,
immediately end the spinner.

Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/2903
Signed-off-by: Chris Wilson <[email protected]>
---
 lib/igt_dummyload.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c
index 6ecaf8506..34ad92216 100644
--- a/lib/igt_dummyload.c
+++ b/lib/igt_dummyload.c
@@ -485,10 +485,14 @@ void igt_spin_set_timeout(igt_spin_t *spin, int64_t ns)
        pthread_attr_t attr;
        int timerfd;
 
-       igt_assert(ns > 0);
        if (!spin)
                return;
 
+       if (ns <= 0) {
+               igt_spin_end(spin);
+               return;
+       }
+
        igt_assert(spin->timerfd == -1);
        timerfd = timerfd_create(CLOCK_MONOTONIC, 0);
        igt_assert(timerfd >= 0);
-- 
2.30.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to