[PATCH 4.14 21/41] drm: mali-dp: Call drm_crtc_vblank_reset on device init

From: Greg Kroah-Hartman
Date: Thu Oct 18 2018 - 14:00:31 EST

4.14-stable review patch. If anyone has any objections, please let me know.


From: Alexandru Gheorghe <alexandru-cosmin.gheorghe@xxxxxxx>

[ Upstream commit 69be1984ded00a11b1ed0888c6d8e4f35370372f ]

Currently, if userspace calls drm_wait_vblank before the crtc is
activated the crtc vblank_enable hook is called, which in case of
malidp driver triggers some warninngs. This happens because on
device init we don't inform the drm core about the vblank state
by calling drm_crtc_vblank_on/off/reset which together with
drm_vblank_get have some magic that prevents calling drm_vblank_enable
when crtc is off.

Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@xxxxxxx>
Acked-by: Liviu Dudau <liviu.dudau@xxxxxxx>
Signed-off-by: Liviu Dudau <liviu.dudau@xxxxxxx>
Signed-off-by: Sasha Levin <alexander.levin@xxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
drivers/gpu/drm/arm/malidp_drv.c | 1 +
1 file changed, 1 insertion(+)

--- a/drivers/gpu/drm/arm/malidp_drv.c
+++ b/drivers/gpu/drm/arm/malidp_drv.c
@@ -617,6 +617,7 @@ static int malidp_bind(struct device *de
drm->irq_enabled = true;

ret = drm_vblank_init(drm, drm->mode_config.num_crtc);
+ drm_crtc_vblank_reset(&malidp->crtc);
if (ret < 0) {
DRM_ERROR("failed to initialise vblank\n");
goto vblank_fail;