public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Michel Thierry <michel.thierry@intel.com>
Cc: "Intel-gfx@lists.freedesktop.org"
	<Intel-gfx@lists.freedesktop.org>,
	Daniel Vetter <daniel.vetter@ffwll.ch>
Subject: Re: [PATCH 1/2] drm/i915: Infrastructure for supporting different GGTT views per object
Date: Wed, 10 Dec 2014 10:16:36 +0100	[thread overview]
Message-ID: <20141210091636.GA27182@phenom.ffwll.local> (raw)
In-Reply-To: <548713F7.6000603@intel.com>

On Tue, Dec 09, 2014 at 03:23:35PM +0000, Michel Thierry wrote:
> On 12/5/2014 12:11 PM, Tvrtko Ursulin wrote:
> >From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> >
> >Things like reliable GGTT mappings and mirrored 2d-on-3d display will need
> >to map objects into the same address space multiple times.
> >
> >Added a GGTT view concept and linked it with the VMA to distinguish between
> >multiple instances per address space.
> >
> >New objects and GEM functions which do not take this new view as a parameter
> >assume the default of zero (I915_GGTT_VIEW_NORMAL) which preserves the
> >previous behaviour.
> >
> >This now means that objects can have multiple VMA entries so the code which
> >assumed there will only be one also had to be modified.
> >
> >Alternative GGTT views are supposed to borrow DMA addresses from obj->pages
> >which is DMA mapped on first VMA instantiation and unmapped on the last one
> >going away.
> >
> >v2:
> >     * Removed per view special casing in i915_gem_ggtt_prepare /
> >       finish_object in favour of creating and destroying DMA mappings
> >       on first VMA instantiation and last VMA destruction. (Daniel Vetter)
> >     * Simplified i915_vma_unbind which does not need to count the GGTT views.
> >       (Daniel Vetter)
> >     * Also moved obj->map_and_fenceable reset under the same check.
> >     * Checkpatch cleanups.
> >
> >v3:
> >     * Only retire objects once the last VMA is unbound.
> >
> >v4:
> >     * Keep scatter-gather table for alternative views persistent for the
> >       lifetime of the VMA.
> >     * Propagate binding errors to callers and handle appropriately.
> >
> >For: VIZ-4544
> >Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> >Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> >---
> >  drivers/gpu/drm/i915/i915_debugfs.c        |   5 +-
> >  drivers/gpu/drm/i915/i915_drv.h            |  46 +++++++++++--
> >  drivers/gpu/drm/i915/i915_gem.c            | 101 ++++++++++++++++++-----------
> >  drivers/gpu/drm/i915/i915_gem_context.c    |  11 +++-
> >  drivers/gpu/drm/i915/i915_gem_execbuffer.c |   9 ++-
> >  drivers/gpu/drm/i915/i915_gem_gtt.c        |  70 +++++++++++++++++---
> >  drivers/gpu/drm/i915/i915_gem_gtt.h        |  22 +++++++
> >  drivers/gpu/drm/i915/i915_gpu_error.c      |   8 +--
> >  8 files changed, 206 insertions(+), 66 deletions(-)
> >
> >diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> >index 6c16939..bd08289 100644
> >--- a/drivers/gpu/drm/i915/i915_debugfs.c
> >+++ b/drivers/gpu/drm/i915/i915_debugfs.c
> >@@ -152,8 +152,9 @@ describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj)
> >  			seq_puts(m, " (pp");
> >  		else
> >  			seq_puts(m, " (g");
> >-		seq_printf(m, "gtt offset: %08lx, size: %08lx)",
> >-			   vma->node.start, vma->node.size);
> >+		seq_printf(m, "gtt offset: %08lx, size: %08lx, type: %u)",
> >+			   vma->node.start, vma->node.size,
> >+			   vma->ggtt_view.type);
> >  	}
> >  	if (obj->stolen)
> >  		seq_printf(m, " (stolen: %08lx)", obj->stolen->start);
> >diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> >index 049482f..b2f6f7d 100644
> >--- a/drivers/gpu/drm/i915/i915_drv.h
> >+++ b/drivers/gpu/drm/i915/i915_drv.h
> >@@ -2514,10 +2514,23 @@ void i915_gem_vma_destroy(struct i915_vma *vma);
> >  #define PIN_GLOBAL 0x4
> >  #define PIN_OFFSET_BIAS 0x8
> >  #define PIN_OFFSET_MASK (~4095)
> >+int __must_check i915_gem_object_pin_view(struct drm_i915_gem_object *obj,
> >+					  struct i915_address_space *vm,
> >+					  uint32_t alignment,
> >+					  uint64_t flags,
> >+					  const struct i915_ggtt_view *view);
> >+static inline
> >  int __must_check i915_gem_object_pin(struct drm_i915_gem_object *obj,
> >  				     struct i915_address_space *vm,
> >  				     uint32_t alignment,
> >-				     uint64_t flags);
> >+				     uint64_t flags)
> >+{
> >+	return i915_gem_object_pin_view(obj, vm, alignment, flags,
> >+						&i915_ggtt_view_normal);
> >+}
> >+
> >+int i915_vma_bind(struct i915_vma *vma, enum i915_cache_level cache_level,
> >+		  u32 flags);
> >  int __must_check i915_vma_unbind(struct i915_vma *vma);
> >  int i915_gem_object_put_pages(struct drm_i915_gem_object *obj);
> >  void i915_gem_release_all_mmaps(struct drm_i915_private *dev_priv);
> >@@ -2679,18 +2692,43 @@ struct dma_buf *i915_gem_prime_export(struct drm_device *dev,
> >  void i915_gem_restore_fences(struct drm_device *dev);
> >+unsigned long i915_gem_obj_offset_view(struct drm_i915_gem_object *o,
> >+				       struct i915_address_space *vm,
> >+				       enum i915_ggtt_view_type view);
> >+static inline
> >  unsigned long i915_gem_obj_offset(struct drm_i915_gem_object *o,
> >-				  struct i915_address_space *vm);
> >+				  struct i915_address_space *vm)
> >+{
> >+	return i915_gem_obj_offset_view(o, vm, I915_GGTT_VIEW_NORMAL);
> >+}
> >  bool i915_gem_obj_bound_any(struct drm_i915_gem_object *o);
> >  bool i915_gem_obj_bound(struct drm_i915_gem_object *o,
> >  			struct i915_address_space *vm);
> >  unsigned long i915_gem_obj_size(struct drm_i915_gem_object *o,
> >  				struct i915_address_space *vm);
> >+struct i915_vma *i915_gem_obj_to_vma_view(struct drm_i915_gem_object *obj,
> >+					  struct i915_address_space *vm,
> >+					  const struct i915_ggtt_view *view);
> >+static inline
> >  struct i915_vma *i915_gem_obj_to_vma(struct drm_i915_gem_object *obj,
> >-				     struct i915_address_space *vm);
> >+				     struct i915_address_space *vm)
> >+{
> >+	return i915_gem_obj_to_vma_view(obj, vm, &i915_ggtt_view_normal);
> >+}
> >+
> >+struct i915_vma *
> >+i915_gem_obj_lookup_or_create_vma_view(struct drm_i915_gem_object *obj,
> >+				       struct i915_address_space *vm,
> >+				       const struct i915_ggtt_view *view);
> >+
> >+static inline
> >  struct i915_vma *
> >  i915_gem_obj_lookup_or_create_vma(struct drm_i915_gem_object *obj,
> >-				  struct i915_address_space *vm);
> >+				  struct i915_address_space *vm)
> >+{
> >+	return i915_gem_obj_lookup_or_create_vma_view(obj, vm,
> >+						&i915_ggtt_view_normal);
> >+}
> 
> We also need a _vma_view version of i915_gem_obj_bound;
> i915_gem_object_ggtt_unpin checks if the obj is ggtt_bound and it could be
> that the normal view is gone but a different view is still active (it is
> also used in gpu_error and debug_fs, but I don't think it's a problem
> there).

