summaryrefslogtreecommitdiff
path: root/linux-core
diff options
context:
space:
mode:
authorMichel Dänzer <michel@tungstengraphics.com>2008-06-03 11:28:09 +0200
committerMichel Dänzer <michel@tungstengraphics.com>2008-06-03 11:28:09 +0200
commitd1dcb2b32e0c51d7cbcaa2ba1e0544452cf8f47b (patch)
tree4b2491f2ce700aa7243c37da209a8366d881f95d /linux-core
parent0144ebeb8a713b1420d35004075037cd4b0495a1 (diff)
vblank: Special-case driver vblank counter going back by 1.
Turns out the radeon driver is affected by the same problem that prompted i915 to revert to less useful counter flipping at the end of the vblank interval. In the long term, we can hopefully implement more reliable methods to achieve counter flipping at the beginning of vblank, but otherwise this should be an acceptable workaround.
Diffstat (limited to 'linux-core')
-rw-r--r--linux-core/drm_irq.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/linux-core/drm_irq.c b/linux-core/drm_irq.c
index e2f106e4..ccb3ca89 100644
--- a/linux-core/drm_irq.c
+++ b/linux-core/drm_irq.c
@@ -360,9 +360,16 @@ void drm_update_vblank_count(struct drm_device *dev, int crtc)
cur_vblank = dev->driver->get_vblank_counter(dev, crtc);
spin_lock_irqsave(&dev->vbl_lock, irqflags);
if (cur_vblank < dev->last_vblank[crtc]) {
- diff = dev->max_vblank_count -
- dev->last_vblank[crtc];
- diff += cur_vblank;
+ if (cur_vblank == dev->last_vblank[crtc] - 1) {
+ diff = 0;
+ } else {
+ diff = dev->max_vblank_count -
+ dev->last_vblank[crtc];
+ diff += cur_vblank;
+ }
+
+ DRM_DEBUG("last_vblank[%d]=0x%x, cur_vblank=0x%x => diff=0x%x\n",
+ crtc, dev->last_vblank[crtc], cur_vblank, diff);
} else {
diff = cur_vblank - dev->last_vblank[crtc];
}