aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario Kleiner <mario.kleiner@tuebingen.mpg.de>2010-12-10 10:00:19 -0500
committerDave Airlie <airlied@redhat.com>2010-12-20 22:25:09 -0500
commit000fa7cf46479238f7b9f2d7763e41af5268b16a (patch)
tree369187b88e87ffc31b1479dd6eb69a8a942bc755
parent3ce05168907c9b1358492a73badb0ff1603fb81d (diff)
drm-vblank: Always return true vblank count of scheduled vblank event.
This patch tries to make sure that the vbl.reply.sequence vblank count for a queued or emitted vblank event always corresponds to the true vblank count of queueing/emission, so the ddx can rely on the returned target_msc for consistency checks and implementation of swap_intervals in glXSwapBuffers(). Without this there is a small race-condition between the userspace ddx queueing a vblank event and the vblank counter incrementing before the event gets queued in the kernel. Signed-off-by: Mario Kleiner <mario.kleiner@tuebingen.mpg.de> Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org> Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--drivers/gpu/drm/drm_irq.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 4e82d0d3c378..55160d7c38b6 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -1086,15 +1086,18 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe,
1086 1086
1087 e->event.sequence = vblwait->request.sequence; 1087 e->event.sequence = vblwait->request.sequence;
1088 if ((seq - vblwait->request.sequence) <= (1 << 23)) { 1088 if ((seq - vblwait->request.sequence) <= (1 << 23)) {
1089 e->event.sequence = seq;
1089 e->event.tv_sec = now.tv_sec; 1090 e->event.tv_sec = now.tv_sec;
1090 e->event.tv_usec = now.tv_usec; 1091 e->event.tv_usec = now.tv_usec;
1091 drm_vblank_put(dev, e->pipe); 1092 drm_vblank_put(dev, e->pipe);
1092 list_add_tail(&e->base.link, &e->base.file_priv->event_list); 1093 list_add_tail(&e->base.link, &e->base.file_priv->event_list);
1093 wake_up_interruptible(&e->base.file_priv->event_wait); 1094 wake_up_interruptible(&e->base.file_priv->event_wait);
1095 vblwait->reply.sequence = seq;
1094 trace_drm_vblank_event_delivered(current->pid, pipe, 1096 trace_drm_vblank_event_delivered(current->pid, pipe,
1095 vblwait->request.sequence); 1097 vblwait->request.sequence);
1096 } else { 1098 } else {
1097 list_add_tail(&e->base.link, &dev->vblank_event_list); 1099 list_add_tail(&e->base.link, &dev->vblank_event_list);
1100 vblwait->reply.sequence = vblwait->request.sequence;
1098 } 1101 }
1099 1102
1100 spin_unlock_irqrestore(&dev->event_lock, flags); 1103 spin_unlock_irqrestore(&dev->event_lock, flags);