From: Ville Syrj?l? <ville.syrjala at linux.intel.com> Move the functionality of intel_crtc_wait_for_pending_flips() into intel_crtc_wait_for_pending_flips_locked(). intel_crtc_wait_for_pending_flips() is now just a wrapper that grab struct_mutex and calls intel_crtc_wait_for_pending_flips_locked(). This changes the behaviour of intel_crtc_wait_for_pending_flips() so that it now holds struct_mutex while waiting for pending flips. Signed-off-by: Ville Syrj?l? <ville.syrjala at linux.intel.com> --- drivers/gpu/drm/i915/intel_display.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 6c21985..a2e04f7 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -2281,6 +2281,22 @@ static bool intel_crtc_has_pending_flip(struct drm_crtc *crtc) return pending; } +static void intel_crtc_wait_for_pending_flips_locked(struct drm_crtc *crtc) +{ + struct drm_device *dev = crtc->dev; + struct drm_i915_private *dev_priv = dev->dev_private; + + if (crtc->fb == NULL) + return; + + WARN_ON(waitqueue_active(&dev_priv->pending_flip_queue)); + + wait_event(dev_priv->pending_flip_queue, + !intel_crtc_has_pending_flip(crtc)); + + intel_finish_fb(crtc->fb); +} + static int intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, struct drm_framebuffer *fb) @@ -2880,18 +2896,12 @@ static void ironlake_fdi_disable(struct drm_crtc *crtc) static void intel_crtc_wait_for_pending_flips(struct drm_crtc *crtc) { struct drm_device *dev = crtc->dev; - struct drm_i915_private *dev_priv = dev->dev_private; if (crtc->fb == NULL) return; - WARN_ON(waitqueue_active(&dev_priv->pending_flip_queue)); - - wait_event(dev_priv->pending_flip_queue, - !intel_crtc_has_pending_flip(crtc)); - mutex_lock(&dev->struct_mutex); - intel_finish_fb(crtc->fb); + intel_crtc_wait_for_pending_flips_locked(crtc); mutex_unlock(&dev->struct_mutex); } -- 1.7.12.4