From 911316fe2f4113a096b9975f2467fc501864aef0 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Thu, 14 May 2015 15:01:47 +0300 Subject: [PATCH] drm: rcar-du: Disable all planes when stopping the CRTC The DSnPR plane configuration registers are updated on vblank, and no vblank will occur once the CRTC is stopped. We thus can't only disable planes right before starting the CRTC as it would start scanning out immediately from old frame buffers until the next vblank. Fix the problem by disabling all planes when stopping the CRTC and wait for the change to take effect. This increases the CRTC stop delay, especially when multiple CRTCs are stopped in one operation as we now wait for one vblank per CRTC. Whether this can be improved needs to be researched. Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c index e6a32c4e4040..a40085806f5b 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c @@ -398,6 +398,19 @@ static void rcar_du_crtc_stop(struct rcar_du_crtc *rcrtc) if (!rcrtc->started) return; + /* Disable all planes and wait for the change to take effect. This is + * required as the DSnPR registers are updated on vblank, and no vblank + * will occur once the CRTC is stopped. Disabling planes when starting + * the CRTC thus wouldn't be enough as it would start scanning out + * immediately from old frame buffers until the next vblank. + * + * This increases the CRTC stop delay, especially when multiple CRTCs + * are stopped in one operation as we now wait for one vblank per CRTC. + * Whether this can be improved needs to be researched. + */ + rcar_du_group_write(rcrtc->group, rcrtc->index % 2 ? DS2PR : DS1PR, 0); + drm_crtc_wait_one_vblank(crtc); + /* Disable vertical blanking interrupt reporting. We first need to wait * for page flip completion before stopping the CRTC as userspace * expects page flips to eventually complete. -- 2.11.0