All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] drm/i915: use semaphores for the display plane
@ 2012-04-05 21:47 Ben Widawsky
  2012-04-10 10:04 ` Daniel Vetter
  2012-04-11 11:53 ` Chris Wilson
  0 siblings, 2 replies; 7+ messages in thread
From: Ben Widawsky @ 2012-04-05 21:47 UTC (permalink / raw)
  To: intel-gfx; +Cc: Ben Widawsky

In theory this will have performance and power improvements. Performance
because we don't need to stall when the scanout BO is busy, and power
because we don't have to stall when the BO is busy (and the ring can
even go to sleep if the HW supports it).

v2:
squash 2 patches into 1 (me)
un-inline the enable_semaphores function (Daniel)
remove comment about SNB hangs from i915_gem_object_sync (Chris)
rename intel_enable_semaphores to i915_semaphore_is_enabled (me)
removed page flip comment; "no why" (Chris)

To address other comments from Daniel (irc):
update the comment to say 'vt-d is crap, don't enable semaphores'
  - I think you misinterpreted Chris' comment, it already exists.
checking out whether we can pageflip on the render ring on ivb (didn't
work on early silicon)
  - We don't want to enable workarounds for early silicon unless we have
    to.
  - I can't find any references in the docs about this.
optionally use it if the fb is already busy on the render ring
  - This should be how the code already worked, unless I am
    misunderstanding your meaning.

CC: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
---
 drivers/gpu/drm/i915/i915_drv.c            |   15 +++++++
 drivers/gpu/drm/i915/i915_drv.h            |    4 ++
 drivers/gpu/drm/i915/i915_gem.c            |   51 +++++++++++++++++++----
 drivers/gpu/drm/i915/i915_gem_execbuffer.c |   60 +---------------------------
 4 files changed, 64 insertions(+), 66 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 0efc02e..d03645a 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -389,6 +389,21 @@ void intel_detect_pch(struct drm_device *dev)
 	}
 }
 
+bool i915_semaphore_is_enabled(struct drm_device *dev)
+{
+	if (INTEL_INFO(dev)->gen < 6)
+		return 0;
+
+	if (i915_semaphores >= 0)
+		return i915_semaphores;
+
+	/* Enable semaphores on SNB when IO remapping is off */
+	if (INTEL_INFO(dev)->gen == 6)
+		return !intel_iommu_enabled;
+
+	return 1;
+}
+
 void __gen6_gt_force_wake_get(struct drm_i915_private *dev_priv)
 {
 	int count;
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index b617cd5..3f2d460 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -38,6 +38,7 @@
 #include <linux/i2c-algo-bit.h>
 #include <drm/intel-gtt.h>
 #include <linux/backlight.h>
+#include <linux/intel-iommu.h>
 
 /* General customization:
  */
@@ -1209,6 +1210,8 @@ void i915_gem_lastclose(struct drm_device *dev);
 
 int __must_check i915_mutex_lock_interruptible(struct drm_device *dev);
 int __must_check i915_gem_object_wait_rendering(struct drm_i915_gem_object *obj);
+int i915_gem_object_sync(struct drm_i915_gem_object *obj,
+			 struct intel_ring_buffer *to);
 void i915_gem_object_move_to_active(struct drm_i915_gem_object *obj,
 				    struct intel_ring_buffer *ring,
 				    u32 seqno);
@@ -1416,6 +1419,7 @@ extern void gen6_set_rps(struct drm_device *dev, u8 val);
 extern void intel_detect_pch(struct drm_device *dev);
 extern int intel_trans_dp_port_sel(struct drm_crtc *crtc);
 
+extern bool i915_semaphore_is_enabled(struct drm_device *dev);
 extern void __gen6_gt_force_wake_get(struct drm_i915_private *dev_priv);
 extern void __gen6_gt_force_wake_mt_get(struct drm_i915_private *dev_priv);
 extern void __gen6_gt_force_wake_put(struct drm_i915_private *dev_priv);
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 759daa4..6322e14 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1953,6 +1953,48 @@ i915_gem_object_wait_rendering(struct drm_i915_gem_object *obj)
 	return 0;
 }
 
