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 3/6] drm/atomic: Clean up wait_for_vblanks
Date: Thu,  8 Dec 2016 14:45:26 +0100	[thread overview]
Message-ID: <1481204729-9058-4-git-send-email-maarten.lankhorst@linux.intel.com> (raw)
In-Reply-To: <1481204729-9058-1-git-send-email-maarten.lankhorst@linux.intel.com>

Stop relying on a per crtc_state last_vblank_count, we know in advance
how many there can be. Also stop re-using new_crtc_state->enable,
we can now simply set a bitmask with crtc_crtc_mask.
---
 drivers/gpu/drm/drm_atomic_helper.c | 29 +++++++++++++++--------------
 include/drm/drm_crtc.h              |  5 -----
 2 files changed, 15 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index d19563651e07..ccf0bed9bf4a 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -1110,19 +1110,20 @@ drm_atomic_helper_wait_for_vblanks(struct drm_device *dev,
 	struct drm_crtc *crtc;
 	struct drm_crtc_state *old_crtc_state;
 	int i, ret;
+	unsigned crtc_mask = 0;
+	unsigned last_vblank_count[dev->mode_config.num_crtc];
+
+	 /*
+	  * Legacy cursor ioctls are completely unsynced, and userspace
+	  * relies on that (by doing tons of cursor updates).
+	  */
+	if (old_state->legacy_cursor_update)
+		return;
 
 	for_each_crtc_in_state(old_state, crtc, old_crtc_state, i) {
-		/* No one cares about the old state, so abuse it for tracking
-		 * and store whether we hold a vblank reference (and should do a
-		 * vblank wait) in the ->enable boolean. */
-		old_crtc_state->enable = false;
-
-		if (!crtc->state->active)
-			continue;
+		struct drm_crtc_state *new_crtc_state = crtc->state;
 
-		/* Legacy cursor ioctls are completely unsynced, and userspace
-		 * relies on that (by doing tons of cursor updates). */
-		if (old_state->legacy_cursor_update)
+		if (!new_crtc_state->active)
 			continue;
 
 		if (!drm_atomic_helper_framebuffer_changed(dev,
@@ -1133,16 +1134,16 @@ drm_atomic_helper_wait_for_vblanks(struct drm_device *dev,
 		if (ret != 0)
 			continue;
 
-		old_crtc_state->enable = true;
-		old_crtc_state->last_vblank_count = drm_crtc_vblank_count(crtc);
+		crtc_mask |= drm_crtc_mask(crtc);
+		last_vblank_count[i] = drm_crtc_vblank_count(crtc);
 	}
 
 	for_each_crtc_in_state(old_state, crtc, old_crtc_state, i) {
-		if (!old_crtc_state->enable)
+		if (!(crtc_mask & drm_crtc_mask(crtc)))
 			continue;
 
 		ret = wait_event_timeout(dev->vblank[i].queue,
-				old_crtc_state->last_vblank_count !=
+				last_vblank_count[i] !=
 					drm_crtc_vblank_count(crtc),
 				msecs_to_jiffies(50));
 
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 946672f97e1e..e03d194be086 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -93,8 +93,6 @@ struct drm_plane_helper_funcs;
  * @plane_mask: bitmask of (1 << drm_plane_index(plane)) of attached planes
  * @connector_mask: bitmask of (1 << drm_connector_index(connector)) of attached connectors
  * @encoder_mask: bitmask of (1 << drm_encoder_index(encoder)) of attached encoders
- * @last_vblank_count: for helpers and drivers to capture the vblank of the
- * 	update to ensure framebuffer cleanup isn't done too early
  * @adjusted_mode: for use by helpers and drivers to compute adjusted mode timings
  * @mode: current mode timings
  * @mode_blob: &drm_property_blob for @mode
@@ -140,9 +138,6 @@ struct drm_crtc_state {
 	u32 connector_mask;
 	u32 encoder_mask;
 
-	/* last_vblank_count: for vblank waits before cleanup */
-	u32 last_vblank_count;
-
 	/* adjusted_mode: for use by helpers and drivers */
 	struct drm_display_mode adjusted_mode;
 
-- 
2.7.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2016-12-08 13:45 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-08 13:45 [PATCH 0/6] drm/atomic: Remove drm_atomic_helper_framebuffer_changed Maarten Lankhorst
2016-12-08 13:45 ` [PATCH 1/6] drm/atomic: Use active instead of enable in wait_for_vblanks Maarten Lankhorst
2016-12-08 15:36   ` Daniel Vetter
2016-12-08 13:45 ` [PATCH 2/6] drm/atomic: Unconditionally call prepare_fb Maarten Lankhorst
2016-12-08 15:41   ` Daniel Vetter
2016-12-08 22:42     ` [Intel-gfx] " Laurent Pinchart
2016-12-09  8:25       ` Daniel Vetter
2016-12-13 14:13         ` Maarten Lankhorst
2016-12-13 17:10           ` Daniel Vetter
2016-12-19 11:08             ` [PATCH v2 " Maarten Lankhorst
2016-12-19 12:07               ` Laurent Pinchart
2016-12-14  0:12           ` [Intel-gfx] [PATCH " Laurent Pinchart
2016-12-08 13:45 ` Maarten Lankhorst [this message]
2016-12-08 15:38   ` [PATCH 3/6] drm/atomic: Clean up wait_for_vblanks Daniel Vetter
2016-12-15 11:51     ` [PATCH v2 3/6] drm/atomic: Clean up wait_for_vblanks, v2 Maarten Lankhorst
2016-12-15 15:55       ` Daniel Vetter
2016-12-15 16:14         ` Maarten Lankhorst
2016-12-08 13:45 ` [PATCH 4/6] drm/atomic: Wait for vblank whenever a plane is added to state Maarten Lankhorst
2016-12-08 15:43   ` Daniel Vetter
2016-12-12 10:27     ` Maarten Lankhorst
2016-12-08 13:45 ` [PATCH 5/6] drm/atomic: Remove drm_atomic_helper_framebuffer_changed Maarten Lankhorst
2016-12-08 13:45 ` [PATCH 6/6] drm/i915: Add a cursor hack to allow converting legacy page flip to atomic Maarten Lankhorst
2016-12-08 14:07   ` Matthew Auld
2016-12-12 10:34     ` [PATCH v2 6/6] drm/i915: Add a cursor hack to allow converting legacy page flip to atomic, v3 Maarten Lankhorst
2016-12-13 13:01       ` Archit Taneja
2016-12-13 13:52         ` Maarten Lankhorst
2016-12-14  3:19           ` Archit Taneja
2016-12-20  9:26       ` Daniel Vetter
2016-12-08 15:52 ` ✓ Fi.CI.BAT: success for drm/atomic: Remove drm_atomic_helper_framebuffer_changed 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=1481204729-9058-4-git-send-email-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.