[Intel-gfx] [PATCH 1/3] drm/i915: i915_gem_object_sync must handle NULL

2012-04-11 Thread Ben Widawsky
When I extracted the synchronization code for implementing semaphorified
pageflips (74f5f6e0), I neglected the non pipelined case which also
calls this code. The modesetting code wants to make sure the object has
finished rendering to the frame before configuring the scanout (ie.
non-pipelined case).

As a result of a follow on discussion on IRC, I've decided to add a
comment about the function itself which received much inspiration from
Chris as well. So really, this patch was ghost-written by Chris :).

Reported-by: Chris Wilson ch...@chris-wilson.co.uk
Signed-off-by: Ben Widawsky benjamin.widaw...@intel.com
---
 drivers/gpu/drm/i915/i915_gem.c |   14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 1bfb0d2..9fcdc9a 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1953,6 +1953,18 @@ i915_gem_object_wait_rendering(struct 
drm_i915_gem_object *obj)
return 0;
 }
 
+/**
+ * i915_gem_object_sync - sync an object to a ring.
+ *
+ * @obj: object which may be in use on another ring.
+ * @to: ring we wish to use the object on. May be NULL.
+ *
+ * This code is meant to abstract object synchronization with the GPU.
+ * Calling with NULL implies synchronizing the object with the CPU
+ * rather than a particular GPU ring.
+ *
+ * Returns 0 if successful, else propagates up the lower layer error.
+ */
 int
 i915_gem_object_sync(struct drm_i915_gem_object *obj,
 struct intel_ring_buffer *to)
@@ -1964,7 +1976,7 @@ i915_gem_object_sync(struct drm_i915_gem_object *obj,
if (from == NULL || to == from)
return 0;
 
-   if (!i915_semaphore_is_enabled(obj-base.dev))
+   if (to == NULL || !i915_semaphore_is_enabled(obj-base.dev))
return i915_gem_object_wait_rendering(obj);
 
idx = intel_ring_sync_index(from, to);
-- 
1.7.10

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 1/3] drm/i915: i915_gem_object_sync must handle NULL

2012-04-11 Thread Chris Wilson
On Wed, 11 Apr 2012 11:18:19 -0700, Ben Widawsky b...@bwidawsk.net wrote:
 When I extracted the synchronization code for implementing semaphorified
 pageflips (74f5f6e0), I neglected the non pipelined case which also
 calls this code. The modesetting code wants to make sure the object has
 finished rendering to the frame before configuring the scanout (ie.
 non-pipelined case).
 
 As a result of a follow on discussion on IRC, I've decided to add a
 comment about the function itself which received much inspiration from
 Chris as well. So really, this patch was ghost-written by Chris :).
 
 Reported-by: Chris Wilson ch...@chris-wilson.co.uk
 Signed-off-by: Ben Widawsky benjamin.widaw...@intel.com
Reviewed-by: Chris Wilson ch...@chris-wilson.co.uk
Tested-by: Chris Wilson ch...@chris-wilson.co.uk
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 1/3] drm/i915: i915_gem_object_sync must handle NULL

2012-04-11 Thread Daniel Vetter
On Wed, Apr 11, 2012 at 07:41:04PM +0100, Chris Wilson wrote:
 On Wed, 11 Apr 2012 11:18:19 -0700, Ben Widawsky b...@bwidawsk.net wrote:
  When I extracted the synchronization code for implementing semaphorified
  pageflips (74f5f6e0), I neglected the non pipelined case which also
  calls this code. The modesetting code wants to make sure the object has
  finished rendering to the frame before configuring the scanout (ie.
  non-pipelined case).
  
  As a result of a follow on discussion on IRC, I've decided to add a
  comment about the function itself which received much inspiration from
  Chris as well. So really, this patch was ghost-written by Chris :).
  
  Reported-by: Chris Wilson ch...@chris-wilson.co.uk
  Signed-off-by: Ben Widawsky benjamin.widaw...@intel.com
 Reviewed-by: Chris Wilson ch...@chris-wilson.co.uk
 Tested-by: Chris Wilson ch...@chris-wilson.co.uk
I've picked up all 3 patches for -next, thanks for them.
-Daniel
-- 
Daniel Vetter
Mail: dan...@ffwll.ch
Mobile: +41 (0)79 365 57 48
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx