[PATCH 09/12] drm/cirrus: send vblank on crtc atomic_flush

Varad Gautam varadgautam at gmail.com
Fri Sep 8 13:35:14 UTC 2017


From: Varad Gautam <varad.gautam at collabora.com>

the hardware does not provide interrupts on vblank, so we just send a fake
vblank event on atomic_flush.

Signed-off-by: Varad Gautam <varad.gautam at collabora.com>
---
 drivers/gpu/drm/cirrus/cirrus_mode.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/gpu/drm/cirrus/cirrus_mode.c b/drivers/gpu/drm/cirrus/cirrus_mode.c
index ee023c865165..4c95447ac445 100644
--- a/drivers/gpu/drm/cirrus/cirrus_mode.c
+++ b/drivers/gpu/drm/cirrus/cirrus_mode.c
@@ -217,6 +217,23 @@ static void cirrus_crtc_destroy(struct drm_crtc *crtc)
 	kfree(cirrus_crtc);
 }
 
+static void cirrus_crtc_atomic_flush(struct drm_crtc *crtc,
+				     struct drm_crtc_state *old_crtc_state)
+{
+	struct drm_device *dev = crtc->dev;
+	struct drm_pending_vblank_event *event;
+	unsigned long flags;
+
+	if (crtc->state && crtc->state->event) {
+		event = crtc->state->event;
+		crtc->state->event = NULL;
+
+		spin_lock_irqsave(&dev->event_lock, flags);
+		drm_crtc_send_vblank_event(crtc, event);
+		spin_unlock_irqrestore(&dev->event_lock, flags);
+	}
+}
+
 /* These provide the minimum set of functions required to handle a CRTC */
 static const struct drm_crtc_funcs cirrus_crtc_funcs = {
 	.gamma_set = cirrus_crtc_gamma_set,
@@ -234,6 +251,7 @@ static const struct drm_crtc_helper_funcs cirrus_helper_funcs = {
 	.mode_set_nofb = cirrus_mode_set_nofb,
 	.prepare = cirrus_crtc_prepare,
 	.commit = cirrus_crtc_commit,
+	.atomic_flush = cirrus_crtc_atomic_flush,
 };
 
 static int cirrus_plane_update(struct drm_plane *plane,
-- 
2.13.1



More information about the dri-devel mailing list