[PATCH] drm: don't warn unconditionally in drm_vblank_cleanup about enabled vblanks

Lucas Stach l.stach at pengutronix.de
Fri Aug 12 09:04:38 UTC 2016


On drivers without immediate vblank disabling drm_vblank_cleanup() may be
called before the delayed vblank disable timer has fired. Instead of spitting
out a warning unconditionally in this case, run the vblank disable function
immediately.

Only warn if vblanks are still enabled and there was no timer pending to
disable them.

Signed-off-by: Lucas Stach <l.stach at pengutronix.de>
---
 drivers/gpu/drm/drm_irq.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 77f357b2c386..e6eb5024341d 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -335,10 +335,15 @@ void drm_vblank_cleanup(struct drm_device *dev)
 	for (pipe = 0; pipe < dev->num_crtcs; pipe++) {
 		struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
 
-		WARN_ON(vblank->enabled &&
-			drm_core_check_feature(dev, DRIVER_MODESET));
-
-		del_timer_sync(&vblank->disable_timer);
+		if (del_timer_sync(&vblank->disable_timer))
+			/*
+			 * If we deactivated a pending timer, make sure to
+			 * disable the vblank now.
+			 */
+			vblank_disable_fn((unsigned long)vblank);
+		else
+			WARN_ON(vblank->enabled &&
+				drm_core_check_feature(dev, DRIVER_MODESET));
 	}
 
 	kfree(dev->vblank);
-- 
2.8.1



More information about the dri-devel mailing list