From a765aa108105804c19096554447ad0cb71f64fc3 Mon Sep 17 00:00:00 2001 From: Mika Kuoppala Date: Wed, 17 Apr 2019 18:28:33 +0300 Subject: lib/igt_dummyload: Get rid of 'batch' on spinner accessors There is no guarantee that spinners are and will be implemented using batches. As we have igt_spin_t, manipulate it through igt_spin_* functions consistently and hide the batch nature. Cc: Chris Wilson Signed-off-by: Mika Kuoppala Reviewed-by: Chris Wilson --- lib/drmtest.c | 4 ++-- lib/igt_core.c | 4 ++-- lib/igt_dummyload.c | 48 ++++++++++++++++++++++++------------------------ lib/igt_dummyload.h | 20 ++++++++++---------- lib/igt_gt.c | 10 +++++----- 5 files changed, 43 insertions(+), 43 deletions(-) (limited to 'lib') diff --git a/lib/drmtest.c b/lib/drmtest.c index d31ade3f..4a92fb5c 100644 --- a/lib/drmtest.c +++ b/lib/drmtest.c @@ -176,7 +176,7 @@ static const char *forced_driver(void) */ void gem_quiescent_gpu(int fd) { - igt_terminate_spin_batches(); + igt_terminate_spins(); igt_drop_caches_set(fd, DROP_ACTIVE | DROP_RETIRE | DROP_IDLE | DROP_FREED); @@ -314,7 +314,7 @@ static int at_exit_drm_render_fd = -1; static void __cancel_work_at_exit(int fd) { - igt_terminate_spin_batches(); /* for older kernels */ + igt_terminate_spins(); /* for older kernels */ igt_sysfs_set_parameter(fd, "reset", "%x", -1u /* any method */); igt_drop_caches_set(fd, diff --git a/lib/igt_core.c b/lib/igt_core.c index ae03e909..3141d923 100644 --- a/lib/igt_core.c +++ b/lib/igt_core.c @@ -1007,7 +1007,7 @@ static void exit_subtest(const char *result) fprintf(stderr, "Subtest %s: %s (%.3fs)\n", in_subtest, result, igt_time_elapsed(&subtest_time, &now)); - igt_terminate_spin_batches(); + igt_terminate_spins(); in_subtest = NULL; siglongjmp(igt_subtest_jmpbuf, 1); @@ -1915,7 +1915,7 @@ static void call_exit_handlers(int sig) { int i; - igt_terminate_spin_batches(); + igt_terminate_spins(); if (!exit_handler_count) { return; diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c index 46fe638f..1d57a53c 100644 --- a/lib/igt_dummyload.c +++ b/lib/igt_dummyload.c @@ -264,7 +264,7 @@ emit_recursive_batch(igt_spin_t *spin, } static igt_spin_t * -spin_batch_create(int fd, const struct igt_spin_factory *opts) +spin_create(int fd, const struct igt_spin_factory *opts) { igt_spin_t *spin; @@ -281,25 +281,25 @@ spin_batch_create(int fd, const struct igt_spin_factory *opts) } igt_spin_t * -__igt_spin_batch_factory(int fd, const struct igt_spin_factory *opts) +__igt_spin_factory(int fd, const struct igt_spin_factory *opts) { - return spin_batch_create(fd, opts); + return spin_create(fd, opts); } /** - * igt_spin_batch_factory: + * igt_spin_factory: * @fd: open i915 drm file descriptor * @opts: controlling options such as context, engine, dependencies etc * * Start a recursive batch on a ring. Immediately returns a #igt_spin_t that * contains the batch's handle that can be waited upon. The returned structure - * must be passed to igt_spin_batch_free() for post-processing. + * must be passed to igt_spin_free() for post-processing. * * Returns: - * Structure with helper internal state for igt_spin_batch_free(). + * Structure with helper internal state for igt_spin_free(). */ igt_spin_t * -igt_spin_batch_factory(int fd, const struct igt_spin_factory *opts) +igt_spin_factory(int fd, const struct igt_spin_factory *opts) { igt_spin_t *spin; @@ -311,7 +311,7 @@ igt_spin_batch_factory(int fd, const struct igt_spin_factory *opts) igt_require(gem_can_store_dword(fd, opts->engine)); } - spin = spin_batch_create(fd, opts); + spin = spin_create(fd, opts); igt_assert(gem_bo_busy(fd, spin->handle)); if (opts->flags & IGT_SPIN_FENCE_OUT) { @@ -327,19 +327,19 @@ static void notify(union sigval arg) { igt_spin_t *spin = arg.sival_ptr; - igt_spin_batch_end(spin); + igt_spin_end(spin); } /** - * igt_spin_batch_set_timeout: - * @spin: spin batch state from igt_spin_batch_new() + * igt_spin_set_timeout: + * @spin: spin state from igt_spin_new() * @ns: amount of time in nanoseconds the batch continues to execute * before finishing. * * Specify a timeout. This ends the recursive batch associated with @spin after * the timeout has elapsed. */ -void igt_spin_batch_set_timeout(igt_spin_t *spin, int64_t ns) +void igt_spin_set_timeout(igt_spin_t *spin, int64_t ns) { timer_t timer; struct sigevent sev; @@ -367,12 +367,12 @@ void igt_spin_batch_set_timeout(igt_spin_t *spin, int64_t ns) } /** - * igt_spin_batch_end: - * @spin: spin batch state from igt_spin_batch_new() + * igt_spin_end: + * @spin: spin state from igt_spin_new() * - * End the recursive batch associated with @spin manually. + * End the spinner associated with @spin manually. */ -void igt_spin_batch_end(igt_spin_t *spin) +void igt_spin_end(igt_spin_t *spin) { if (!spin) return; @@ -382,14 +382,14 @@ void igt_spin_batch_end(igt_spin_t *spin) } /** - * igt_spin_batch_free: + * igt_spin_free: * @fd: open i915 drm file descriptor - * @spin: spin batch state from igt_spin_batch_new() + * @spin: spin state from igt_spin_new() * - * This function does the necessary post-processing after starting a recursive - * batch with igt_spin_batch_new(). + * This function does the necessary post-processing after starting a + * spin with igt_spin_new() and then frees it. */ -void igt_spin_batch_free(int fd, igt_spin_t *spin) +void igt_spin_free(int fd, igt_spin_t *spin) { if (!spin) return; @@ -401,7 +401,7 @@ void igt_spin_batch_free(int fd, igt_spin_t *spin) if (spin->timer) timer_delete(spin->timer); - igt_spin_batch_end(spin); + igt_spin_end(spin); gem_munmap((void *)((unsigned long)spin->batch & (~4095UL)), BATCH_SIZE); @@ -418,13 +418,13 @@ void igt_spin_batch_free(int fd, igt_spin_t *spin) free(spin); } -void igt_terminate_spin_batches(void) +void igt_terminate_spins(void) { struct igt_spin *iter; pthread_mutex_lock(&list_lock); igt_list_for_each(iter, &spin_list, link) - igt_spin_batch_end(iter); + igt_spin_end(iter); pthread_mutex_unlock(&list_lock); } diff --git a/lib/igt_dummyload.h b/lib/igt_dummyload.h index 3793bf7f..d6482089 100644 --- a/lib/igt_dummyload.h +++ b/lib/igt_dummyload.h @@ -58,18 +58,18 @@ struct igt_spin_factory { #define IGT_SPIN_NO_PREEMPTION (1 << 3) igt_spin_t * -__igt_spin_batch_factory(int fd, const struct igt_spin_factory *opts); +__igt_spin_factory(int fd, const struct igt_spin_factory *opts); igt_spin_t * -igt_spin_batch_factory(int fd, const struct igt_spin_factory *opts); +igt_spin_factory(int fd, const struct igt_spin_factory *opts); -#define __igt_spin_batch_new(fd, ...) \ - __igt_spin_batch_factory(fd, &((struct igt_spin_factory){__VA_ARGS__})) -#define igt_spin_batch_new(fd, ...) \ - igt_spin_batch_factory(fd, &((struct igt_spin_factory){__VA_ARGS__})) +#define __igt_spin_new(fd, ...) \ + __igt_spin_factory(fd, &((struct igt_spin_factory){__VA_ARGS__})) +#define igt_spin_new(fd, ...) \ + igt_spin_factory(fd, &((struct igt_spin_factory){__VA_ARGS__})) -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); +void igt_spin_set_timeout(igt_spin_t *spin, int64_t ns); +void igt_spin_end(igt_spin_t *spin); +void igt_spin_free(int fd, igt_spin_t *spin); static inline bool igt_spin_has_poll(const igt_spin_t *spin) { @@ -87,7 +87,7 @@ static inline void igt_spin_busywait_until_started(igt_spin_t *spin) ; } -void igt_terminate_spin_batches(void); +void igt_terminate_spins(void); enum igt_cork_type { CORK_SYNC_FD = 1, diff --git a/lib/igt_gt.c b/lib/igt_gt.c index 59995243..a2eaadf5 100644 --- a/lib/igt_gt.c +++ b/lib/igt_gt.c @@ -294,10 +294,10 @@ igt_hang_t igt_hang_ctx(int fd, uint32_t ctx, int ring, unsigned flags) if ((flags & HANG_ALLOW_BAN) == 0) context_set_ban(fd, ctx, 0); - spin = __igt_spin_batch_new(fd, - .ctx = ctx, - .engine = ring, - .flags = IGT_SPIN_NO_PREEMPTION); + spin = __igt_spin_new(fd, + .ctx = ctx, + .engine = ring, + .flags = IGT_SPIN_NO_PREEMPTION); return (igt_hang_t){ spin, ctx, ban, flags }; } @@ -333,7 +333,7 @@ void igt_post_hang_ring(int fd, igt_hang_t arg) return; gem_sync(fd, arg.spin->handle); /* Wait until it hangs */ - igt_spin_batch_free(fd, arg.spin); + igt_spin_free(fd, arg.spin); context_set_ban(fd, arg.ctx, arg.ban); -- cgit v1.2.3