aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_irq.c
diff options
context:
space:
mode:
authorJesse Barnes <jbarnes@virtuousgeek.org>2009-01-06 13:21:24 -0500
committerDave Airlie <airlied@linux.ie>2009-01-10 17:59:52 -0500
commitdc1336ff4fe08ae7cfe8301bfd7f0b2cfd31d20a (patch)
treeff3e5a15ccbacb401b256f603fde16da9ec6e482 /drivers/gpu/drm/drm_irq.c
parent71e0ffa599f54058d9b8724b4b14d0486751681d (diff)
drm/i915: set vblank enabled flag correctly across IRQ install/uninstall
In the absence of kernel mode setting, many drivers disable IRQs across VT switch. The core DRM vblank code is missing a check for this case however; even after IRQ disable, the vblank code will still have the vblank_enabled flag set, so unless we track the fact that they're disabled at IRQ uninstall time, when we VT switch back in we won't actually re-enable them, which means any apps waiting on vblank before the switch will hang. This patch does that and also adds a sanity check to the wait condition to look for the irq_enabled flag in general, as well as adding a wakeup to the IRQ uninstall path. Fixes fdo bug #18879 with compiz hangs at VT switch. Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org> Signed-off-by: Eric Anholt <eric@anholt.net> Signed-off-by: Dave Airlie <airlied@linux.ie>
Diffstat (limited to 'drivers/gpu/drm/drm_irq.c')
-rw-r--r--drivers/gpu/drm/drm_irq.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 724e505873cf..477caa1b1e4b 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -267,7 +267,8 @@ EXPORT_SYMBOL(drm_irq_install);
267 */ 267 */
268int drm_irq_uninstall(struct drm_device * dev) 268int drm_irq_uninstall(struct drm_device * dev)
269{ 269{
270 int irq_enabled; 270 unsigned long irqflags;
271 int irq_enabled, i;
271 272
272 if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) 273 if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ))
273 return -EINVAL; 274 return -EINVAL;
@@ -277,6 +278,16 @@ int drm_irq_uninstall(struct drm_device * dev)
277 dev->irq_enabled = 0; 278 dev->irq_enabled = 0;
278 mutex_unlock(&dev->struct_mutex); 279 mutex_unlock(&dev->struct_mutex);
279 280
281 /*
282 * Wake up any waiters so they don't hang.
283 */
284 spin_lock_irqsave(&dev->vbl_lock, irqflags);
285 for (i = 0; i < dev->num_crtcs; i++) {
286 DRM_WAKEUP(&dev->vbl_queue[i]);
287 dev->vblank_enabled[i] = 0;
288 }
289 spin_unlock_irqrestore(&dev->vbl_lock, irqflags);
290
280 if (!irq_enabled) 291 if (!irq_enabled)
281 return -EINVAL; 292 return -EINVAL;
282 293
@@ -652,8 +663,9 @@ int drm_wait_vblank(struct drm_device *dev, void *data,
652 vblwait->request.sequence, crtc); 663 vblwait->request.sequence, crtc);
653 dev->last_vblank_wait[crtc] = vblwait->request.sequence; 664 dev->last_vblank_wait[crtc] = vblwait->request.sequence;
654 DRM_WAIT_ON(ret, dev->vbl_queue[crtc], 3 * DRM_HZ, 665 DRM_WAIT_ON(ret, dev->vbl_queue[crtc], 3 * DRM_HZ,
655 ((drm_vblank_count(dev, crtc) 666 (((drm_vblank_count(dev, crtc) -
656 - vblwait->request.sequence) <= (1 << 23))); 667 vblwait->request.sequence) <= (1 << 23)) ||
668 !dev->irq_enabled));
657 669
658 if (ret != -EINTR) { 670 if (ret != -EINTR) {
659 struct timeval now; 671 struct timeval now;