Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 43912
b: refs/heads/master
c: ab285d7
h: refs/heads/master
v: v3
  • Loading branch information
=?utf-8?q?Michel_D=C3=A4nzer?= authored and airlied committed Dec 7, 2006
1 parent bc9e90b commit c49d328
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8163e418f71e46a28bac6625b4c633c13bd53c8d
refs/heads/master: ab285d74e6742422fd0465577a31fb03fe9ed241
4 changes: 3 additions & 1 deletion trunk/drivers/char/drm/drm.h
Original file line number Diff line number Diff line change
Expand Up @@ -487,12 +487,14 @@ typedef struct drm_irq_busid {
typedef enum {
_DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */
_DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */
_DRM_VBLANK_NEXTONMISS = 0x10000000, /**< If missed, wait for next vblank */
_DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */
_DRM_VBLANK_SIGNAL = 0x40000000 /**< Send signal instead of blocking */
} drm_vblank_seq_type_t;

#define _DRM_VBLANK_TYPES_MASK (_DRM_VBLANK_ABSOLUTE | _DRM_VBLANK_RELATIVE)
#define _DRM_VBLANK_FLAGS_MASK (_DRM_VBLANK_SIGNAL | _DRM_VBLANK_SECONDARY)
#define _DRM_VBLANK_FLAGS_MASK (_DRM_VBLANK_SIGNAL | _DRM_VBLANK_SECONDARY | \
_DRM_VBLANK_NEXTONMISS)

struct drm_wait_vblank_request {
drm_vblank_seq_type_t type;
Expand Down
16 changes: 10 additions & 6 deletions trunk/drivers/char/drm/drm_irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,7 @@ int drm_wait_vblank(DRM_IOCTL_ARGS)
drm_wait_vblank_t vblwait;
struct timeval now;
int ret = 0;
unsigned int flags;
atomic_t *seq;
unsigned int flags, seq;

if (!dev->irq)
return -EINVAL;
Expand All @@ -273,26 +272,31 @@ int drm_wait_vblank(DRM_IOCTL_ARGS)
DRIVER_IRQ_VBL2 : DRIVER_IRQ_VBL))
return -EINVAL;

seq = (flags & _DRM_VBLANK_SECONDARY) ? &dev->vbl_received2 :
&dev->vbl_received;
seq = atomic_read((flags & _DRM_VBLANK_SECONDARY) ? &dev->vbl_received2
: &dev->vbl_received);

switch (vblwait.request.type & _DRM_VBLANK_TYPES_MASK) {
case _DRM_VBLANK_RELATIVE:
vblwait.request.sequence += atomic_read(seq);
vblwait.request.sequence += seq;
vblwait.request.type &= ~_DRM_VBLANK_RELATIVE;
case _DRM_VBLANK_ABSOLUTE:
break;
default:
return -EINVAL;
}

if ((flags & _DRM_VBLANK_NEXTONMISS) &&
(seq - vblwait.request.sequence) <= (1<<23)) {
vblwait.request.sequence = seq + 1;
}

if (flags & _DRM_VBLANK_SIGNAL) {
unsigned long irqflags;
drm_vbl_sig_t *vbl_sigs = (flags & _DRM_VBLANK_SECONDARY)
? &dev->vbl_sigs2 : &dev->vbl_sigs;
drm_vbl_sig_t *vbl_sig;

vblwait.reply.sequence = atomic_read(seq);
vblwait.reply.sequence = seq;

spin_lock_irqsave(&dev->vbl_lock, irqflags);

Expand Down

0 comments on commit c49d328

Please sign in to comment.