diff mbox

[v2,6/6] drm/rockchip: Enable vblank without event

Message ID 1471396276-8222-7-git-send-email-seanpaul@chromium.org (mailing list archive)
State New, archived
Headers show

Commit Message

Sean Paul Aug. 17, 2016, 1:11 a.m. UTC
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>
---

Changes in v2:
	- Rebased on https://cgit.freedesktop.org/~seanpaul/dogwood/log/?h=for-next

 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

Comments

Yakir Yang Aug. 17, 2016, 3:27 a.m. UTC | #1
Sean,

On 08/17/2016 09:11 AM, Sean Paul wrote:
> vblank should be enabled regardless of whether an event
> is expected back. This is especially important for a cursor
> plane.
Yep, I also found that sometimes vblank haven't been enabled when I move 
the mouse lightly, that would cause eDP panel wound't exit from PSR 
active state, and then nothing would be updated on panel. After apply 
this patch, things work rightly now, thanks for fixing.

Reviewed-by: Yakir Yang <ykk@rock-chips.com>
Tested-by: Yakir Yang <ykk@rock-chip.com>
> Signed-off-by: Sean Paul <seanpaul@chromium.org>
> ---
>
> Changes in v2:
> 	- Rebased on https://cgit.freedesktop.org/~seanpaul/dogwood/log/?h=for-next
>
>   drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 15 ++++++++++-----
>   1 file changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> index d1e0e06..1787084 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> @@ -112,6 +112,7 @@ struct vop {
>   	struct device *dev;
>   	struct drm_device *drm_dev;
>   	bool is_enabled;
> +	bool vblank_active;
>   
>   	/* mutex vsync_ work */
>   	struct mutex vsync_mutex;
> @@ -1107,10 +1108,11 @@ static void vop_crtc_atomic_begin(struct drm_crtc *crtc,
>   	struct vop *vop = to_vop(crtc);
>   
>   	spin_lock_irq(&crtc->dev->event_lock);
> -	if (crtc->state->event) {
> -		WARN_ON(drm_crtc_vblank_get(crtc) != 0);
> -		WARN_ON(vop->event);
> +	vop->vblank_active = true;
> +	WARN_ON(drm_crtc_vblank_get(crtc) != 0);
> +	WARN_ON(vop->event);
>   
> +	if (crtc->state->event) {
>   		vop->event = crtc->state->event;
>   		crtc->state->event = NULL;
>   	}
> @@ -1197,12 +1199,14 @@ static void vop_handle_vblank(struct vop *vop)
>   
>   	spin_lock_irqsave(&drm->event_lock, flags);
>   	if (vop->event) {
> -
>   		drm_crtc_send_vblank_event(crtc, vop->event);
> -		drm_crtc_vblank_put(crtc);
>   		vop->event = NULL;
>   
>   	}
> +	if (vop->vblank_active) {
> +		vop->vblank_active = false;
> +		drm_crtc_vblank_put(crtc);
> +	}
>   	spin_unlock_irqrestore(&drm->event_lock, flags);
>   
>   	if (!completion_done(&vop->wait_update_complete))
> @@ -1472,6 +1476,7 @@ static int vop_initial(struct vop *vop)
>   	clk_disable(vop->aclk);
>   
>   	vop->is_enabled = false;
> +	vop->vblank_active = false;
>   
>   	return 0;
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index d1e0e06..1787084 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -112,6 +112,7 @@  struct vop {
 	struct device *dev;
 	struct drm_device *drm_dev;
 	bool is_enabled;
+	bool vblank_active;
 
 	/* mutex vsync_ work */
 	struct mutex vsync_mutex;
@@ -1107,10 +1108,11 @@  static void vop_crtc_atomic_begin(struct drm_crtc *crtc,
 	struct vop *vop = to_vop(crtc);
 
 	spin_lock_irq(&crtc->dev->event_lock);
-	if (crtc->state->event) {
-		WARN_ON(drm_crtc_vblank_get(crtc) != 0);
-		WARN_ON(vop->event);
+	vop->vblank_active = true;
+	WARN_ON(drm_crtc_vblank_get(crtc) != 0);
+	WARN_ON(vop->event);
 
+	if (crtc->state->event) {
 		vop->event = crtc->state->event;
 		crtc->state->event = NULL;
 	}
@@ -1197,12 +1199,14 @@  static void vop_handle_vblank(struct vop *vop)
 
 	spin_lock_irqsave(&drm->event_lock, flags);
 	if (vop->event) {
-
 		drm_crtc_send_vblank_event(crtc, vop->event);
-		drm_crtc_vblank_put(crtc);
 		vop->event = NULL;
 
 	}
+	if (vop->vblank_active) {
+		vop->vblank_active = false;
+		drm_crtc_vblank_put(crtc);
+	}
 	spin_unlock_irqrestore(&drm->event_lock, flags);
 
 	if (!completion_done(&vop->wait_update_complete))
@@ -1472,6 +1476,7 @@  static int vop_initial(struct vop *vop)
 	clk_disable(vop->aclk);
 
 	vop->is_enabled = false;
+	vop->vblank_active = false;
 
 	return 0;