public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel.vetter@ffwll.ch>
To: Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Subject: [PATCH 5/7] drm/i915: adjust has_pending_fb_unpin to atomic
Date: Thu, 20 Jul 2017 19:57:52 +0200	[thread overview]
Message-ID: <20170720175754.30751-6-daniel.vetter@ffwll.ch> (raw)
In-Reply-To: <20170720175754.30751-1-daniel.vetter@ffwll.ch>

A bit an oversight - the current code did nothing, since only
legacy flips used the unpin_work_count and assorted logic.

Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/i915/intel_display.c | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index fcbd4b7fa96c..bd0488a72503 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -4149,21 +4149,22 @@ static void ironlake_fdi_disable(struct drm_crtc *crtc)
 
 bool intel_has_pending_fb_unpin(struct drm_i915_private *dev_priv)
 {
-	struct intel_crtc *crtc;
-
-	/* Note that we don't need to be called with mode_config.lock here
-	 * as our list of CRTC objects is static for the lifetime of the
-	 * device and so cannot disappear as we iterate. Similarly, we can
-	 * happily treat the predicates as racy, atomic checks as userspace
-	 * cannot claim and pin a new fb without at least acquring the
-	 * struct_mutex and so serialising with us.
-	 */
-	for_each_intel_crtc(&dev_priv->drm, crtc) {
-		if (atomic_read(&crtc->unpin_work_count) == 0)
+	struct drm_crtc *crtc;
+	bool cleanup_done;
+
+	drm_for_each_crtc(crtc, &dev_priv->drm) {
+		struct drm_crtc_commit *commit;
+		spin_lock(&crtc->commit_lock);
+		commit = list_first_entry_or_null(&crtc->commit_list,
+						  struct drm_crtc_commit, commit_entry);
+		cleanup_done = commit ?
+			try_wait_for_completion(&commit->cleanup_done) : true;
+		spin_unlock(&crtc->commit_lock);
+
+		if (cleanup_done)
 			continue;
 
-		if (crtc->flip_work)
-			intel_wait_for_vblank(dev_priv, crtc->pipe);
+		drm_crtc_wait_one_vblank(crtc);
 
 		return true;
 	}
-- 
2.13.2

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

  parent reply	other threads:[~2017-07-20 17:58 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-20 17:57 [PATCH 0/7] gpu reset and page_flip removal, take 2 Daniel Vetter
2017-07-20 17:57 ` [PATCH 1/7] drm/i915: Avoid the gpu reset vs. modeset deadlock Daniel Vetter
2017-07-20 19:47   ` Chris Wilson
2017-07-20 20:04     ` Daniel Vetter
2017-07-20 20:16       ` Chris Wilson
2017-07-20 20:18         ` Daniel Vetter
2017-07-20 17:57 ` [PATCH 2/7] drm/i915: Push i915_sw_fence_wait into the nonblocking atomic commit Daniel Vetter
2017-08-03 19:44   ` Michel Thierry
2017-08-07 15:33     ` Daniel Vetter
2017-08-07 17:06       ` Michel Thierry
2017-07-20 17:57 ` [PATCH 3/7] drm/i915: More surgically unbreak the modeset vs reset deadlock Daniel Vetter
2017-08-03 19:35   ` Michel Thierry
2017-08-07 15:39     ` Daniel Vetter
2017-07-20 17:57 ` [PATCH 4/7] drm/i915: Rip out legacy page_flip completion/irq handling Daniel Vetter
2017-07-20 17:57 ` Daniel Vetter [this message]
2017-07-20 17:57 ` [PATCH 6/7] drm/i915: Remove intel_flip_work infrastructure Daniel Vetter
2017-07-20 17:57 ` [PATCH 7/7] drm/i915: Drop unpin stall in atomic_prepare_commit Daniel Vetter
2017-07-20 20:47   ` Daniel Vetter
2017-07-20 18:14 ` ✓ Fi.CI.BAT: success for gpu reset and page_flip removal, take 2 Patchwork
2017-07-20 19:45   ` Chris Wilson
  -- strict thread matches above, loose matches on Subject: below --
2017-07-20 11:43 [PATCH 1/7] drm/i915: Avoid the gpu reset vs. modeset deadlock Daniel Vetter
2017-07-20 11:43 ` [PATCH 5/7] drm/i915: adjust has_pending_fb_unpin to atomic Daniel Vetter

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=20170720175754.30751-6-daniel.vetter@ffwll.ch \
    --to=daniel.vetter@ffwll.ch \
    --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