aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_irq.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/drm_irq.c')
-rw-r--r--drivers/gpu/drm/drm_irq.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 69aa0ab28403..93e677a481f5 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -276,6 +276,7 @@ int drm_irq_uninstall(struct drm_device * dev)
276 for (i = 0; i < dev->num_crtcs; i++) { 276 for (i = 0; i < dev->num_crtcs; i++) {
277 DRM_WAKEUP(&dev->vbl_queue[i]); 277 DRM_WAKEUP(&dev->vbl_queue[i]);
278 dev->vblank_enabled[i] = 0; 278 dev->vblank_enabled[i] = 0;
279 dev->last_vblank[i] = dev->driver->get_vblank_counter(dev, i);
279 } 280 }
280 spin_unlock_irqrestore(&dev->vbl_lock, irqflags); 281 spin_unlock_irqrestore(&dev->vbl_lock, irqflags);
281 282
@@ -434,6 +435,8 @@ EXPORT_SYMBOL(drm_vblank_get);
434 */ 435 */
435void drm_vblank_put(struct drm_device *dev, int crtc) 436void drm_vblank_put(struct drm_device *dev, int crtc)
436{ 437{
438 BUG_ON (atomic_read (&dev->vblank_refcount[crtc]) == 0);
439
437 /* Last user schedules interrupt disable */ 440 /* Last user schedules interrupt disable */
438 if (atomic_dec_and_test(&dev->vblank_refcount[crtc])) 441 if (atomic_dec_and_test(&dev->vblank_refcount[crtc]))
439 mod_timer(&dev->vblank_disable_timer, jiffies + 5*DRM_HZ); 442 mod_timer(&dev->vblank_disable_timer, jiffies + 5*DRM_HZ);
@@ -459,8 +462,9 @@ void drm_vblank_pre_modeset(struct drm_device *dev, int crtc)
459 * so that interrupts remain enabled in the interim. 462 * so that interrupts remain enabled in the interim.
460 */ 463 */
461 if (!dev->vblank_inmodeset[crtc]) { 464 if (!dev->vblank_inmodeset[crtc]) {
462 dev->vblank_inmodeset[crtc] = 1; 465 dev->vblank_inmodeset[crtc] = 0x1;
463 drm_vblank_get(dev, crtc); 466 if (drm_vblank_get(dev, crtc) == 0)
467 dev->vblank_inmodeset[crtc] |= 0x2;
464 } 468 }
465} 469}
466EXPORT_SYMBOL(drm_vblank_pre_modeset); 470EXPORT_SYMBOL(drm_vblank_pre_modeset);
@@ -472,9 +476,12 @@ void drm_vblank_post_modeset(struct drm_device *dev, int crtc)
472 if (dev->vblank_inmodeset[crtc]) { 476 if (dev->vblank_inmodeset[crtc]) {
473 spin_lock_irqsave(&dev->vbl_lock, irqflags); 477 spin_lock_irqsave(&dev->vbl_lock, irqflags);
474 dev->vblank_disable_allowed = 1; 478 dev->vblank_disable_allowed = 1;
475 dev->vblank_inmodeset[crtc] = 0;
476 spin_unlock_irqrestore(&dev->vbl_lock, irqflags); 479 spin_unlock_irqrestore(&dev->vbl_lock, irqflags);
477 drm_vblank_put(dev, crtc); 480
481 if (dev->vblank_inmodeset[crtc] & 0x2)
482 drm_vblank_put(dev, crtc);
483
484 dev->vblank_inmodeset[crtc] = 0;
478 } 485 }
479} 486}
480EXPORT_SYMBOL(drm_vblank_post_modeset); 487EXPORT_SYMBOL(drm_vblank_post_modeset);