All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: dri-devel@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org
Subject: [PATCH 2/2] drm/atomic: Check for busy planes/connectors before setting the commit
Date: Mon, 16 Oct 2017 15:29:28 +0200	[thread overview]
Message-ID: <20171016132928.6498-2-maarten.lankhorst@linux.intel.com> (raw)
In-Reply-To: <20171016132928.6498-1-maarten.lankhorst@linux.intel.com>

We still want to fail with -EBUSY if a plane or connector is part of
a commit, even if it will be assigned to a new commit.

This closes a small hole left open where we should return -EBUSY.
It's not severe, because wait_for_dependencies and swap_state helpers
still block. But it should return -EBUSY and not stall.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Fixes: 21a01abbe32a ("drm/atomic: Fix freeing connector/plane state too early by tracking commits, v3.")
---
 drivers/gpu/drm/drm_atomic_helper.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index b64c8f5bc940..c2a7887deb25 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -1775,16 +1775,16 @@ int drm_atomic_helper_setup_commit(struct drm_atomic_state *state,
 	}
 
 	for_each_oldnew_connector_in_state(state, conn, old_conn_state, new_conn_state, i) {
-		/* commit tracked through new_crtc_state->commit, no need to do it explicitly */
-		if (new_conn_state->crtc)
-			continue;
-
 		/* Userspace is not allowed to get ahead of the previous
 		 * commit with nonblocking ones. */
 		if (nonblock && old_conn_state->commit &&
 		    !try_wait_for_completion(&old_conn_state->commit->flip_done))
 			return -EBUSY;
 
+		/* commit tracked through new_crtc_state->commit, no need to do it explicitly */
+		if (new_conn_state->crtc)
+			continue;
+
 		commit = crtc_or_fake_commit(state, old_conn_state->crtc);
 		if (!commit)
 			return -ENOMEM;
@@ -1793,17 +1793,16 @@ int drm_atomic_helper_setup_commit(struct drm_atomic_state *state,
 	}
 
 	for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) {
-		/*
-		 * Unlike connectors, always track planes explicitly for
-		 * async pageflip support.
-		 */
-
 		/* Userspace is not allowed to get ahead of the previous
 		 * commit with nonblocking ones. */
 		if (nonblock && old_plane_state->commit &&
 		    !try_wait_for_completion(&old_plane_state->commit->flip_done))
 			return -EBUSY;
 
+		/*
+		 * Unlike connectors, always track planes explicitly for
+		 * async pageflip support.
+		 */
 		commit = crtc_or_fake_commit(state, old_plane_state->crtc ?: new_plane_state->crtc);
 		if (!commit)
 			return -ENOMEM;
-- 
2.14.1

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

  reply	other threads:[~2017-10-16 13:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-16 13:29 [PATCH 1/2] drm/atomic: Make atomic helper track newly assigned planes correctly Maarten Lankhorst
2017-10-16 13:29 ` Maarten Lankhorst [this message]
2017-10-16 13:51   ` [PATCH 2/2] drm/atomic: Check for busy planes/connectors before setting the commit Ville Syrjälä
2017-10-16 13:42 ` [PATCH 1/2] drm/atomic: Make atomic helper track newly assigned planes correctly Ville Syrjälä
2017-10-16 13:59   ` Maarten Lankhorst
2017-10-16 14:48     ` Ville Syrjälä
2017-10-16 15:28       ` Maarten Lankhorst
2017-10-16 15:37         ` Ville Syrjälä
2017-10-17  5:20           ` [PATCH] drm/atomic: Make atomic helper track newly assigned planes correctly, v2 Maarten Lankhorst
2017-10-17 12:11             ` Daniel Vetter
2017-10-17 12:35               ` Maarten Lankhorst
2017-10-16 14:43 ` ✓ Fi.CI.BAT: success for series starting with [1/2] drm/atomic: Make atomic helper track newly assigned planes correctly Patchwork
2017-10-17  1:11 ` ✗ Fi.CI.IGT: warning " Patchwork
2017-10-17  5:42 ` ✓ Fi.CI.BAT: success for series starting with drm/atomic: Make atomic helper track newly assigned planes correctly, v2. (rev2) Patchwork
2017-10-17 18:11 ` ✓ Fi.CI.IGT: " 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=20171016132928.6498-2-maarten.lankhorst@linux.intel.com \
    --to=maarten.lankhorst@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --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.