From 226b9995d1fb486d34cd35428025b55532e9e3d1 Mon Sep 17 00:00:00 2001 From: Mika Kuoppala Date: Thu, 18 Apr 2019 11:54:27 +0300 Subject: lib/igt_dummyload: libify checks for spin batch activation Instead of opencoding the poll into the spinner, use a helper to check if spinner has started. v2: use zero as presumed offset (Chris) v3: cleanup the relocs (Chris) v4: leave the domains to zero, avoid relocation (Chris) Cc: Chris Wilson Signed-off-by: Mika Kuoppala Reviewed-by: Chris Wilson --- lib/igt_dummyload.h | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'lib/igt_dummyload.h') diff --git a/lib/igt_dummyload.h b/lib/igt_dummyload.h index 73bd035b..3793bf7f 100644 --- a/lib/igt_dummyload.h +++ b/lib/igt_dummyload.h @@ -41,7 +41,8 @@ typedef struct igt_spin { struct drm_i915_gem_exec_object2 obj[2]; struct drm_i915_gem_execbuffer2 execbuf; uint32_t poll_handle; - bool *running; + uint32_t *poll; +#define SPIN_POLL_START_IDX 0 } igt_spin_t; struct igt_spin_factory { @@ -70,9 +71,19 @@ void igt_spin_batch_set_timeout(igt_spin_t *spin, int64_t ns); void igt_spin_batch_end(igt_spin_t *spin); void igt_spin_batch_free(int fd, igt_spin_t *spin); -static inline void igt_spin_busywait_until_running(igt_spin_t *spin) +static inline bool igt_spin_has_poll(const igt_spin_t *spin) { - while (!READ_ONCE(*spin->running)) + return spin->poll; +} + +static inline bool igt_spin_has_started(igt_spin_t *spin) +{ + return READ_ONCE(spin->poll[SPIN_POLL_START_IDX]); +} + +static inline void igt_spin_busywait_until_started(igt_spin_t *spin) +{ + while (!igt_spin_has_started(spin)) ; } -- cgit v1.2.3