Where did you see the need for the new obj_bound variant? Probably best to
reply to the patch newly with just the relevant part quoted.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2014-12-10  9:16 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-03 14:59 [PATCH 0/3] Multiple GGTT views Tvrtko Ursulin
2014-12-03 14:59 ` [PATCH 1/3] drm/i915: Stop putting GGTT VMA at the head of the list Tvrtko Ursulin
2014-12-04  9:48   ` Chris Wilson
2014-12-04 10:02     ` Tvrtko Ursulin
2014-12-04 10:17       ` Chris Wilson
2014-12-04 10:30         ` Tvrtko Ursulin
2014-12-04 10:39           ` Chris Wilson
2014-12-04 10:48             ` Tvrtko Ursulin
2014-12-04 10:54     ` Daniel Vetter
2014-12-03 14:59 ` [PATCH 2/3] drm/i915: Infrastructure for supporting different GGTT views per object Tvrtko Ursulin
2014-12-04  9:53   ` Chris Wilson
2014-12-04 10:19     ` Tvrtko Ursulin
2014-12-04 10:26       ` Chris Wilson
2014-12-04 10:59         ` Daniel Vetter
2014-12-04 12:17           ` Tvrtko Ursulin
2014-12-04 12:27             ` Chris Wilson
2014-12-04 13:01             ` Daniel Vetter
2014-12-03 14:59 ` [PATCH 3/3] drm/i915: Documentation for multiple GGTT views Tvrtko Ursulin
2014-12-04  7:12   ` shuang.he
2014-12-05 12:11 ` [PATCH v2 0/2] Multiple " Tvrtko Ursulin
2014-12-05 12:11   ` [PATCH 1/2] drm/i915: Infrastructure for supporting different GGTT views per object Tvrtko Ursulin
2014-12-05 14:25     ` Daniel Vetter
2014-12-09 15:23     ` Michel Thierry
2014-12-10  9:16       ` Daniel Vetter [this message]
2014-12-10 10:17         ` Tvrtko Ursulin
2014-12-05 12:11   ` [PATCH 2/2] drm/i915: Documentation for multiple GGTT views Tvrtko Ursulin
2014-12-09 15:41     ` Michel Thierry
2014-12-10 17:27 ` [PATCH v3 0/2] Multiple " Tvrtko Ursulin
2014-12-10 17:27   ` [PATCH 1/2] drm/i915: Infrastructure for supporting different GGTT views per object Tvrtko Ursulin
2014-12-11 10:18     ` Michel Thierry
2014-12-15 10:24     ` Daniel Vetter
2014-12-15 11:23       ` Tvrtko Ursulin
2014-12-10 17:27   ` [PATCH 2/2] drm/i915: Documentation for multiple GGTT views Tvrtko Ursulin
2014-12-11  3:41     ` shuang.he
2014-12-11 10:19     ` Michel Thierry
2014-12-15  8:30       ` Daniel Vetter
2014-12-15 10:01         ` Michel Thierry

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141210091636.GA27182@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=Intel-gfx@lists.freedesktop.org \
    --cc=daniel.vetter@ffwll.ch \
    --cc=michel.thierry@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox