Commit 96b099fd authored by Chris Wilson's avatar Chris Wilson Committed by Eric Anholt

drm/i915: Propagate error from drm_vblank_get() during page-flipping.

Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarEric Anholt <eric@anholt.net>
parent 5f35308b
...@@ -4897,19 +4897,8 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc, ...@@ -4897,19 +4897,8 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
ret = intel_pin_and_fence_fb_obj(dev, obj); ret = intel_pin_and_fence_fb_obj(dev, obj);
if (ret != 0) { if (ret)
mutex_unlock(&dev->struct_mutex); goto cleanup_work;
spin_lock_irqsave(&dev->event_lock, flags);
intel_crtc->unpin_work = NULL;
spin_unlock_irqrestore(&dev->event_lock, flags);
kfree(work);
DRM_DEBUG_DRIVER("flip queue: %p pin & fence failed\n",
to_intel_bo(obj));
return ret;
}
/* Reference the objects for the scheduled work. */ /* Reference the objects for the scheduled work. */
drm_gem_object_reference(work->old_fb_obj); drm_gem_object_reference(work->old_fb_obj);
...@@ -4917,7 +4906,11 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc, ...@@ -4917,7 +4906,11 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
crtc->fb = fb; crtc->fb = fb;
i915_gem_object_flush_write_domain(obj); i915_gem_object_flush_write_domain(obj);
drm_vblank_get(dev, intel_crtc->pipe);
ret = drm_vblank_get(dev, intel_crtc->pipe);
if (ret)
goto cleanup_objs;
obj_priv = to_intel_bo(obj); obj_priv = to_intel_bo(obj);
atomic_inc(&obj_priv->pending_flip); atomic_inc(&obj_priv->pending_flip);
work->pending_flip_obj = obj; work->pending_flip_obj = obj;
...@@ -4954,6 +4947,20 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc, ...@@ -4954,6 +4947,20 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
trace_i915_flip_request(intel_crtc->plane, obj); trace_i915_flip_request(intel_crtc->plane, obj);
return 0; return 0;
cleanup_objs:
drm_gem_object_unreference(work->old_fb_obj);
drm_gem_object_unreference(obj);
cleanup_work:
mutex_unlock(&dev->struct_mutex);
spin_lock_irqsave(&dev->event_lock, flags);
intel_crtc->unpin_work = NULL;
spin_unlock_irqrestore(&dev->event_lock, flags);
kfree(work);
return ret;
} }
static const struct drm_crtc_helper_funcs intel_helper_funcs = { static const struct drm_crtc_helper_funcs intel_helper_funcs = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment