From patchwork Wed Dec 12 16:16:32 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: 1869381 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 37FDA3FCD5 for ; Wed, 12 Dec 2012 17:58:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3FEBCE6627 for ; Wed, 12 Dec 2012 09:58:34 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga14.intel.com (mga14.intel.com [143.182.124.37]) by gabe.freedesktop.org (Postfix) with ESMTP id 4C331E5FAC; Wed, 12 Dec 2012 08:20:45 -0800 (PST) Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga102.ch.intel.com with ESMTP; 12 Dec 2012 08:20:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.84,267,1355126400"; d="scan'208";a="230560872" Received: from stinkbox.fi.intel.com (HELO stinkbox) ([10.237.72.168]) by azsmga001.ch.intel.com with SMTP; 12 Dec 2012 08:20:42 -0800 Received: by stinkbox (sSMTP sendmail emulation); Wed, 12 Dec 2012 18:20:41 +0200 From: ville.syrjala@linux.intel.com To: dri-devel@lists.freedesktop.org Date: Wed, 12 Dec 2012 18:16:32 +0200 Message-Id: <1355329008-31459-66-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 Subject: [Intel-gfx] [PATCH 65/81] drm/i915: Release all atomic flips when GPU hangs 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ä If the GPU hangs, release all pending atomic flips from the queue. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/i915_irq.c | 1 + drivers/gpu/drm/i915/intel_atomic.c | 29 +++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 1 + 3 files changed, 31 insertions(+), 0 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index 2f0dce2..47d6067 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c @@ -1486,6 +1486,7 @@ void i915_handle_error(struct drm_device *dev, bool wedged) */ for_each_ring(ring, dev_priv, i) wake_up_all(&ring->irq_queue); + intel_atomic_wedged(dev); } queue_work(dev_priv->wq, &dev_priv->error_work); diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c index 2ebceec..f59be7f 100644 --- a/drivers/gpu/drm/i915/intel_atomic.c +++ b/drivers/gpu/drm/i915/intel_atomic.c @@ -2232,6 +2232,30 @@ void intel_atomic_notify_ring(struct drm_device *dev, spin_unlock_irqrestore(&dev_priv->flip.lock, flags); } +void intel_atomic_wedged(struct drm_device *dev) +{ + struct drm_i915_private *dev_priv = dev->dev_private; + struct intel_flip *intel_flip; + unsigned long flags; + + spin_lock_irqsave(&dev_priv->flip.lock, flags); + + list_for_each_entry(intel_flip, &dev_priv->flip.list, base.list) { + struct intel_ring_buffer *ring = intel_flip->ring; + + if (ring) { + intel_flip->ring = NULL; + ring->irq_put(ring); + } + } + + /* all flips are "ready" so no need to check with intel_atomic_flips_ready() */ + if (!list_empty(&dev_priv->flip.list)) + queue_work(dev_priv->flip.wq, &dev_priv->flip.work); + + spin_unlock_irqrestore(&dev_priv->flip.lock, flags); +} + static void atomic_pipe_commit(struct drm_device *dev, struct intel_atomic_state *state, int pipe) @@ -2409,6 +2433,11 @@ static void atomic_pipe_commit(struct drm_device *dev, if (rings_mask == 0) return; + if (atomic_read(&dev_priv->mm.wedged)) { + intel_atomic_wedged(dev); + return; + } + /* * Double check to catch cases where the irq * fired before the flip was placed onto flip.list. diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 446fa1c..33fac47 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -731,6 +731,7 @@ extern void intel_atomic_free_events(struct drm_device *dev, struct drm_file *fi extern void intel_atomic_handle_vblank(struct drm_device *dev, int pipe); extern void intel_atomic_clear_flips(struct drm_crtc *crtc); extern void intel_atomic_notify_ring(struct drm_device *dev, struct intel_ring_buffer *ring); +extern void intel_atomic_wedged(struct drm_device *dev); extern void intel_enable_primary(struct drm_crtc *crtc); extern void intel_disable_primary(struct drm_crtc *crtc);