From patchwork Wed Dec 12 16:16:35 2012 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: 1869511 Return-Path: X-Original-To: patchwork-dri-devel@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 20FBC3FC81 for ; Wed, 12 Dec 2012 18:07:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2BBFAE6662 for ; Wed, 12 Dec 2012 10:07:36 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id D7F1DE5CE7; Wed, 12 Dec 2012 08:21:22 -0800 (PST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 12 Dec 2012 08:20:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.84,267,1355126400"; d="scan'208";a="232848052" Received: from stinkbox.fi.intel.com (HELO stinkbox) ([10.237.72.168]) by orsmga001.jf.intel.com with SMTP; 12 Dec 2012 08:20:51 -0800 Received: by stinkbox (sSMTP sendmail emulation); Wed, 12 Dec 2012 18:20:51 +0200 From: ville.syrjala@linux.intel.com To: dri-devel@lists.freedesktop.org Subject: [PATCH 68/81] drm/i915: Drop all flips waiting for the GPU when the CRTC is about to be disabled Date: Wed, 12 Dec 2012 18:16:35 +0200 Message-Id: <1355329008-31459-69-git-send-email-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 1.7.8.6 In-Reply-To: <1355329008-31459-1-git-send-email-ville.syrjala@linux.intel.com> References: <1355329008-31459-1-git-send-email-ville.syrjala@linux.intel.com> MIME-Version: 1.0 Cc: intel-gfx@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org From: Ville Syrjälä Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/intel_atomic.c | 36 +++++++++++++++++++++++++++++++++++ 1 files changed, 36 insertions(+), 0 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c index e52d92a..36446d1 100644 --- a/drivers/gpu/drm/i915/intel_atomic.c +++ b/drivers/gpu/drm/i915/intel_atomic.c @@ -2471,9 +2471,23 @@ void intel_atomic_handle_vblank(struct drm_device *dev, int pipe) void intel_atomic_clear_flips(struct drm_crtc *crtc) { struct drm_device *dev = crtc->dev; + struct drm_i915_private *dev_priv = dev->dev_private; struct intel_crtc *intel_crtc = to_intel_crtc(crtc); struct intel_plane *intel_plane; + struct intel_flip *intel_flip, *next; int pipe = intel_crtc->pipe; + unsigned long flags; + LIST_HEAD(flips); + + /* + * If there are flips still waiting for the GPU, remove them + * from the list, so that they won't be able to move over to + * drm_flip_helpers' possession after we've called + * drm_flip_helper_clear(). + */ + spin_lock_irqsave(&dev_priv->flip.lock, flags); + list_cut_position(&flips, &dev_priv->flip.list, dev_priv->flip.list.prev); + spin_unlock_irqrestore(&dev_priv->flip.lock, flags); drm_flip_helper_clear(&intel_crtc->flip_helper); @@ -2481,4 +2495,26 @@ void intel_atomic_clear_flips(struct drm_crtc *crtc) if (intel_plane->pipe == pipe) drm_flip_helper_clear(&intel_plane->flip_helper); } + + /* + * Drop all non-ready flips. Doing this after calling + * drm_flip_helper_clear() maintaines the correct order + * of completion events. + */ + list_for_each_entry_safe(intel_flip, next, &flips, base.list) { + struct intel_ring_buffer *ring = intel_flip->ring; + + if (ring) { + intel_flip->ring = NULL; + ring->irq_put(ring); + } + + intel_flip_complete(&intel_flip->base); + /* + * FIXME drm_flip_helper calls the following functions + * from a workqueue. Perhaps we should do the same here? + */ + intel_flip_finish(&intel_flip->base); + intel_flip_cleanup(&intel_flip->base); + } }