aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/drm/drm_irq.c
diff options
context:
space:
mode:
author=?utf-8?q?Michel_D=C3=A4nzer?= <michel@tungstengraphics.com>2006-10-24 09:34:18 -0400
committerairlied <airlied@linux.ie>2006-12-06 23:53:29 -0500
commitab285d74e6742422fd0465577a31fb03fe9ed241 (patch)
tree172d9731b6288751478fd25d985aefb90f7c41bf /drivers/char/drm/drm_irq.c
parent8163e418f71e46a28bac6625b4c633c13bd53c8d (diff)
drm: Core vsync: Add flag DRM_VBLANK_NEXTONMISS.
When this flag is set and the target sequence is missed, wait for the next vertical blank instead of returning immediately. Signed-off-by: Dave Airlie <airlied@linux.ie>
Diffstat (limited to 'drivers/char/drm/drm_irq.c')
-rw-r--r--drivers/char/drm/drm_irq.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/char/drm/drm_irq.c b/drivers/char/drm/drm_irq.c
index b08608a9f026..78aae5b35c62 100644
--- a/drivers/char/drm/drm_irq.c
+++ b/drivers/char/drm/drm_irq.c
@@ -250,8 +250,7 @@ int drm_wait_vblank(DRM_IOCTL_ARGS)
250 drm_wait_vblank_t vblwait; 250 drm_wait_vblank_t vblwait;
251 struct timeval now; 251 struct timeval now;
252 int ret = 0; 252 int ret = 0;
253 unsigned int flags; 253 unsigned int flags, seq;
254 atomic_t *seq;
255 254
256 if (!dev->irq) 255 if (!dev->irq)
257 return -EINVAL; 256 return -EINVAL;
@@ -273,12 +272,12 @@ int drm_wait_vblank(DRM_IOCTL_ARGS)
273 DRIVER_IRQ_VBL2 : DRIVER_IRQ_VBL)) 272 DRIVER_IRQ_VBL2 : DRIVER_IRQ_VBL))
274 return -EINVAL; 273 return -EINVAL;
275 274
276 seq = (flags & _DRM_VBLANK_SECONDARY) ? &dev->vbl_received2 : 275 seq = atomic_read((flags & _DRM_VBLANK_SECONDARY) ? &dev->vbl_received2
277 &dev->vbl_received; 276 : &dev->vbl_received);
278 277
279 switch (vblwait.request.type & _DRM_VBLANK_TYPES_MASK) { 278 switch (vblwait.request.type & _DRM_VBLANK_TYPES_MASK) {
280 case _DRM_VBLANK_RELATIVE: 279 case _DRM_VBLANK_RELATIVE:
281 vblwait.request.sequence += atomic_read(seq); 280 vblwait.request.sequence += seq;
282 vblwait.request.type &= ~_DRM_VBLANK_RELATIVE; 281 vblwait.request.type &= ~_DRM_VBLANK_RELATIVE;
283 case _DRM_VBLANK_ABSOLUTE: 282 case _DRM_VBLANK_ABSOLUTE:
284 break; 283 break;
@@ -286,13 +285,18 @@ int drm_wait_vblank(DRM_IOCTL_ARGS)
286 return -EINVAL; 285 return -EINVAL;
287 } 286 }
288 287
288 if ((flags & _DRM_VBLANK_NEXTONMISS) &&
289 (seq - vblwait.request.sequence) <= (1<<23)) {
290 vblwait.request.sequence = seq + 1;
291 }
292
289 if (flags & _DRM_VBLANK_SIGNAL) { 293 if (flags & _DRM_VBLANK_SIGNAL) {
290 unsigned long irqflags; 294 unsigned long irqflags;
291 drm_vbl_sig_t *vbl_sigs = (flags & _DRM_VBLANK_SECONDARY) 295 drm_vbl_sig_t *vbl_sigs = (flags & _DRM_VBLANK_SECONDARY)
292 ? &dev->vbl_sigs2 : &dev->vbl_sigs; 296 ? &dev->vbl_sigs2 : &dev->vbl_sigs;
293 drm_vbl_sig_t *vbl_sig; 297 drm_vbl_sig_t *vbl_sig;
294 298
295 vblwait.reply.sequence = atomic_read(seq); 299 vblwait.reply.sequence = seq;
296 300
297 spin_lock_irqsave(&dev->vbl_lock, irqflags); 301 spin_lock_irqsave(&dev->vbl_lock, irqflags);
298 302