drm: omapdrm: 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. When disabling vblank we must first wait for page flips to complete, so implement page flip completion wait as well. Finally, 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. An interesting side effect is that the .disable_vblank() operation will now be called for the first time with the CRTC disabled and the DISPC runtime suspended. The dispc_runtime_get() call in .disable_vblank() is supposed to take care of that, but the operation is called with a spinlock held, which prevents it from sleeping. To fix that move DISPC runtime PM handling out of the vblank operations to the CRTC code, ensuring that the display controller will always be powered when enabling or disabling vblank interrupts. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
This commit is contained in:
@@ -502,6 +502,7 @@ static int dev_load(struct drm_device *dev, unsigned long flags)
|
||||
{
|
||||
struct omap_drm_platform_data *pdata = dev->dev->platform_data;
|
||||
struct omap_drm_private *priv;
|
||||
unsigned int i;
|
||||
int ret;
|
||||
|
||||
DBG("load: dev=%p", dev);
|
||||
@@ -529,10 +530,14 @@ static int dev_load(struct drm_device *dev, unsigned long flags)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Initialize vblank handling, start with all CRTCs disabled. */
|
||||
ret = drm_vblank_init(dev, priv->num_crtcs);
|
||||
if (ret)
|
||||
dev_warn(dev->dev, "could not init vblank\n");
|
||||
|
||||
for (i = 0; i < priv->num_crtcs; i++)
|
||||
drm_crtc_vblank_off(priv->crtcs[i]);
|
||||
|
||||
priv->fbdev = omap_fbdev_init(dev);
|
||||
if (!priv->fbdev) {
|
||||
dev_warn(dev->dev, "omap_fbdev_init failed\n");
|
||||
|
Reference in New Issue
Block a user