aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/drm_vblank.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index f0d3ed5f2528..913954765d9e 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -347,23 +347,25 @@ void drm_vblank_disable_and_save(struct drm_device *dev, unsigned int pipe)
347 spin_lock_irqsave(&dev->vblank_time_lock, irqflags); 347 spin_lock_irqsave(&dev->vblank_time_lock, irqflags);
348 348
349 /* 349 /*
350 * Only disable vblank interrupts if they're enabled. This avoids 350 * Update vblank count and disable vblank interrupts only if the
351 * calling the ->disable_vblank() operation in atomic context with the 351 * interrupts were enabled. This avoids calling the ->disable_vblank()
352 * hardware potentially runtime suspended. 352 * operation in atomic context with the hardware potentially runtime
353 * suspended.
353 */ 354 */
354 if (vblank->enabled) { 355 if (!vblank->enabled)
355 __disable_vblank(dev, pipe); 356 goto out;
356 vblank->enabled = false;
357 }
358 357
359 /* 358 /*
360 * Always update the count and timestamp to maintain the 359 * Update the count and timestamp to maintain the
361 * appearance that the counter has been ticking all along until 360 * appearance that the counter has been ticking all along until
362 * this time. This makes the count account for the entire time 361 * this time. This makes the count account for the entire time
363 * between drm_crtc_vblank_on() and drm_crtc_vblank_off(). 362 * between drm_crtc_vblank_on() and drm_crtc_vblank_off().
364 */ 363 */
365 drm_update_vblank_count(dev, pipe, false); 364 drm_update_vblank_count(dev, pipe, false);
365 __disable_vblank(dev, pipe);
366 vblank->enabled = false;
366 367
368out:
367 spin_unlock_irqrestore(&dev->vblank_time_lock, irqflags); 369 spin_unlock_irqrestore(&dev->vblank_time_lock, irqflags);
368} 370}
369 371