diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2010-07-23 18:18:49 -0400 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2010-08-01 22:52:57 -0400 |
commit | b09a1feca65764311f8a3e14befb52b98d705f0a (patch) | |
tree | 304b9bcb257b21bec30244e207e47d95035148bd /drivers | |
parent | b9421ae8f30958deea98d71477b4a77a066856b4 (diff) |
drm/i915: Refactor i915_gem_retire_requests()
Combine the iteration over active render rings into a common function.
This is in preparation for reusing the idle function to also retire
deferred free requests.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/i915/i915_drv.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_drv.h | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem.c | 39 |
3 files changed, 20 insertions, 24 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 119692f3ce9d..5044f653e8ea 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
@@ -340,7 +340,7 @@ int i965_reset(struct drm_device *dev, u8 flags) | |||
340 | /* | 340 | /* |
341 | * Clear request list | 341 | * Clear request list |
342 | */ | 342 | */ |
343 | i915_gem_retire_requests(dev, &dev_priv->render_ring); | 343 | i915_gem_retire_requests(dev); |
344 | 344 | ||
345 | if (need_display) | 345 | if (need_display) |
346 | i915_save_display(dev); | 346 | i915_save_display(dev); |
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 46a544abbd6d..a27780b7aef2 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -960,8 +960,7 @@ uint32_t i915_get_gem_seqno(struct drm_device *dev, | |||
960 | bool i915_seqno_passed(uint32_t seq1, uint32_t seq2); | 960 | bool i915_seqno_passed(uint32_t seq1, uint32_t seq2); |
961 | int i915_gem_object_get_fence_reg(struct drm_gem_object *obj); | 961 | int i915_gem_object_get_fence_reg(struct drm_gem_object *obj); |
962 | int i915_gem_object_put_fence_reg(struct drm_gem_object *obj); | 962 | int i915_gem_object_put_fence_reg(struct drm_gem_object *obj); |
963 | void i915_gem_retire_requests(struct drm_device *dev, | 963 | void i915_gem_retire_requests(struct drm_device *dev); |
964 | struct intel_ring_buffer *ring); | ||
965 | void i915_gem_retire_work_handler(struct work_struct *work); | 964 | void i915_gem_retire_work_handler(struct work_struct *work); |
966 | void i915_gem_clflush_object(struct drm_gem_object *obj); | 965 | void i915_gem_clflush_object(struct drm_gem_object *obj); |
967 | int i915_gem_object_set_domain(struct drm_gem_object *obj, | 966 | int i915_gem_object_set_domain(struct drm_gem_object *obj, |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index b1069dc09611..138ca6ea5ef7 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -1709,9 +1709,9 @@ i915_get_gem_seqno(struct drm_device *dev, | |||
1709 | /** | 1709 | /** |
1710 | * This function clears the request list as sequence numbers are passed. | 1710 | * This function clears the request list as sequence numbers are passed. |
1711 | */ | 1711 | */ |
1712 | void | 1712 | static void |
1713 | i915_gem_retire_requests(struct drm_device *dev, | 1713 | i915_gem_retire_requests_ring(struct drm_device *dev, |
1714 | struct intel_ring_buffer *ring) | 1714 | struct intel_ring_buffer *ring) |
1715 | { | 1715 | { |
1716 | drm_i915_private_t *dev_priv = dev->dev_private; | 1716 | drm_i915_private_t *dev_priv = dev->dev_private; |
1717 | uint32_t seqno; | 1717 | uint32_t seqno; |
@@ -1751,6 +1751,16 @@ i915_gem_retire_requests(struct drm_device *dev, | |||
1751 | } | 1751 | } |
1752 | 1752 | ||
1753 | void | 1753 | void |
1754 | i915_gem_retire_requests(struct drm_device *dev) | ||
1755 | { | ||
1756 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
1757 | |||
1758 | i915_gem_retire_requests_ring(dev, &dev_priv->render_ring); | ||
1759 | if (HAS_BSD(dev)) | ||
1760 | i915_gem_retire_requests_ring(dev, &dev_priv->bsd_ring); | ||
1761 | } | ||
1762 | |||
1763 | void | ||
1754 | i915_gem_retire_work_handler(struct work_struct *work) | 1764 | i915_gem_retire_work_handler(struct work_struct *work) |
1755 | { | 1765 | { |
1756 | drm_i915_private_t *dev_priv; | 1766 | drm_i915_private_t *dev_priv; |
@@ -1761,10 +1771,7 @@ i915_gem_retire_work_handler(struct work_struct *work) | |||
1761 | dev = dev_priv->dev; | 1771 | dev = dev_priv->dev; |
1762 | 1772 | ||
1763 | mutex_lock(&dev->struct_mutex); | 1773 | mutex_lock(&dev->struct_mutex); |
1764 | i915_gem_retire_requests(dev, &dev_priv->render_ring); | 1774 | i915_gem_retire_requests(dev); |
1765 | |||
1766 | if (HAS_BSD(dev)) | ||
1767 | i915_gem_retire_requests(dev, &dev_priv->bsd_ring); | ||
1768 | 1775 | ||
1769 | if (!dev_priv->mm.suspended && | 1776 | if (!dev_priv->mm.suspended && |
1770 | (!list_empty(&dev_priv->render_ring.request_list) || | 1777 | (!list_empty(&dev_priv->render_ring.request_list) || |
@@ -1832,7 +1839,7 @@ i915_do_wait_request(struct drm_device *dev, uint32_t seqno, | |||
1832 | * a separate wait queue to handle that. | 1839 | * a separate wait queue to handle that. |
1833 | */ | 1840 | */ |
1834 | if (ret == 0) | 1841 | if (ret == 0) |
1835 | i915_gem_retire_requests(dev, ring); | 1842 | i915_gem_retire_requests_ring(dev, ring); |
1836 | 1843 | ||
1837 | return ret; | 1844 | return ret; |
1838 | } | 1845 | } |
@@ -2107,10 +2114,7 @@ i915_gem_evict_something(struct drm_device *dev, int min_size) | |||
2107 | struct intel_ring_buffer *render_ring = &dev_priv->render_ring; | 2114 | struct intel_ring_buffer *render_ring = &dev_priv->render_ring; |
2108 | struct intel_ring_buffer *bsd_ring = &dev_priv->bsd_ring; | 2115 | struct intel_ring_buffer *bsd_ring = &dev_priv->bsd_ring; |
2109 | for (;;) { | 2116 | for (;;) { |
2110 | i915_gem_retire_requests(dev, render_ring); | 2117 | i915_gem_retire_requests(dev); |
2111 | |||
2112 | if (HAS_BSD(dev)) | ||
2113 | i915_gem_retire_requests(dev, bsd_ring); | ||
2114 | 2118 | ||
2115 | /* If there's an inactive buffer available now, grab it | 2119 | /* If there's an inactive buffer available now, grab it |
2116 | * and be done. | 2120 | * and be done. |
@@ -4330,7 +4334,6 @@ i915_gem_busy_ioctl(struct drm_device *dev, void *data, | |||
4330 | struct drm_i915_gem_busy *args = data; | 4334 | struct drm_i915_gem_busy *args = data; |
4331 | struct drm_gem_object *obj; | 4335 | struct drm_gem_object *obj; |
4332 | struct drm_i915_gem_object *obj_priv; | 4336 | struct drm_i915_gem_object *obj_priv; |
4333 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
4334 | 4337 | ||
4335 | obj = drm_gem_object_lookup(dev, file_priv, args->handle); | 4338 | obj = drm_gem_object_lookup(dev, file_priv, args->handle); |
4336 | if (obj == NULL) { | 4339 | if (obj == NULL) { |
@@ -4345,10 +4348,7 @@ i915_gem_busy_ioctl(struct drm_device *dev, void *data, | |||
4345 | * actually unmasked, and our working set ends up being larger than | 4348 | * actually unmasked, and our working set ends up being larger than |
4346 | * required. | 4349 | * required. |
4347 | */ | 4350 | */ |
4348 | i915_gem_retire_requests(dev, &dev_priv->render_ring); | 4351 | i915_gem_retire_requests(dev); |
4349 | |||
4350 | if (HAS_BSD(dev)) | ||
4351 | i915_gem_retire_requests(dev, &dev_priv->bsd_ring); | ||
4352 | 4352 | ||
4353 | obj_priv = to_intel_bo(obj); | 4353 | obj_priv = to_intel_bo(obj); |
4354 | /* Don't count being on the flushing list against the object being | 4354 | /* Don't count being on the flushing list against the object being |
@@ -5054,10 +5054,7 @@ rescan: | |||
5054 | continue; | 5054 | continue; |
5055 | 5055 | ||
5056 | spin_unlock(&shrink_list_lock); | 5056 | spin_unlock(&shrink_list_lock); |
5057 | i915_gem_retire_requests(dev, &dev_priv->render_ring); | 5057 | i915_gem_retire_requests(dev); |
5058 | |||
5059 | if (HAS_BSD(dev)) | ||
5060 | i915_gem_retire_requests(dev, &dev_priv->bsd_ring); | ||
5061 | 5058 | ||
5062 | list_for_each_entry_safe(obj_priv, next_obj, | 5059 | list_for_each_entry_safe(obj_priv, next_obj, |
5063 | &dev_priv->mm.inactive_list, | 5060 | &dev_priv->mm.inactive_list, |