diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2020-07-01 09:03:28 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2020-12-13 12:01:31 +0000 |
commit | 1a442ebc9b9e3bc787efaf6d90585990c142044a (patch) | |
tree | 31fd7942d06a27846e0e942cf02671654b25a368 | |
parent | c4bcb417c368f01f108f29a0222d53908028aef1 (diff) |
i915/gem_softpin: Active rebinds
Verify that we do not block userspace [controlling fence progress] if it
requires vma recycling.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | tests/i915/gem_softpin.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/i915/gem_softpin.c b/tests/i915/gem_softpin.c index fcaf8ef3..02f1dad5 100644 --- a/tests/i915/gem_softpin.c +++ b/tests/i915/gem_softpin.c @@ -263,6 +263,33 @@ static void test_reverse(int i915) gem_close(i915, handle); } +static void test_active(int i915) +{ + const uint32_t bbe = MI_BATCH_BUFFER_END; + struct drm_i915_gem_exec_object2 obj = { + .handle = gem_create(i915, 4096), + }; + struct drm_i915_gem_execbuffer2 execbuf = { + .buffers_ptr = to_user_pointer(&obj), + .buffer_count = 1, + }; + igt_spin_t *spin; + + gem_write(i915, obj.handle, 0, &bbe, sizeof(bbe)); + + /* Make a busy spot */ + spin = igt_spin_new(i915); + + /* Reuse it for ourselves */ + obj.offset = spin->obj[IGT_SPIN_BATCH].offset; + obj.flags = EXEC_OBJECT_PINNED; + gem_execbuf(i915, &execbuf); + igt_assert_eq_u64(obj.offset, spin->obj[IGT_SPIN_BATCH].offset); + + gem_close(i915, obj.handle); + igt_spin_free(i915, spin); +} + static uint64_t busy_batch(int fd) { unsigned const int gen = intel_gen(intel_get_drm_devid(fd)); @@ -565,6 +592,8 @@ igt_main test_overlap(fd); igt_subtest("reverse") test_reverse(fd); + igt_subtest("active") + test_active(fd); igt_subtest("noreloc") test_noreloc(fd, NOSLEEP, 0); |