All of lore.kernel.org
 help / color / mirror / Atom feed
From: ville.syrjala@linux.intel.com
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 3/3] drm/i915: Update primary planes after a GPU reset
Date: Fri, 15 Feb 2013 17:07:46 +0200	[thread overview]
Message-ID: <1360940866-22435-4-git-send-email-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <1360940866-22435-1-git-send-email-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

GPU reset will drop all flips that are still in the ring. So after the
reset, call update_plane() for all CRTCs to make sure the primary
planes are scanning out from the correct buffer.

The base address update will also generate a FLIP_DONE interrupt, which
will complete any pending flips. That means user space will get its
page flip events and won't get stuck waiting for them.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_irq.c      |  2 ++
 drivers/gpu/drm/i915/intel_display.c | 26 ++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_drv.h     |  2 ++
 3 files changed, 30 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 672816a..873552d 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -917,6 +917,8 @@ static void i915_error_work_func(struct work_struct *work)
 
 		wake_up_all(&dev_priv->pending_flip_queue);
 
+		intel_display_handle_reset(dev);
+
 		wake_up_all(&dev_priv->gpu_error.reset_queue);
 	}
 }
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index f0c6416..9838da1 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2218,6 +2218,32 @@ intel_pipe_set_base_atomic(struct drm_crtc *crtc, struct drm_framebuffer *fb,
 	return dev_priv->display.update_plane(crtc, fb, x, y);
 }
 
+void intel_display_handle_reset(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_crtc *crtc;
+
+	/*
+	 * Flips in the rings have been nuked by the reset,
+	 * so just update the base address of all primary
+	 * planes to the the last fb to make sure we're
+	 * showing the correct fb after a reset.
+	 *
+	 * As a nice side effect this also generates a FLIP_DONE
+	 * interrupt which will complete pending page flips, and
+	 * thus user space will get its events and not get stuck.
+	 */
+
+	list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
+		mutex_lock(&crtc->mutex);
+
+		if (to_intel_crtc(crtc)->active)
+			dev_priv->display.update_plane(crtc, crtc->fb, crtc->x, crtc->y);
+
+		mutex_unlock(&crtc->mutex);
+	}
+}
+
 static int
 intel_finish_fb(struct drm_framebuffer *old_fb)
 {
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index d282052..0dc14c2 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -694,4 +694,6 @@ extern bool
 intel_ddi_connector_get_hw_state(struct intel_connector *intel_connector);
 extern void intel_ddi_fdi_disable(struct drm_crtc *crtc);
 
+extern void intel_display_handle_reset(struct drm_device *dev);
+
 #endif /* __INTEL_DRV_H__ */
-- 
1.7.12.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2013-02-15 15:08 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-15 15:07 [PATCH 0/3] drm/i915: More page flip vs. reset improvements ville.syrjala
2013-02-15 15:07 ` [PATCH v2 1/3] drm/i915: Wake up pending_flip_queue as part of reset handling ville.syrjala
2013-02-15 23:53   ` Chris Wilson
2013-02-18  9:58     ` Ville Syrjälä
2013-02-18 12:41       ` Ville Syrjälä
2013-02-18 15:31         ` Ville Syrjälä
2013-02-18 16:39           ` Daniel Vetter
2013-02-15 15:07 ` [PATCH v2 2/3] drm/i915: Really wait for pending flips when panning ville.syrjala
2013-02-15 15:07 ` ville.syrjala [this message]
2013-02-15 15:28   ` [PATCH 3/3] drm/i915: Update primary planes after a GPU reset Chris Wilson
2013-02-15 16:56     ` Ville Syrjälä
2013-02-15 23:47       ` Chris Wilson
2013-02-18 10:15         ` Ville Syrjälä
2013-02-18 10:47           ` Chris Wilson
2013-02-18 11:50             ` Ville Syrjälä
2013-02-18 12:08               ` Chris Wilson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1360940866-22435-4-git-send-email-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.