public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t] i915/gem_ctx_shared: Check for a large enough hole in the GTT
@ 2019-06-17 11:14 Chris Wilson
  2019-06-17 13:31 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Chris Wilson @ 2019-06-17 11:14 UTC (permalink / raw)
  To: intel-gfx; +Cc: igt-dev

In the exec-shared-gtt test, we cheekily try to reference an object we
placed in the GTT in an earlier execbuf (and avoid declaring it in the
later call). For a global GTT, where there may be existing objects, we
have to find a hole large enough to fit both and avoid and implicit
guard pages.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110876
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/i915/gem_ctx_shared.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/tests/i915/gem_ctx_shared.c b/tests/i915/gem_ctx_shared.c
index ed43e8903..4b1020b96 100644
--- a/tests/i915/gem_ctx_shared.c
+++ b/tests/i915/gem_ctx_shared.c
@@ -184,6 +184,7 @@ static void exhaust_shared_gtt(int i915, unsigned int flags)
 static void exec_shared_gtt(int i915, unsigned int ring)
 {
 	const int gen = intel_gen(intel_get_drm_devid(i915));
+	const uint32_t bbe = MI_BATCH_BUFFER_END;
 	struct drm_i915_gem_exec_object2 obj = {};
 	struct drm_i915_gem_execbuffer2 execbuf = {
 		.buffers_ptr = to_user_pointer(&obj),
@@ -197,11 +198,19 @@ static void exec_shared_gtt(int i915, unsigned int ring)
 	gem_require_ring(i915, ring);
 	igt_require(gem_can_store_dword(i915, ring));
 
+	/* Find a hole big enough for both objects later */
+	scratch = gem_create(i915, 16384);
+	gem_write(i915, scratch, 0, &bbe, sizeof(bbe));
+	obj.handle = scratch;
+	gem_execbuf(i915, &execbuf);
+	gem_close(i915, scratch);
+	obj.flags |= EXEC_OBJECT_PINNED; /* reuse this address */
+
 	scratch = gem_create(i915, 4096);
 	s = gem_mmap__cpu(i915, scratch, 0, 4096, PROT_WRITE);
 
 	gem_set_domain(i915, scratch, I915_GEM_DOMAIN_CPU, I915_GEM_DOMAIN_CPU);
-	*s = MI_BATCH_BUFFER_END;
+	*s = bbe;
 
 	/* Load object into place in the GTT */
 	obj.handle = scratch;
@@ -224,11 +233,10 @@ static void exec_shared_gtt(int i915, unsigned int ring)
 		batch[++i] = obj.offset;
 	}
 	batch[++i] = 0xc0ffee;
-	batch[++i] = MI_BATCH_BUFFER_END;
+	batch[++i] = bbe;
 	gem_write(i915, obj.handle, 0, batch, sizeof(batch));
 
-	obj.offset += 4096; /* make sure we don't cause an eviction! */
-	obj.flags |= EXEC_OBJECT_PINNED;
+	obj.offset += 8192; /* make sure we don't cause an eviction! */
 	execbuf.rsvd1 = gem_context_clone(i915, 0, I915_CONTEXT_CLONE_VM, 0);
 	if (gen > 3 && gen < 6)
 		execbuf.flags |= I915_EXEC_SECURE;
-- 
2.20.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

end of thread, other threads:[~2019-06-17 20:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-17 11:14 [igt-dev] [PATCH i-g-t] i915/gem_ctx_shared: Check for a large enough hole in the GTT Chris Wilson
2019-06-17 13:31 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2019-06-17 14:25 ` [igt-dev] [Intel-gfx] [PATCH i-g-t] " Tvrtko Ursulin
2019-06-17 20:44 ` [igt-dev] ✓ Fi.CI.IGT: success for " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox