public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH] drm/i915: Wait for flips to complete before returning.
Date: Mon, 23 May 2016 15:37:40 +0200	[thread overview]
Message-ID: <1464010661-32674-2-git-send-email-maarten.lankhorst@linux.intel.com> (raw)
In-Reply-To: <1464010661-32674-1-git-send-email-maarten.lankhorst@linux.intel.com>

Doing a page flip right after setcrtc would fail because part of the update is run
asynchronously. This is a regression and is caused kms_flip to fails without
the atomic page flip patch, and kms_frontbuffer_tracking to fail on ro-bdw-i7-5600u.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index a500f08ec0ac..21c0a2f3102b 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3788,7 +3788,7 @@ static void page_flip_completed(struct intel_crtc *intel_crtc, struct intel_flip
 	queue_work(dev_priv->wq, &work->unpin_work);
 }
 
-static int intel_crtc_wait_for_pending_flips(struct drm_crtc *crtc)
+static int intel_crtc_wait_for_pending_flips(struct drm_crtc *crtc, bool intr)
 {
 	struct drm_device *dev = crtc->dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
@@ -3796,10 +3796,15 @@ static int intel_crtc_wait_for_pending_flips(struct drm_crtc *crtc)
 
 	WARN_ON(waitqueue_active(&dev_priv->pending_flip_queue));
 
-	ret = wait_event_interruptible_timeout(
-					dev_priv->pending_flip_queue,
-					!intel_crtc_has_pending_flip(crtc),
-					60*HZ);
+	if (intr)
+		ret = wait_event_interruptible_timeout(
+						dev_priv->pending_flip_queue,
+						!intel_crtc_has_pending_flip(crtc),
+						60*HZ);
+	else
+		ret = wait_event_timeout(dev_priv->pending_flip_queue,
+					 !intel_crtc_has_pending_flip(crtc),
+					 60*HZ);
 
 	if (ret < 0)
 		return ret;
@@ -12736,7 +12741,7 @@ static int intel_atomic_prepare_commit(struct drm_device *dev,
 		struct intel_flip_work *work;
 
 		if (!state->legacy_cursor_update) {
-			ret = intel_crtc_wait_for_pending_flips(crtc);
+			ret = intel_crtc_wait_for_pending_flips(crtc, true);
 			if (ret)
 				return ret;
 
@@ -13005,6 +13010,7 @@ static int intel_atomic_commit(struct drm_device *dev,
 	struct drm_crtc_state *old_crtc_state;
 	struct drm_crtc *crtc;
 	int ret = 0, i;
+	unsigned crtc_mask = 0;
 
 	ret = intel_atomic_prepare_commit(dev, state, nonblock);
 	if (ret) {
@@ -13075,6 +13081,8 @@ static int intel_atomic_commit(struct drm_device *dev,
 		struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
 		bool modeset = needs_modeset(crtc->state);
 
+		crtc_mask |= drm_crtc_mask(crtc);
+
 		if (modeset && crtc->state->active) {
 			update_scanline_offset(to_intel_crtc(crtc));
 			dev_priv->display.crtc_enable(crtc);
@@ -13105,6 +13113,12 @@ static int intel_atomic_commit(struct drm_device *dev,
 		intel_schedule_update(crtc, intel_state, work, nonblock);
 	}
 
+	if (!nonblock && !state->legacy_cursor_update) {
+		drm_for_each_crtc(crtc, dev)
+			if (crtc_mask & drm_crtc_mask(crtc))
+				intel_crtc_wait_for_pending_flips(crtc, false);
+	}
+
 	/* FIXME: add subpixel order */
 
 	drm_atomic_state_free(state);
-- 
2.5.5

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

  reply	other threads:[~2016-05-23 13:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-23 13:37 [PATCH 0/2] drm/i915: Fix warnings from atomic nonblocking unpin Maarten Lankhorst
2016-05-23 13:37 ` Maarten Lankhorst [this message]
2016-05-23 13:37 ` [PATCH 2/2] drm/i915: Bump pin_count to UINT_MAX Maarten Lankhorst
2016-05-23 14:25   ` Chris Wilson
2016-05-23 15:09     ` Maarten Lankhorst
2016-05-23 15:43       ` Chris Wilson
2016-05-23 16:09         ` Maarten Lankhorst
2016-05-23 21:30           ` Chris Wilson
2016-05-24  8:22   ` Daniel Vetter
2016-05-23 13:43 ` [PATCH 1/2] drm/i915: Wait for flips to complete before returning Maarten Lankhorst
2016-05-23 14:08 ` [PATCH 3/2] Revert "drm/i915: Allow nonblocking update of pageflips." Maarten Lankhorst
2016-05-23 14:53 ` ✗ Ro.CI.BAT: warning for drm/i915: Wait for flips to complete before returning Patchwork
2016-05-23 15:16 ` ✗ Ro.CI.BAT: failure " Patchwork

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=1464010661-32674-2-git-send-email-maarten.lankhorst@linux.intel.com \
    --to=maarten.lankhorst@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox