diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2020-10-09 17:21:13 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2020-12-13 12:01:31 +0000 |
commit | 0136ff0be60c2661289fc1a7eccf59a2762708b4 (patch) | |
tree | c9134d19ee43d5f62bc3a1e6e1f8449d692e61db | |
parent | e8dcc0cfb14d9bc8d5f14d0da6bfa6ac61263668 (diff) |
i915/gem_exec_balancer: Check interactions between bonds and userptr
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | tests/i915/gem_exec_balancer.c | 46 |
1 files changed, 31 insertions, 15 deletions
diff --git a/tests/i915/gem_exec_balancer.c b/tests/i915/gem_exec_balancer.c index 9551ea76..54577c1e 100644 --- a/tests/i915/gem_exec_balancer.c +++ b/tests/i915/gem_exec_balancer.c @@ -34,6 +34,10 @@ IGT_TEST_DESCRIPTION("Exercise in-kernel load-balancing"); +#define CORK (1ul << 0) +#define VIRTUAL_ENGINE (1ul << 1) +#define USERPTR (1ul << 2) + #define MI_SEMAPHORE_WAIT (0x1c << 23) #define MI_SEMAPHORE_POLL (1 << 15) #define MI_SEMAPHORE_SAD_GT_SDD (0 << 12) @@ -578,7 +582,6 @@ static void individual(int i915) } static void bonded(int i915, unsigned int flags) -#define CORK 0x1 { I915_DEFINE_CONTEXT_ENGINES_BOND(bonds[16], 1); struct i915_engine_class_instance *master_engines; @@ -660,13 +663,15 @@ static void bonded(int i915, unsigned int flags) plug = __igt_spin_new(i915, .ctx = master, .engine = bond, - .dependency = igt_cork_plug(&cork, i915)); + .dependency = igt_cork_plug(&cork, i915), + .flags = (flags & USERPTR ? IGT_SPIN_USERPTR : 0)); } spin = __igt_spin_new(i915, .ctx = master, .engine = bond, - .flags = IGT_SPIN_FENCE_OUT); + .flags = IGT_SPIN_FENCE_OUT | + (flags & USERPTR ? IGT_SPIN_USERPTR : 0)); eb = spin->execbuf; eb.rsvd1 = ctx; @@ -717,8 +722,6 @@ static void bonded(int i915, unsigned int flags) gem_context_destroy(i915, master); } -#define VIRTUAL_ENGINE (1u << 0) - static unsigned int offset_in_page(void *addr) { return (uintptr_t)addr & 4095; @@ -1057,7 +1060,8 @@ static void bonded_chain(int i915) static void __bonded_sema(int i915, uint32_t ctx, const struct i915_engine_class_instance *siblings, - unsigned int count) + unsigned int count, + unsigned long flags) { const int priorities[] = { -1023, 0, 1023 }; struct drm_i915_gem_exec_object2 batch = { @@ -1074,7 +1078,8 @@ static void __bonded_sema(int i915, uint32_t ctx, /* A: spin forever on seperate render engine */ spin = igt_spin_new(i915, .flags = (IGT_SPIN_POLL_RUN | - IGT_SPIN_FENCE_OUT)); + IGT_SPIN_FENCE_OUT | + (flags & USERPTR ? IGT_SPIN_USERPTR : 0))); igt_spin_busywait_until_started(spin); /* @@ -1128,7 +1133,7 @@ static void __bonded_sema(int i915, uint32_t ctx, gem_close(i915, batch.handle); } -static void bonded_semaphore(int i915) +static void bonded_semaphore(int i915, unsigned long flags) { uint32_t ctx; @@ -1149,7 +1154,7 @@ static void bonded_semaphore(int i915) siblings = list_engines(i915, 1u << class, &count); if (count > 1) - __bonded_sema(i915, ctx, siblings, count); + __bonded_sema(i915, ctx, siblings, count, flags); free(siblings); } @@ -1839,7 +1844,7 @@ static void __bonded_early(int i915, uint32_t ctx, spin = igt_spin_new(i915, .ctx = ctx, .engine = (flags & VIRTUAL_ENGINE) ? 0 : 1, - .flags = IGT_SPIN_NO_PREEMPTION); + .flags = IGT_SPIN_NO_PREEMPTION | (flags & USERPTR ? IGT_SPIN_USERPTR : 0)); /* B: runs after A on engine 1 */ execbuf.flags = I915_EXEC_FENCE_OUT; @@ -1882,7 +1887,7 @@ static void __bonded_early(int i915, uint32_t ctx, igt_spin_free(i915, spin); } -static void bonded_early(int i915) +static void bonded_early(int i915, unsigned long flags) { uint32_t ctx; @@ -1909,8 +1914,8 @@ static void bonded_early(int i915) siblings = list_engines(i915, 1u << class, &count); if (count > 1) { - __bonded_early(i915, ctx, siblings, count, 0); - __bonded_early(i915, ctx, siblings, count, VIRTUAL_ENGINE); + __bonded_early(i915, ctx, siblings, count, flags); + __bonded_early(i915, ctx, siblings, count, flags | VIRTUAL_ENGINE); } free(siblings); } @@ -3036,7 +3041,16 @@ igt_main bonded(i915, CORK); igt_subtest("bonded-early") - bonded_early(i915); + bonded_early(i915, 0); + + igt_subtest("u-bonded-imm") + bonded(i915, USERPTR); + + igt_subtest("u-bonded-cork") + bonded(i915, CORK | USERPTR); + + igt_subtest("u-bonded-early") + bonded_early(i915, USERPTR); } igt_subtest("bonded-slice") @@ -3046,7 +3060,9 @@ igt_main bonded_chain(i915); igt_subtest("bonded-semaphore") - bonded_semaphore(i915); + bonded_semaphore(i915, 0); + igt_subtest("u-bonded-semaphore") + bonded_semaphore(i915, USERPTR); igt_subtest("bonded-pair") bonded_runner(i915, __bonded_pair); |