diff options
author | Keith Packard <keithp@keithp.com> | 2008-06-06 12:59:52 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2008-06-06 13:00:47 -0700 |
commit | 9f46c6935d154743162c6239903a4a9e443907bc (patch) | |
tree | 8212464335d194a7c1f909d2eb20523fbcd6b789 /linux-core | |
parent | a708106c77f74f146722fba35eae772fb554ee9a (diff) |
[intel-gem] Use timers to retire requests periodically.
Without the user IRQ running constantly, there's no wakeup when the ring
empties to go retire requests and free buffers. Use a 1 second timer to make
that happen more often.
Diffstat (limited to 'linux-core')
-rw-r--r-- | linux-core/drm_irq.c | 1 | ||||
-rw-r--r-- | linux-core/i915_gem.c | 29 |
2 files changed, 30 insertions, 0 deletions
diff --git a/linux-core/drm_irq.c b/linux-core/drm_irq.c index 8f27d7f3..318d9d7a 100644 --- a/linux-core/drm_irq.c +++ b/linux-core/drm_irq.c @@ -124,6 +124,7 @@ int drm_vblank_init(struct drm_device *dev, int num_crtcs) setup_timer(&dev->vblank_disable_timer, vblank_disable_fn, (unsigned long)dev); + init_timer_deferrable(&dev->vblank_disable_timer); spin_lock_init(&dev->vbl_lock); atomic_set(&dev->vbl_signal_pending, 0); dev->num_crtcs = num_crtcs; diff --git a/linux-core/i915_gem.c b/linux-core/i915_gem.c index 14e57b41..abc929e9 100644 --- a/linux-core/i915_gem.c +++ b/linux-core/i915_gem.c @@ -162,6 +162,9 @@ i915_add_request(struct drm_device *dev, uint32_t flush_domains) request->seqno = seqno; request->emitted_jiffies = jiffies; request->flush_domains = flush_domains; + if (list_empty(&dev_priv->mm.request_list)) + mod_timer(&dev_priv->mm.retire_timer, jiffies + HZ); + list_add_tail(&request->list, &dev_priv->mm.request_list); return seqno; @@ -300,6 +303,32 @@ i915_gem_retire_requests(struct drm_device *dev) } } +void +i915_gem_retire_timeout(unsigned long data) +{ + struct drm_device *dev = (struct drm_device *) data; + drm_i915_private_t *dev_priv = dev->dev_private; + + schedule_work(&dev_priv->mm.retire_task); +} + +void +i915_gem_retire_handler(struct work_struct *work) +{ + drm_i915_private_t *dev_priv; + struct drm_device *dev; + + dev_priv = container_of(work, drm_i915_private_t, + mm.retire_task); + dev = dev_priv->dev; + + mutex_lock(&dev->struct_mutex); + i915_gem_retire_requests(dev); + if (!list_empty(&dev_priv->mm.request_list)) + mod_timer(&dev_priv->mm.retire_timer, jiffies + HZ); + mutex_unlock(&dev->struct_mutex); +} + /** * Waits for a sequence number to be signaled, and cleans up the * request and object lists appropriately for that event. |