diff options
author | Mika Kuoppala <mika.kuoppala@linux.intel.com> | 2019-04-18 11:54:27 +0300 |
---|---|---|
committer | Mika Kuoppala <mika.kuoppala@linux.intel.com> | 2019-04-18 17:03:31 +0300 |
commit | 226b9995d1fb486d34cd35428025b55532e9e3d1 (patch) | |
tree | 1b698d55cc0833a3603a20be134602283b01b7f7 /lib/igt_dummyload.h | |
parent | 2df2ad21f8df58cbfb2be671571d9d9bae54e96c (diff) |
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 <chris@chris-wilson.co.uk>
Signed-off-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib/igt_dummyload.h')
-rw-r--r-- | lib/igt_dummyload.h | 17 |
1 files changed, 14 insertions, 3 deletions
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)) ; } |