public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t 1/2] lib/i915/gem_mman: Prioritize GTT mappings over WC
@ 2020-01-11  5:36 Ashutosh Dixit
  2020-01-11  5:36 ` [igt-dev] [PATCH i-g-t 2/2] i915/treewide: Replace gem_mmap__gtt() by gem_mmap__device_coherent() Ashutosh Dixit
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Ashutosh Dixit @ 2020-01-11  5:36 UTC (permalink / raw)
  To: igt-dev

In order to preserve legacy behavior for devices with a mappable
aperture try a GTT mapping first. Use a WC mapping only for devices
without a mappable aperture.

Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
---
 lib/i915/gem_mman.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/lib/i915/gem_mman.c b/lib/i915/gem_mman.c
index c98f02aee..cdebf44a6 100644
--- a/lib/i915/gem_mman.c
+++ b/lib/i915/gem_mman.c
@@ -347,18 +347,19 @@ void *gem_mmap_offset__wc(int fd, uint32_t handle, uint64_t offset,
  * @prot: memory protection bits as used by mmap()
  *
  * Returns: A pointer to a block of linear device memory mapped into the
- * process with WC semantics. When no WC is available try to mmap using GGTT.
+ * process via GTT. When GTT is not available try WC mapping.
  */
 void *__gem_mmap__device_coherent(int fd, uint32_t handle, uint64_t offset,
 				  uint64_t size, unsigned prot)
 {
-	void *ptr = __gem_mmap_offset(fd, handle, offset, size, prot,
-				      I915_MMAP_OFFSET_WC);
+	void *ptr = __gem_mmap__gtt(fd, handle, size, prot);
+
 	if (!ptr)
-		ptr = __gem_mmap__wc(fd, handle, offset, size, prot);
+		ptr = __gem_mmap_offset(fd, handle, offset, size, prot,
+					I915_MMAP_OFFSET_WC);
 
 	if (!ptr)
-		ptr = __gem_mmap__gtt(fd, handle, size, prot);
+		ptr = __gem_mmap__wc(fd, handle, offset, size, prot);
 
 	return ptr;
 }
-- 
2.24.1

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

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

end of thread, other threads:[~2020-01-15 17:03 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-11  5:36 [igt-dev] [PATCH i-g-t 1/2] lib/i915/gem_mman: Prioritize GTT mappings over WC Ashutosh Dixit
2020-01-11  5:36 ` [igt-dev] [PATCH i-g-t 2/2] i915/treewide: Replace gem_mmap__gtt() by gem_mmap__device_coherent() Ashutosh Dixit
2020-01-11  8:44   ` Chris Wilson
2020-01-12  2:57     ` Dixit, Ashutosh
2020-01-12 10:06       ` Chris Wilson
2020-01-15 16:27   ` Imre Deak
2020-01-15 17:03     ` Dixit, Ashutosh
2020-01-11  6:15 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/2] lib/i915/gem_mman: Prioritize GTT mappings over WC Patchwork
2020-01-11  8:40 ` [igt-dev] [PATCH i-g-t 1/2] " Chris Wilson
2020-01-14 22:36 ` [igt-dev] ✗ Fi.CI.IGT: failure for series starting with [i-g-t,1/2] " Patchwork

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