igt/gem_softpin: Keep last_handle around to vary hole generation

If we don't close the handle from the last pass, we don't free up the
previous pass's vma immediately, changing the hole allocation.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2016-01-24 15:34:08 +00:00
parent c5b0293ca3
commit 9bf4e19125

View File

@ -129,8 +129,11 @@ static void test_softpin(int fd)
struct drm_i915_gem_execbuffer2 execbuf; struct drm_i915_gem_execbuffer2 execbuf;
struct drm_i915_gem_exec_object2 object; struct drm_i915_gem_exec_object2 object;
uint64_t offset, end; uint64_t offset, end;
uint32_t last_handle;
int loop; int loop;
last_handle = gem_create(fd, size);
memset(&execbuf, 0, sizeof(execbuf)); memset(&execbuf, 0, sizeof(execbuf));
execbuf.buffers_ptr = (uintptr_t)&object; execbuf.buffers_ptr = (uintptr_t)&object;
execbuf.buffer_count = 1; execbuf.buffer_count = 1;
@ -142,6 +145,7 @@ static void test_softpin(int fd)
/* Find a hole */ /* Find a hole */
gem_execbuf(fd, &execbuf); gem_execbuf(fd, &execbuf);
gem_close(fd, object.handle); gem_close(fd, object.handle);
gem_close(fd, last_handle);
igt_debug("Made a 2 MiB hole: %08llx\n", igt_debug("Made a 2 MiB hole: %08llx\n",
object.offset); object.offset);
@ -157,7 +161,7 @@ static void test_softpin(int fd)
igt_assert_eq_u64(object.offset, offset); igt_assert_eq_u64(object.offset, offset);
} }
gem_close(fd, object.handle); last_handle = object.handle;
} }
} }