intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH igt 1/2] igt/gem_exec_reloc: Trivial test for softpin ABI
@ 2016-11-17 13:48 Chris Wilson
  2016-11-17 13:48 ` [PATCH igt 2/2] intel_ci: Add gem_exec_reloc/basic-softpin to BAT Chris Wilson
  2016-11-18  9:39 ` [PATCH igt 1/2] igt/gem_exec_reloc: Trivial test for softpin ABI Michał Winiarski
  0 siblings, 2 replies; 6+ messages in thread
From: Chris Wilson @ 2016-11-17 13:48 UTC (permalink / raw)
  To: intel-gfx

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/gem_exec_reloc.c | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/tests/gem_exec_reloc.c b/tests/gem_exec_reloc.c
index c56fb43..e6db8e6 100644
--- a/tests/gem_exec_reloc.c
+++ b/tests/gem_exec_reloc.c
@@ -528,6 +528,38 @@ static void basic_noreloc(int fd)
 	gem_close(fd, obj.handle);
 }
 
+static void basic_softpin(int fd)
+{
+	struct drm_i915_gem_exec_object2 obj;
+	struct drm_i915_gem_execbuffer2 execbuf;
+	uint64_t offset;
+	uint32_t trash;
+	uint32_t bbe = MI_BATCH_BUFFER_END;
+
+	igt_require(gem_has_softpin(fd));
+
+	memset(&obj, 0, sizeof(obj));
+	obj.handle = gem_create(fd, 4096);
+	gem_write(fd, obj.handle, 0, &bbe, sizeof(bbe));
+
+	memset(&execbuf, 0, sizeof(execbuf));
+	execbuf.buffers_ptr = (uintptr_t)&obj;
+	execbuf.buffer_count = 1;
+	gem_execbuf(fd, &execbuf);
+
+	trash = obj.handle;
+	offset = obj.offset;
+
+	obj.handle = gem_create(fd, 4096);
+	obj.flags = EXEC_OBJECT_PINNED;
+
+	gem_execbuf(fd, &execbuf);
+	igt_assert_eq_u64(obj.offset, offset);
+
+	gem_close(fd, obj.handle);
+	gem_close(fd, trash);
+}
+
 igt_main
 {
 	uint64_t size;
@@ -545,6 +577,9 @@ igt_main
 	igt_subtest("basic-noreloc")
 		basic_noreloc(fd);
 
+	igt_subtest("basic-softpin")
+		basic_softpin(fd);
+
 	for (size = 4096; size <= 4ull*1024*1024*1024; size <<= 1) {
 		igt_subtest_f("mmap-%u", find_last_set(size) - 1)
 			from_mmap(fd, size, MEM);
-- 
2.10.2

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-11-25 12:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-17 13:48 [PATCH igt 1/2] igt/gem_exec_reloc: Trivial test for softpin ABI Chris Wilson
2016-11-17 13:48 ` [PATCH igt 2/2] intel_ci: Add gem_exec_reloc/basic-softpin to BAT Chris Wilson
2016-11-25 10:00   ` Petri Latvala
2016-11-25 12:10     ` Petri Latvala
2016-11-18  9:39 ` [PATCH igt 1/2] igt/gem_exec_reloc: Trivial test for softpin ABI Michał Winiarski
2016-11-18 10:19   ` Joonas Lahtinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).