summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/drm_irq.c
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2014-08-06 11:49:59 (GMT)
committerDaniel Vetter <daniel.vetter@ffwll.ch>2014-08-06 20:39:31 (GMT)
commitc50d7521617d823d769b280bc499e19e364434ae (patch)
tree65883baedcfbffdee6ec8138c0c8fa547ded72a5 /drivers/gpu/drm/drm_irq.c
parent96a9fdd778037799f63c9ae272ec915dd3ad83dc (diff)
downloadlinux-c50d7521617d823d769b280bc499e19e364434ae.tar.xz
drm: Store the vblank timestamp when adjusting the counter during disable
During vblank disable the code tries to guess based on the timestamps whether we just missed one vblank or not. And if so it increments the counter. However it forgets to store the new timestamp to the approriate slot in our timestamp ring buffer. So anyone querying the timestamp for the resulting sequence number would get a stale timestamp. Fix it up by storing the new timestamp. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/drm_irq.c')
-rw-r--r--drivers/gpu/drm/drm_irq.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 62dee81..aa9b064 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -198,6 +198,13 @@ static void vblank_disable_and_save(struct drm_device *dev, int crtc)
* hope for the best.
*/
if ((vblrc > 0) && (abs64(diff_ns) > 1000000)) {
+ /* Store new timestamp in ringbuffer. */
+ vblanktimestamp(dev, crtc, vblcount + 1) = tvblank;
+
+ /* Increment cooked vblank count. This also atomically commits
+ * the timestamp computed above.
+ */
+ smp_mb__before_atomic();
atomic_inc(&vblank->count);
smp_mb__after_atomic();
}