From patchwork Fri Nov 16 14:22:19 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: 1755281 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id 6D440DF230 for ; Fri, 16 Nov 2012 14:28:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 56BB34371E for ; Fri, 16 Nov 2012 06:28:42 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [143.182.124.21]) by gabe.freedesktop.org (Postfix) with ESMTP id 4178D436A3; Fri, 16 Nov 2012 06:22:58 -0800 (PST) Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga101.ch.intel.com with ESMTP; 16 Nov 2012 06:22:57 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.83,265,1352102400"; d="scan'208";a="218726909" Received: from stinkbox.fi.intel.com (HELO stinkbox) ([10.237.72.168]) by azsmga001.ch.intel.com with SMTP; 16 Nov 2012 06:22:55 -0800 Received: by stinkbox (sSMTP sendmail emulation); Fri, 16 Nov 2012 16:22:54 +0200 From: ville.syrjala@linux.intel.com To: dri-devel@lists.freedesktop.org Date: Fri, 16 Nov 2012 16:22:19 +0200 Message-Id: <1353075745-30115-8-git-send-email-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 1.7.8.6 In-Reply-To: <1353075745-30115-1-git-send-email-ville.syrjala@linux.intel.com> References: <1353075745-30115-1-git-send-email-ville.syrjala@linux.intel.com> MIME-Version: 1.0 Cc: intel-gfx@lists.freedesktop.org Subject: [Intel-gfx] [PATCH 07/13] drm/i915: Drop all flips waiting for the GPU when the CRTC is about to be disabled 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ä 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 0aa8c93..6bec72b 100644 --- a/drivers/gpu/drm/i915/intel_atomic.c +++ b/drivers/gpu/drm/i915/intel_atomic.c @@ -2489,9 +2489,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); @@ -2499,4 +2513,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); + } }