+int
+i915_gem_object_sync(struct drm_i915_gem_object *obj,
+		     struct intel_ring_buffer *to)
+{
+	struct intel_ring_buffer *from = obj->ring;
+	u32 seqno;
+	int ret, idx;
+
+	if (from == NULL || to == from)
+		return 0;
+
+	if (!i915_semaphore_is_enabled(obj->base.dev))
+		return i915_gem_object_wait_rendering(obj);
+
+	idx = intel_ring_sync_index(from, to);
+
+	seqno = obj->last_rendering_seqno;
+	if (seqno <= from->sync_seqno[idx])
+		return 0;
+
+	if (seqno == from->outstanding_lazy_request) {
+		struct drm_i915_gem_request *request;
+
+		request = kzalloc(sizeof(*request), GFP_KERNEL);
+		if (request == NULL)
+			return -ENOMEM;
+
+		ret = i915_add_request(from, NULL, request);
+		if (ret) {
+			kfree(request);
+			return ret;
+		}
+
+		seqno = request->seqno;
+	}
+
+	from->sync_seqno[idx] = seqno;
+
+	return to->sync_to(to, from, seqno - 1);
+
+}
+
 static void i915_gem_object_finish_gtt(struct drm_i915_gem_object *obj)
 {
 	u32 old_write_domain, old_read_domains;
@@ -2923,11 +2965,6 @@ int i915_gem_object_set_cache_level(struct drm_i915_gem_object *obj,
  * Prepare buffer for display plane (scanout, cursors, etc).
  * Can be called from an uninterruptible phase (modesetting) and allows
  * any flushes to be pipelined (for pageflips).
- *
- * For the display plane, we want to be in the GTT but out of any write
- * domains. So in many ways this looks like set_to_gtt_domain() apart from the
- * ability to pipeline the waits, pinning and any additional subtleties
- * that may differentiate the display plane from ordinary buffers.
  */
 int
 i915_gem_object_pin_to_display_plane(struct drm_i915_gem_object *obj,
@@ -2942,8 +2979,8 @@ i915_gem_object_pin_to_display_plane(struct drm_i915_gem_object *obj,
 		return ret;
 
 	if (pipelined != obj->ring) {
-		ret = i915_gem_object_wait_rendering(obj);
-		if (ret == -ERESTARTSYS)
+		ret = i915_gem_object_sync(obj, pipelined);
+		if (ret)
 			return ret;
 	}
 
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index 8e0b686..398e9a6 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -840,64 +840,6 @@ i915_gem_execbuffer_flush(struct drm_device *dev,
 	return 0;
 }
 
-static bool
-intel_enable_semaphores(struct drm_device *dev)
-{
-	if (INTEL_INFO(dev)->gen < 6)
-		return 0;
-
-	if (i915_semaphores >= 0)
-		return i915_semaphores;
-
-	/* Disable semaphores on SNB */
-	if (INTEL_INFO(dev)->gen == 6)
-		return 0;
-
-	return 1;
-}
-
-static int
-i915_gem_execbuffer_sync_rings(struct drm_i915_gem_object *obj,
-			       struct intel_ring_buffer *to)
-{
-	struct intel_ring_buffer *from = obj->ring;
-	u32 seqno;
-	int ret, idx;
-
-	if (from == NULL || to == from)
-		return 0;
-
-	/* XXX gpu semaphores are implicated in various hard hangs on SNB */
-	if (!intel_enable_semaphores(obj->base.dev))
-		return i915_gem_object_wait_rendering(obj);
-
-	idx = intel_ring_sync_index(from, to);
-
-	seqno = obj->last_rendering_seqno;
-	if (seqno <= from->sync_seqno[idx])
-		return 0;
-
-	if (seqno == from->outstanding_lazy_request) {
-		struct drm_i915_gem_request *request;
-
-		request = kzalloc(sizeof(*request), GFP_KERNEL);
-		if (request == NULL)
-			return -ENOMEM;
-
-		ret = i915_add_request(from, NULL, request);
-		if (ret) {
-			kfree(request);
-			return ret;
-		}
-
-		seqno = request->seqno;
-	}
-
-	from->sync_seqno[idx] = seqno;
-
-	return to->sync_to(to, from, seqno - 1);
-}
-
 static int
 i915_gem_execbuffer_wait_for_flips(struct intel_ring_buffer *ring, u32 flips)
 {
@@ -959,7 +901,7 @@ i915_gem_execbuffer_move_to_gpu(struct intel_ring_buffer *ring,
 	}
 
 	list_for_each_entry(obj, objects, exec_list) {
-		ret = i915_gem_execbuffer_sync_rings(obj, ring);
+		ret = i915_gem_object_sync(obj, ring);
 		if (ret)
 			return ret;
 	}
-- 
1.7.9.5

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

* Re: [PATCH v2] drm/i915: use semaphores for the display plane
  2012-04-05 21:47 [PATCH v2] drm/i915: use semaphores for the display plane Ben Widawsky
@ 2012-04-10 10:04 ` Daniel Vetter
  2012-04-11 11:53 ` Chris Wilson
  1 sibling, 0 replies; 7+ messages in thread
From: Daniel Vetter @ 2012-04-10 10:04 UTC (permalink / raw)
  To: Ben Widawsky; +Cc: intel-gfx

On Thu, Apr 05, 2012 at 02:47:36PM -0700, Ben Widawsky wrote:
> In theory this will have performance and power improvements. Performance
> because we don't need to stall when the scanout BO is busy, and power
> because we don't have to stall when the BO is busy (and the ring can
> even go to sleep if the HW supports it).
> 
> v2:
> squash 2 patches into 1 (me)
> un-inline the enable_semaphores function (Daniel)
> remove comment about SNB hangs from i915_gem_object_sync (Chris)
> rename intel_enable_semaphores to i915_semaphore_is_enabled (me)
> removed page flip comment; "no why" (Chris)
> 
> To address other comments from Daniel (irc):
> update the comment to say 'vt-d is crap, don't enable semaphores'
>   - I think you misinterpreted Chris' comment, it already exists.
> checking out whether we can pageflip on the render ring on ivb (didn't
> work on early silicon)
>   - We don't want to enable workarounds for early silicon unless we have
>     to.
>   - I can't find any references in the docs about this.
> optionally use it if the fb is already busy on the render ring
>   - This should be how the code already worked, unless I am
>     misunderstanding your meaning.
> 
> CC: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Queued for -next (with Chris' irc r-b added), thanks for the patch.
-Daniel
-- 
Daniel Vetter
Mail: daniel@ffwll.ch
Mobile: +41 (0)79 365 57 48

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

* Re: [PATCH v2] drm/i915: use semaphores for the display plane
  2012-04-05 21:47 [PATCH v2] drm/i915: use semaphores for the display plane Ben Widawsky
  2012-04-10 10:04 ` Daniel Vetter
@ 2012-04-11 11:53 ` Chris Wilson
  2012-04-11 12:06   ` Daniel Vetter
  1 sibling, 1 reply; 7+ messages in thread
From: Chris Wilson @ 2012-04-11 11:53 UTC (permalink / raw)
  To: intel-gfx; +Cc: Ben Widawsky

On Thu,  5 Apr 2012 14:47:36 -0700, Ben Widawsky <ben@bwidawsk.net> wrote:
> In theory this will have performance and power improvements. Performance
> because we don't need to stall when the scanout BO is busy, and power
> because we don't have to stall when the BO is busy (and the ring can
> even go to sleep if the HW supports it).
> 
> v2:
> squash 2 patches into 1 (me)
> un-inline the enable_semaphores function (Daniel)
> remove comment about SNB hangs from i915_gem_object_sync (Chris)
> rename intel_enable_semaphores to i915_semaphore_is_enabled (me)
> removed page flip comment; "no why" (Chris)
> 
> To address other comments from Daniel (irc):
> update the comment to say 'vt-d is crap, don't enable semaphores'
>   - I think you misinterpreted Chris' comment, it already exists.
> checking out whether we can pageflip on the render ring on ivb (didn't
> work on early silicon)
>   - We don't want to enable workarounds for early silicon unless we have
>     to.
>   - I can't find any references in the docs about this.
> optionally use it if the fb is already busy on the render ring
>   - This should be how the code already worked, unless I am
>     misunderstanding your meaning.
> 
> CC: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: Ben Widawsky <ben@bwidawsk.net>

> +int
> +i915_gem_object_sync(struct drm_i915_gem_object *obj,
> +		     struct intel_ring_buffer *to)
> +{
> +	struct intel_ring_buffer *from = obj->ring;
> +	u32 seqno;
> +	int ret, idx;
> +
> +	if (from == NULL || to == from)
> +		return 0;
> +
> +	if (!i915_semaphore_is_enabled(obj->base.dev))
Bug^ :(
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

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

* Re: [PATCH v2] drm/i915: use semaphores for the display plane
  2012-04-11 11:53 ` Chris Wilson
@ 2012-04-11 12:06   ` Daniel Vetter
  2012-04-11 15:46     ` Ben Widawsky
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Vetter @ 2012-04-11 12:06 UTC (permalink / raw)
  To: Chris Wilson; +Cc: Ben Widawsky, intel-gfx

On Wed, Apr 11, 2012 at 12:53:15PM +0100, Chris Wilson wrote:
> On Thu,  5 Apr 2012 14:47:36 -0700, Ben Widawsky <ben@bwidawsk.net> wrote:
> > In theory this will have performance and power improvements. Performance
> > because we don't need to stall when the scanout BO is busy, and power
> > because we don't have to stall when the BO is busy (and the ring can
> > even go to sleep if the HW supports it).
> > 
> > v2:
> > squash 2 patches into 1 (me)
> > un-inline the enable_semaphores function (Daniel)
> > remove comment about SNB hangs from i915_gem_object_sync (Chris)
> > rename intel_enable_semaphores to i915_semaphore_is_enabled (me)
> > removed page flip comment; "no why" (Chris)
> > 
> > To address other comments from Daniel (irc):
> > update the comment to say 'vt-d is crap, don't enable semaphores'
> >   - I think you misinterpreted Chris' comment, it already exists.
> > checking out whether we can pageflip on the render ring on ivb (didn't
> > work on early silicon)
> >   - We don't want to enable workarounds for early silicon unless we have
> >     to.
> >   - I can't find any references in the docs about this.
> > optionally use it if the fb is already busy on the render ring
> >   - This should be how the code already worked, unless I am
> >     misunderstanding your meaning.
> > 
> > CC: Chris Wilson <chris@chris-wilson.co.uk>
> > Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
> 
> > +int
> > +i915_gem_object_sync(struct drm_i915_gem_object *obj,
> > +		     struct intel_ring_buffer *to)
> > +{
> > +	struct intel_ring_buffer *from = obj->ring;
> > +	u32 seqno;
> > +	int ret, idx;
> > +
> > +	if (from == NULL || to == from)
> > +		return 0;
> > +
> > +	if (!i915_semaphore_is_enabled(obj->base.dev))
> Bug^ :(

To elaborate, for to == NULL we need to do a synchronous wait_rendering,
too. This happens for set_base and modeset. Furthermore I've noticed two
other things while reading this function that imo deserve each another
patch:
- we update from->sync_seqno before to->sync_to successfully emits the
  sync. That should happen after sync_to (and obviously only if that
  succeeds).
- the seqno - 1 semantics of sync_to is annoying me. Imo that kind of
  low-level stuff should be handled by the sync_to implementation.

Unfortunately neither the bug noticed by Chris nor the sync_seqno thing
can easily be exercised with i-g-t :(

Cheers, Daniel
-- 
Daniel Vetter
Mail: daniel@ffwll.ch
Mobile: +41 (0)79 365 57 48

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

* Re: [PATCH v2] drm/i915: use semaphores for the display plane
  2012-04-11 12:06   ` Daniel Vetter
@ 2012-04-11 15:46     ` Ben Widawsky
  2012-04-11 15:52       ` Chris Wilson
  0 siblings, 1 reply; 7+ messages in thread
From: Ben Widawsky @ 2012-04-11 15:46 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: intel-gfx

On Wed, 11 Apr 2012 14:06:42 +0200
Daniel Vetter <daniel@ffwll.ch> wrote:

> On Wed, Apr 11, 2012 at 12:53:15PM +0100, Chris Wilson wrote:
> > On Thu,  5 Apr 2012 14:47:36 -0700, Ben Widawsky <ben@bwidawsk.net> wrote:
> > > In theory this will have performance and power improvements. Performance
> > > because we don't need to stall when the scanout BO is busy, and power
> > > because we don't have to stall when the BO is busy (and the ring can
> > > even go to sleep if the HW supports it).
> > > 
> > > v2:
> > > squash 2 patches into 1 (me)
> > > un-inline the enable_semaphores function (Daniel)
> > > remove comment about SNB hangs from i915_gem_object_sync (Chris)
> > > rename intel_enable_semaphores to i915_semaphore_is_enabled (me)
> > > removed page flip comment; "no why" (Chris)
> > > 
> > > To address other comments from Daniel (irc):
> > > update the comment to say 'vt-d is crap, don't enable semaphores'
> > >   - I think you misinterpreted Chris' comment, it already exists.
> > > checking out whether we can pageflip on the render ring on ivb (didn't
> > > work on early silicon)
> > >   - We don't want to enable workarounds for early silicon unless we have
> > >     to.
> > >   - I can't find any references in the docs about this.
> > > optionally use it if the fb is already busy on the render ring
> > >   - This should be how the code already worked, unless I am
> > >     misunderstanding your meaning.
> > > 
> > > CC: Chris Wilson <chris@chris-wilson.co.uk>
> > > Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
> > 
> > > +int
> > > +i915_gem_object_sync(struct drm_i915_gem_object *obj,
> > > +		     struct intel_ring_buffer *to)
> > > +{
> > > +	struct intel_ring_buffer *from = obj->ring;
> > > +	u32 seqno;
> > > +	int ret, idx;
> > > +
> > > +	if (from == NULL || to == from)
> > > +		return 0;
> > > +
> > > +	if (!i915_semaphore_is_enabled(obj->base.dev))
> > Bug^ :(
> 
> To elaborate, for to == NULL we need to do a synchronous wait_rendering,
> too. This happens for set_base and modeset. Furthermore I've noticed two
> other things while reading this function that imo deserve each another
> patch:

if (from == NULL && !obj->active) should suffice?

This sounds like a pretty bad hack when it at some point in modesetting
code... who would have thought?

> - we update from->sync_seqno before to->sync_to successfully emits the
>   sync. That should happen after sync_to (and obviously only if that
>   succeeds).

Probably a remnant of when ring_begin couldn't fail. This deserves to be
fixed, I will do this today if y'all haven't done it already.

> - the seqno - 1 semantics of sync_to is annoying me. Imo that kind of
>   low-level stuff should be handled by the sync_to implementation.

If it ain't broke, don't fix it? I do agree with you, but I'll venture
to guess that I am less annoyed by it.

> 
> Unfortunately neither the bug noticed by Chris nor the sync_seqno thing
> can easily be exercised with i-g-t :(
> 
> Cheers, Daniel

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

* Re: [PATCH v2] drm/i915: use semaphores for the display plane
  2012-04-11 15:46     ` Ben Widawsky
@ 2012-04-11 15:52       ` Chris Wilson
  2012-04-11 16:00         ` Ben Widawsky
  0 siblings, 1 reply; 7+ messages in thread
From: Chris Wilson @ 2012-04-11 15:52 UTC (permalink / raw)
  To: Ben Widawsky, Daniel Vetter; +Cc: intel-gfx

On Wed, 11 Apr 2012 08:46:40 -0700, Ben Widawsky <ben@bwidawsk.net> wrote:
> On Wed, 11 Apr 2012 14:06:42 +0200
> Daniel Vetter <daniel@ffwll.ch> wrote:
> 
> > On Wed, Apr 11, 2012 at 12:53:15PM +0100, Chris Wilson wrote:
> > > On Thu,  5 Apr 2012 14:47:36 -0700, Ben Widawsky <ben@bwidawsk.net> wrote:
> > > > In theory this will have performance and power improvements. Performance
> > > > because we don't need to stall when the scanout BO is busy, and power
> > > > because we don't have to stall when the BO is busy (and the ring can
> > > > even go to sleep if the HW supports it).
> > > > 
> > > > v2:
> > > > squash 2 patches into 1 (me)
> > > > un-inline the enable_semaphores function (Daniel)
> > > > remove comment about SNB hangs from i915_gem_object_sync (Chris)
> > > > rename intel_enable_semaphores to i915_semaphore_is_enabled (me)
> > > > removed page flip comment; "no why" (Chris)
> > > > 
> > > > To address other comments from Daniel (irc):
> > > > update the comment to say 'vt-d is crap, don't enable semaphores'
> > > >   - I think you misinterpreted Chris' comment, it already exists.
> > > > checking out whether we can pageflip on the render ring on ivb (didn't
> > > > work on early silicon)
> > > >   - We don't want to enable workarounds for early silicon unless we have
> > > >     to.
> > > >   - I can't find any references in the docs about this.
> > > > optionally use it if the fb is already busy on the render ring
> > > >   - This should be how the code already worked, unless I am
> > > >     misunderstanding your meaning.
> > > > 
> > > > CC: Chris Wilson <chris@chris-wilson.co.uk>
> > > > Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
> > > 
> > > > +int
> > > > +i915_gem_object_sync(struct drm_i915_gem_object *obj,
> > > > +		     struct intel_ring_buffer *to)
> > > > +{
> > > > +	struct intel_ring_buffer *from = obj->ring;
> > > > +	u32 seqno;
> > > > +	int ret, idx;
> > > > +
> > > > +	if (from == NULL || to == from)
> > > > +		return 0;
> > > > +
> > > > +	if (!i915_semaphore_is_enabled(obj->base.dev))
> > > Bug^ :(
> > 
> > To elaborate, for to == NULL we need to do a synchronous wait_rendering,
> > too. This happens for set_base and modeset. Furthermore I've noticed two
> > other things while reading this function that imo deserve each another
> > patch:
> 
> if (from == NULL && !obj->active) should suffice?

if (to == NULL || !i915_sempahores)
  return i915_gem_object_wait_rendering(obj);
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

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

* Re: [PATCH v2] drm/i915: use semaphores for the display plane
  2012-04-11 15:52       ` Chris Wilson
@ 2012-04-11 16:00         ` Ben Widawsky
  0 siblings, 0 replies; 7+ messages in thread
From: Ben Widawsky @ 2012-04-11 16:00 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

On Wed, 11 Apr 2012 16:52:33 +0100
Chris Wilson <chris@chris-wilson.co.uk> wrote:

> On Wed, 11 Apr 2012 08:46:40 -0700, Ben Widawsky <ben@bwidawsk.net> wrote:
> > On Wed, 11 Apr 2012 14:06:42 +0200
> > Daniel Vetter <daniel@ffwll.ch> wrote:
> > 
> > > On Wed, Apr 11, 2012 at 12:53:15PM +0100, Chris Wilson wrote:
> > > > On Thu,  5 Apr 2012 14:47:36 -0700, Ben Widawsky <ben@bwidawsk.net> wrote:
> > > > > In theory this will have performance and power improvements. Performance
> > > > > because we don't need to stall when the scanout BO is busy, and power
> > > > > because we don't have to stall when the BO is busy (and the ring can
> > > > > even go to sleep if the HW supports it).
> > > > > 
> > > > > v2:
> > > > > squash 2 patches into 1 (me)
> > > > > un-inline the enable_semaphores function (Daniel)
> > > > > remove comment about SNB hangs from i915_gem_object_sync (Chris)
> > > > > rename intel_enable_semaphores to i915_semaphore_is_enabled (me)
> > > > > removed page flip comment; "no why" (Chris)
> > > > > 
> > > > > To address other comments from Daniel (irc):
> > > > > update the comment to say 'vt-d is crap, don't enable semaphores'
> > > > >   - I think you misinterpreted Chris' comment, it already exists.
> > > > > checking out whether we can pageflip on the render ring on ivb (didn't
> > > > > work on early silicon)
> > > > >   - We don't want to enable workarounds for early silicon unless we have
> > > > >     to.
> > > > >   - I can't find any references in the docs about this.
> > > > > optionally use it if the fb is already busy on the render ring
> > > > >   - This should be how the code already worked, unless I am
> > > > >     misunderstanding your meaning.
> > > > > 
> > > > > CC: Chris Wilson <chris@chris-wilson.co.uk>
> > > > > Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
> > > > 
> > > > > +int
> > > > > +i915_gem_object_sync(struct drm_i915_gem_object *obj,
> > > > > +		     struct intel_ring_buffer *to)
> > > > > +{
> > > > > +	struct intel_ring_buffer *from = obj->ring;
> > > > > +	u32 seqno;
> > > > > +	int ret, idx;
> > > > > +
> > > > > +	if (from == NULL || to == from)
> > > > > +		return 0;
> > > > > +
> > > > > +	if (!i915_semaphore_is_enabled(obj->base.dev))
> > > > Bug^ :(
> > > 
> > > To elaborate, for to == NULL we need to do a synchronous wait_rendering,
> > > too. This happens for set_base and modeset. Furthermore I've noticed two
> > > other things while reading this function that imo deserve each another
> > > patch:
> > 
> > if (from == NULL && !obj->active) should suffice?
> 
> if (to == NULL || !i915_sempahores)
>   return i915_gem_object_wait_rendering(obj);
> -Chris
> 

Ha, I misread it... I thought from->ring could be NULL, and we needed to
wait for rendering. So wait, in this case, to and from are both NULL?
Doesn't that mean both objects are already setup for use by display? A
bad assumption, but I think it would technically work as the code is,
today.

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

end of thread, other threads:[~2012-04-11 16:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-05 21:47 [PATCH v2] drm/i915: use semaphores for the display plane Ben Widawsky
2012-04-10 10:04 ` Daniel Vetter
2012-04-11 11:53 ` Chris Wilson
2012-04-11 12:06   ` Daniel Vetter
2012-04-11 15:46     ` Ben Widawsky
2012-04-11 15:52       ` Chris Wilson
2012-04-11 16:00         ` Ben Widawsky

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.