Skip to contentSkip to conversation

i915/gem_ctx_shared: handle mmap for discrete

PATCH Matthew Auld 1 participant 1 message Mar 31, 2022 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Matthew Auld

author Reviewed-by
#1 lore raw
Quoted 14 lines · Nirmoy Das

On discrete we can only do fixed mmap and also setting domain is not allowed.

Issue: https://gitlab.freedesktop.org/drm/intel/-/issues/5451

---
  tests/i915/gem_ctx_shared.c | 11 +++++++++--
  1 file changed, 9 insertions(+), 2 deletions(-)
tests/i915/gem_ctx_shared.c +0 -0
index cc547b87b..dd3ff3ee3 100644

tests/i915/gem_ctx_shared.c static void exec_shared_gtt(int i915, const intel_ctx_cfg_t *cfg, · line 298

Quoted 10 lines
tests/i915/gem_ctx_shared.c +6 -1
@@ -290,9 +290,16 @@ static void exec_shared_gtt(int i915, const intel_ctx_cfg_t *cfg,
  	execbuf.flags |= I915_EXEC_FENCE_IN;
 
  	scratch = gem_create(i915, 4096);
-	s = gem_mmap__wc(i915, scratch, 0, 4096, PROT_WRITE);
+	if (gem_has_lmem(i915))
+		s = gem_mmap_offset__fixed(i915, scratch, 0, 4096, PROT_WRITE);
+	else {
+		s = gem_mmap_offset__wc(i915, scratch, 0, 4096, PROT_WRITE);
+		if (!s)
+			s = gem_mmap__wc(i915, scratch, 0, 4096, PROT_WRITE);

https://patchwork.freedesktop.org/series/100499/

gem_mmap__device_coherent() can be used here I think.

tests/i915/gem_ctx_shared.c static void exec_shared_gtt(int i915, const intel_ctx_cfg_t *cfg, · line 300

Quoted 2 lines
tests/i915/gem_ctx_shared.c +2 -0
+
+		gem_set_domain(i915, scratch, I915_GEM_DOMAIN_WC, I915_GEM_DOMAIN_WC);

This does an object wait some on discrete IIRC. I didn't check if the test is relying on that or not though.

Otherwise,

Quoted 6 lines
tests/i915/gem_ctx_shared.c +1 -1
+	}
 
-	gem_set_domain(i915, scratch, I915_GEM_DOMAIN_WC, I915_GEM_DOMAIN_WC);
  	s[0] = bbe;
  	s[64] = bbe;