All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Paul <seanpaul@chromium.org>
To: mark.yao@rock-chips.com, dri-devel@lists.freedesktop.org,
	ykk@rock-chips.com
Cc: marcheu@chromium.org, dianders@chromium.org,
	linux-rockchip@lists.infradead.org
Subject: [PATCH 5/6] drm/rockchip: Enable vblank without event
Date: Wed, 10 Aug 2016 17:24:18 -0400	[thread overview]
Message-ID: <1470864258-22680-6-git-send-email-seanpaul@chromium.org> (raw)
In-Reply-To: <1470864258-22680-1-git-send-email-seanpaul@chromium.org>

vblank should be enabled regardless of whether an event
is expected back. This is especially important for a cursor
plane.

Signed-off-by: Sean Paul <seanpaul@chromium.org>
---
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index 86d60ff..c0fbe0a 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -111,6 +111,7 @@ struct vop {
 	struct device *dev;
 	struct drm_device *drm_dev;
 	bool is_enabled;
+	bool vblank_active;
 
 	/* mutex vsync_ work */
 	struct mutex vsync_mutex;
@@ -961,6 +962,7 @@ static void vop_crtc_cancel_pending_vblank(struct drm_crtc *crtc,
 	unsigned long flags;
 
 	spin_lock_irqsave(&drm->event_lock, flags);
+
 	e = vop->event;
 	if (e && e->base.file_priv == file_priv) {
 		vop->event = NULL;
@@ -1108,9 +1110,10 @@ static void vop_crtc_atomic_begin(struct drm_crtc *crtc,
 {
 	struct vop *vop = to_vop(crtc);
 
-	if (crtc->state->event) {
-		WARN_ON(drm_crtc_vblank_get(crtc) != 0);
+	WARN_ON(drm_crtc_vblank_get(crtc) != 0);
+	vop->vblank_active = true;
 
+	if (crtc->state->event) {
 		vop->event = crtc->state->event;
 		crtc->state->event = NULL;
 	}
@@ -1200,11 +1203,16 @@ static void vop_handle_vblank(struct vop *vop)
 		spin_lock_irqsave(&drm->event_lock, flags);
 
 		drm_crtc_send_vblank_event(crtc, vop->event);
-		drm_crtc_vblank_put(crtc);
 		vop->event = NULL;
 
 		spin_unlock_irqrestore(&drm->event_lock, flags);
 	}
+
+	if (vop->vblank_active) {
+		vop->vblank_active = false;
+		drm_crtc_vblank_put(crtc);
+	}
+
 	if (!completion_done(&vop->wait_update_complete))
 		complete(&vop->wait_update_complete);
 }
@@ -1485,6 +1493,7 @@ static int vop_initial(struct vop *vop)
 	clk_disable(vop->aclk);
 
 	vop->is_enabled = false;
+	vop->vblank_active = false;
 
 	return 0;
 
-- 
2.8.0.rc3.226.g39d4020

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

      parent reply	other threads:[~2016-08-10 21:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-10 21:24 [PATCH 0/5] drm/rockchip: Some patches to up the PSR series Sean Paul
2016-08-10 21:24 ` [PATCH 1/6] drm/rockchip: Change psr list mutex to spinlock Sean Paul
2016-08-10 21:24 ` [PATCH 2/6] drm/rockchip: Change state_mutex " Sean Paul
2016-08-10 21:24 ` [PATCH 3/6] drm/rockchip: Remove delayed work to enable/disable psr Sean Paul
2016-08-10 21:24 ` [PATCH 4/6] drm/rockchip: Improve analogix-dp psr handling Sean Paul
2016-08-10 21:24 ` Sean Paul [this message]

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=1470864258-22680-6-git-send-email-seanpaul@chromium.org \
    --to=seanpaul@chromium.org \
    --cc=dianders@chromium.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=marcheu@chromium.org \
    --cc=mark.yao@rock-chips.com \
    --cc=ykk@rock-chips.com \
    /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.