Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-gfx] [PATCH] drm/i915/gem: Allow importing of shmemfs objects into any device
@ 2021-01-20 15:40 Chris Wilson
  2021-01-20 17:46 ` Matthew Auld
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Chris Wilson @ 2021-01-20 15:40 UTC (permalink / raw)
  To: intel-gfx; +Cc: Matthew Auld, Chris Wilson

If we import a shmemfs object between devices, for example from
Tigerlake to DG1, we can simply reuse the native object and its backing
store.

Suggested-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.auld@intel.com>
Cc: Imre Deak <imre.deak@intel.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c b/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
index 04e9c04545ad..4816f08c4009 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
@@ -242,6 +242,13 @@ struct drm_gem_object *i915_gem_prime_import(struct drm_device *dev,
 			 */
 			return &i915_gem_object_get(obj)->base;
 		}
+
+		/*
+		 * If the object is in plain system memory, we can reuse the
+		 * same backing store in any device.
+		 */
+		if (i915_gem_object_is_shmem(obj))
+			return &i915_gem_object_get(obj)->base;
 	}
 
 	/* need to attach */
-- 
2.20.1

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

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

end of thread, other threads:[~2021-01-22 20:09 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-20 15:40 [Intel-gfx] [PATCH] drm/i915/gem: Allow importing of shmemfs objects into any device Chris Wilson
2021-01-20 17:46 ` Matthew Auld
     [not found]   ` <161116596844.3420.4138630766326614766@build.alporthouse.com>
2021-01-20 20:59     ` Chris Wilson
2021-01-21 11:00       ` Tvrtko Ursulin
2021-01-21 11:03         ` Chris Wilson
2021-01-21 11:14           ` Tvrtko Ursulin
2021-01-22 20:09   ` Ruhl, Michael J
2021-01-20 20:53 ` kernel test robot
2021-01-20 21:31 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for " Patchwork

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