aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_gem.c
diff options
context:
space:
mode:
authorBen Widawsky <ben@bwidawsk.net>2012-04-11 14:18:19 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2012-04-12 15:14:13 -0400
commit5816d648d5f0d496d7bf11ab9174a365c791ccc6 (patch)
treed5bce141a521b134bc0b8fa47553c63baddfafff /drivers/gpu/drm/i915/i915_gem.c
parentf82cfb6bcda164ef3a66b8c3fc549b1f9bdd09ad (diff)
drm/i915: i915_gem_object_sync must handle NULL
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 <chris@chris-wilson.co.uk> Signed-off-by: Ben Widawsky <benjamin.widawsky@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Tested-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_gem.c')
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 1bfb0d28e438..9fcdc9a917eb 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)
1953 return 0; 1953 return 0;
1954} 1954}
1955 1955
1956/**
1957 * i915_gem_object_sync - sync an object to a ring.
1958 *
1959 * @obj: object which may be in use on another ring.
1960 * @to: ring we wish to use the object on. May be NULL.
1961 *
1962 * This code is meant to abstract object synchronization with the GPU.
1963 * Calling with NULL implies synchronizing the object with the CPU
1964 * rather than a particular GPU ring.
1965 *
1966 * Returns 0 if successful, else propagates up the lower layer error.
1967 */
1956int 1968int
1957i915_gem_object_sync(struct drm_i915_gem_object *obj, 1969i915_gem_object_sync(struct drm_i915_gem_object *obj,
1958 struct intel_ring_buffer *to) 1970 struct intel_ring_buffer *to)
@@ -1964,7 +1976,7 @@ i915_gem_object_sync(struct drm_i915_gem_object *obj,
1964 if (from == NULL || to == from) 1976 if (from == NULL || to == from)
1965 return 0; 1977 return 0;
1966 1978
1967 if (!i915_semaphore_is_enabled(obj->base.dev)) 1979 if (to == NULL || !i915_semaphore_is_enabled(obj->base.dev))
1968 return i915_gem_object_wait_rendering(obj); 1980 return i915_gem_object_wait_rendering(obj);
1969 1981
1970 idx = intel_ring_sync_index(from, to); 1982 idx = intel_ring_sync_index(from, to);