All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [i-g-t, V2] lib/i915: Use FIXED mapping only for discrete memory
@ 2021-08-30  9:22 Tejas Upadhyay
  2021-08-30 12:25 ` [igt-dev] ✓ Fi.CI.BAT: success for lib/i915: Use FIXED mapping only for discrete memory (rev3) Patchwork
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Tejas Upadhyay @ 2021-08-30  9:22 UTC (permalink / raw)
  To: igt-dev

The FIXED mapping is only used for discrete, and mapping type
is pre-defined. This disables the other type of mmap
offsets when discrete memory is used.

Taken from kernel commit:
commit 7961c5b60f23 ("drm/i915: Add TTM offset argument to mmap.")

Changes since V1:
	- Make logic more readable - Petri Latvala

Signed-off-by: Tejas Upadhyay <tejaskumarx.surendrakumar.upadhyay@intel.com>
---
 include/drm-uapi/i915_drm.h | 1 +
 lib/i915/gem_mman.c         | 8 +++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/include/drm-uapi/i915_drm.h b/include/drm-uapi/i915_drm.h
index a1c0030c..b46367f2 100644
--- a/include/drm-uapi/i915_drm.h
+++ b/include/drm-uapi/i915_drm.h
@@ -871,6 +871,7 @@ struct drm_i915_gem_mmap_offset {
 #define I915_MMAP_OFFSET_WC  1
 #define I915_MMAP_OFFSET_WB  2
 #define I915_MMAP_OFFSET_UC  3
+#define I915_MMAP_OFFSET_FIXED 4
 
 	/*
 	 * Zero-terminated chain of extensions.
diff --git a/lib/i915/gem_mman.c b/lib/i915/gem_mman.c
index 0406a0b9..89bbbf7f 100644
--- a/lib/i915/gem_mman.c
+++ b/lib/i915/gem_mman.c
@@ -75,7 +75,13 @@ bool gem_has_legacy_mmap(int fd)
 
 bool gem_has_mmap_offset_type(int fd, const struct mmap_offset *t)
 {
-	return gem_has_mmap_offset(fd) || t->type == I915_MMAP_OFFSET_GTT;
+	if (gem_has_mmap_offset(fd))
+		if (gem_has_lmem(fd))
+			return t->type == I915_MMAP_OFFSET_FIXED;
+		else
+			return t->type != I915_MMAP_OFFSET_FIXED;
+	else
+		return false;
 }
 
 /**
-- 
2.31.1

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

end of thread, other threads:[~2021-08-30 17:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-30  9:22 [igt-dev] [i-g-t, V2] lib/i915: Use FIXED mapping only for discrete memory Tejas Upadhyay
2021-08-30 12:25 ` [igt-dev] ✓ Fi.CI.BAT: success for lib/i915: Use FIXED mapping only for discrete memory (rev3) Patchwork
2021-08-30 14:38 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2021-08-30 17:40 ` [igt-dev] [i-g-t, V2] lib/i915: Use FIXED mapping only for discrete memory Dixit, Ashutosh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.