From patchwork Tue Jan 29 16:13:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 2062741 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id DE2FC3FCD5 for ; Tue, 29 Jan 2013 16:18:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E1DCEE68BF for ; Tue, 29 Jan 2013 08:18:05 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTP id 50DEFE68AE for ; Tue, 29 Jan 2013 08:14:17 -0800 (PST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 29 Jan 2013 08:14:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.84,561,1355126400"; d="scan'208";a="283672357" Received: from stinkbox.fi.intel.com (HELO stinkbox) ([10.237.72.168]) by fmsmga002.fm.intel.com with SMTP; 29 Jan 2013 08:14:14 -0800 Received: by stinkbox (sSMTP sendmail emulation); Tue, 29 Jan 2013 18:14:13 +0200 From: ville.syrjala@linux.intel.com To: intel-gfx@lists.freedesktop.org Date: Tue, 29 Jan 2013 18:13:37 +0200 Message-Id: <1359476018-31274-6-git-send-email-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1359476018-31274-1-git-send-email-ville.syrjala@linux.intel.com> References: <1359476018-31274-1-git-send-email-ville.syrjala@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 5/6] drm/i915: Add intel_crtc_wait_for_pending_flips_locked() X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org From: Ville Syrjälä 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ä Reviewed-by: Damien Lespiau --- 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); }