Skip to content

Commit c285aac

Browse files
committed
drm: renesas: shmobile: Turn vblank on/off when enabling/disabling CRTC
The DRM core vblank handling mechanism requires drivers to forcefully turn vblank reporting off when disabling the CRTC, and to restore the vblank reporting status when enabling the CRTC. Implement this using the drm_crtc_vblank_{on,off}() helpers. Note that drm_crtc_vblank_off() must be called at startup to synchronize the state of the vblank core code with the hardware, which is initially disabled. This is performed at CRTC creation time, requiring vertical blank initialization to be moved before creating CRTCs. Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Geert Uytterhoeven <[email protected]> Link: https://lore.kernel.org/r/e5833e5706b7792bfca8e6e56fc154a7c3e0574f.1694767209.git.geert+renesas@glider.be
1 parent b1ce7fe commit c285aac

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

drivers/gpu/drm/renesas/shmobile/shmob_drm_crtc.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,9 @@ static void shmob_drm_crtc_start(struct shmob_drm_crtc *scrtc)
271271

272272
shmob_drm_crtc_start_stop(scrtc, true);
273273

274+
/* Turn vertical blank interrupt reporting back on. */
275+
drm_crtc_vblank_on(crtc);
276+
274277
scrtc->started = true;
275278
}
276279

@@ -283,10 +286,12 @@ static void shmob_drm_crtc_stop(struct shmob_drm_crtc *scrtc)
283286
return;
284287

285288
/*
286-
* Wait for page flip completion before stopping the CRTC as userspace
289+
* Disable vertical blank interrupt reporting. We first need to wait
290+
* for page flip completion before stopping the CRTC as userspace
287291
* expects page flips to eventually complete.
288292
*/
289293
shmob_drm_crtc_wait_page_flip(scrtc);
294+
drm_crtc_vblank_off(crtc);
290295

291296
/* Stop the LCDC. */
292297
shmob_drm_crtc_start_stop(scrtc, false);
@@ -519,6 +524,9 @@ int shmob_drm_crtc_create(struct shmob_drm_device *sdev)
519524

520525
drm_crtc_helper_add(crtc, &crtc_helper_funcs);
521526

527+
/* Start with vertical blank interrupt reporting disabled. */
528+
drm_crtc_vblank_off(crtc);
529+
522530
return 0;
523531
}
524532

drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -215,17 +215,17 @@ static int shmob_drm_probe(struct platform_device *pdev)
215215
if (ret)
216216
return ret;
217217

218-
ret = shmob_drm_modeset_init(sdev);
219-
if (ret < 0)
220-
return dev_err_probe(&pdev->dev, ret,
221-
"failed to initialize mode setting\n");
222-
223218
ret = drm_vblank_init(ddev, 1);
224219
if (ret < 0) {
225220
dev_err(&pdev->dev, "failed to initialize vblank\n");
226-
goto err_modeset_cleanup;
221+
return ret;
227222
}
228223

224+
ret = shmob_drm_modeset_init(sdev);
225+
if (ret < 0)
226+
return dev_err_probe(&pdev->dev, ret,
227+
"failed to initialize mode setting\n");
228+
229229
ret = platform_get_irq(pdev, 0);
230230
if (ret < 0)
231231
goto err_modeset_cleanup;

0 commit comments

Comments
 (0)