aboutsummaryrefslogtreecommitdiff
path: root/linux-core/drm_irq.c
diff options
context:
space:
mode:
authorJesse Barnes <jesse.barnes@intel.com>2007-06-22 11:12:02 -0700
committerJesse Barnes <jesse.barnes@intel.com>2007-06-22 11:12:02 -0700
commit7f2a1cf2753c0c97b1290469a15322f7549f78ae (patch)
tree1375351c4dbe31e2c6b4703bcb685f89b7fb2c46 /linux-core/drm_irq.c
parentd2d53024fb4003a6b86a3ea1ea33c76ac20bebc9 (diff)
parent97dcd7fd25c18d5148619254229f8d94efb55b44 (diff)
Merge branch 'vblank-rework' into vblank
Diffstat (limited to 'linux-core/drm_irq.c')
-rw-r--r--linux-core/drm_irq.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/linux-core/drm_irq.c b/linux-core/drm_irq.c
index 5d8d71be..eea00ac8 100644
--- a/linux-core/drm_irq.c
+++ b/linux-core/drm_irq.c
@@ -77,10 +77,22 @@ int drm_irq_by_busid(struct inode *inode, struct file *filp,
return 0;
}
+static void vblank_disable_fn(unsigned long arg)
+{
+ drm_device_t *dev = (drm_device_t *)arg;
+ int i;
+
+ for (i = 0; i < dev->num_crtcs; i++)
+ if (atomic_read(&dev->vblank_refcount[i]) == 0)
+ dev->driver->disable_vblank(dev, i);
+}
+
int drm_vblank_init(drm_device_t *dev, int num_crtcs)
{
int i, ret = -ENOMEM;
+ setup_timer(&dev->vblank_disable_timer, vblank_disable_fn,\
+ (unsigned long)dev);
spin_lock_init(&dev->vbl_lock);
atomic_set(&dev->vbl_signal_pending, 0);
dev->num_crtcs = num_crtcs;
@@ -374,9 +386,10 @@ EXPORT_SYMBOL(drm_vblank_get);
*/
void drm_vblank_put(drm_device_t *dev, int crtc)
{
- /* Last user can disable interrupts */
+ /* Last user schedules interrupt disable */
if (atomic_dec_and_test(&dev->vblank_refcount[crtc]))
- dev->driver->disable_vblank(dev, crtc);
+ mod_timer(&dev->vblank_disable_timer,
+ round_jiffies_relative(DRM_HZ));
}
EXPORT_SYMBOL(drm_vblank_put);