diff options
Diffstat (limited to 'drivers/gpu/drm/drm_irq.c')
-rw-r--r-- | drivers/gpu/drm/drm_irq.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index cb3794a00f98..68b756253f9f 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c | |||
@@ -407,13 +407,16 @@ int drm_irq_uninstall(struct drm_device *dev) | |||
407 | /* | 407 | /* |
408 | * Wake up any waiters so they don't hang. | 408 | * Wake up any waiters so they don't hang. |
409 | */ | 409 | */ |
410 | spin_lock_irqsave(&dev->vbl_lock, irqflags); | 410 | if (dev->num_crtcs) { |
411 | for (i = 0; i < dev->num_crtcs; i++) { | 411 | spin_lock_irqsave(&dev->vbl_lock, irqflags); |
412 | DRM_WAKEUP(&dev->vbl_queue[i]); | 412 | for (i = 0; i < dev->num_crtcs; i++) { |
413 | dev->vblank_enabled[i] = 0; | 413 | DRM_WAKEUP(&dev->vbl_queue[i]); |
414 | dev->last_vblank[i] = dev->driver->get_vblank_counter(dev, i); | 414 | dev->vblank_enabled[i] = 0; |
415 | dev->last_vblank[i] = | ||
416 | dev->driver->get_vblank_counter(dev, i); | ||
417 | } | ||
418 | spin_unlock_irqrestore(&dev->vbl_lock, irqflags); | ||
415 | } | 419 | } |
416 | spin_unlock_irqrestore(&dev->vbl_lock, irqflags); | ||
417 | 420 | ||
418 | if (!irq_enabled) | 421 | if (!irq_enabled) |
419 | return -EINVAL; | 422 | return -EINVAL; |
@@ -1125,6 +1128,7 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe, | |||
1125 | trace_drm_vblank_event_delivered(current->pid, pipe, | 1128 | trace_drm_vblank_event_delivered(current->pid, pipe, |
1126 | vblwait->request.sequence); | 1129 | vblwait->request.sequence); |
1127 | } else { | 1130 | } else { |
1131 | /* drm_handle_vblank_events will call drm_vblank_put */ | ||
1128 | list_add_tail(&e->base.link, &dev->vblank_event_list); | 1132 | list_add_tail(&e->base.link, &dev->vblank_event_list); |
1129 | vblwait->reply.sequence = vblwait->request.sequence; | 1133 | vblwait->reply.sequence = vblwait->request.sequence; |
1130 | } | 1134 | } |
@@ -1205,8 +1209,12 @@ int drm_wait_vblank(struct drm_device *dev, void *data, | |||
1205 | goto done; | 1209 | goto done; |
1206 | } | 1210 | } |
1207 | 1211 | ||
1208 | if (flags & _DRM_VBLANK_EVENT) | 1212 | if (flags & _DRM_VBLANK_EVENT) { |
1213 | /* must hold on to the vblank ref until the event fires | ||
1214 | * drm_vblank_put will be called asynchronously | ||
1215 | */ | ||
1209 | return drm_queue_vblank_event(dev, crtc, vblwait, file_priv); | 1216 | return drm_queue_vblank_event(dev, crtc, vblwait, file_priv); |
1217 | } | ||
1210 | 1218 | ||
1211 | if ((flags & _DRM_VBLANK_NEXTONMISS) && | 1219 | if ((flags & _DRM_VBLANK_NEXTONMISS) && |
1212 | (seq - vblwait->request.sequence) <= (1<<23)) { | 1220 | (seq - vblwait->request.sequence) <= (1<<23)) { |