diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2010-10-19 05:13:00 -0400 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2010-10-20 05:51:51 -0400 |
commit | 87acb0a550694ff1a7725ea3a73b80d8ccf56180 (patch) | |
tree | da29fd24edf57a01c69d094490da80ae3511cc48 /drivers/gpu | |
parent | 9af90d19f8a166694753b3f0558d3a8bcd66c0b5 (diff) |
drm/i915: Simplify most HAS_BSD() checks
... by always initialising the empty ringbuffer it is always then safe
to check whether it is active.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/i915/i915_dma.c | 10 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem.c | 43 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem_evict.c | 6 |
3 files changed, 22 insertions, 37 deletions
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 35d121c70a1..1ffeb1c5e7c 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -132,8 +132,7 @@ static int i915_dma_cleanup(struct drm_device * dev) | |||
132 | 132 | ||
133 | mutex_lock(&dev->struct_mutex); | 133 | mutex_lock(&dev->struct_mutex); |
134 | intel_cleanup_ring_buffer(dev, &dev_priv->render_ring); | 134 | intel_cleanup_ring_buffer(dev, &dev_priv->render_ring); |
135 | if (HAS_BSD(dev)) | 135 | intel_cleanup_ring_buffer(dev, &dev_priv->bsd_ring); |
136 | intel_cleanup_ring_buffer(dev, &dev_priv->bsd_ring); | ||
137 | mutex_unlock(&dev->struct_mutex); | 136 | mutex_unlock(&dev->struct_mutex); |
138 | 137 | ||
139 | /* Clear the HWS virtual address at teardown */ | 138 | /* Clear the HWS virtual address at teardown */ |
@@ -1199,9 +1198,6 @@ static int i915_load_modeset_init(struct drm_device *dev, | |||
1199 | /* Basic memrange allocator for stolen space (aka mm.vram) */ | 1198 | /* Basic memrange allocator for stolen space (aka mm.vram) */ |
1200 | drm_mm_init(&dev_priv->mm.vram, 0, prealloc_size); | 1199 | drm_mm_init(&dev_priv->mm.vram, 0, prealloc_size); |
1201 | 1200 | ||
1202 | /* We're off and running w/KMS */ | ||
1203 | dev_priv->mm.suspended = 0; | ||
1204 | |||
1205 | /* Let GEM Manage from end of prealloc space to end of aperture. | 1201 | /* Let GEM Manage from end of prealloc space to end of aperture. |
1206 | * | 1202 | * |
1207 | * However, leave one page at the end still bound to the scratch page. | 1203 | * However, leave one page at the end still bound to the scratch page. |
@@ -1271,6 +1267,10 @@ static int i915_load_modeset_init(struct drm_device *dev, | |||
1271 | goto cleanup_irq; | 1267 | goto cleanup_irq; |
1272 | 1268 | ||
1273 | drm_kms_helper_poll_init(dev); | 1269 | drm_kms_helper_poll_init(dev); |
1270 | |||
1271 | /* We're off and running w/KMS */ | ||
1272 | dev_priv->mm.suspended = 0; | ||
1273 | |||
1274 | return 0; | 1274 | return 0; |
1275 | 1275 | ||
1276 | cleanup_irq: | 1276 | cleanup_irq: |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index f6a615ea302..56153685d14 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -1795,8 +1795,7 @@ void i915_gem_reset(struct drm_device *dev) | |||
1795 | int i; | 1795 | int i; |
1796 | 1796 | ||
1797 | i915_gem_reset_ring_lists(dev_priv, &dev_priv->render_ring); | 1797 | i915_gem_reset_ring_lists(dev_priv, &dev_priv->render_ring); |
1798 | if (HAS_BSD(dev)) | 1798 | i915_gem_reset_ring_lists(dev_priv, &dev_priv->bsd_ring); |
1799 | i915_gem_reset_ring_lists(dev_priv, &dev_priv->bsd_ring); | ||
1800 | 1799 | ||
1801 | /* Remove anything from the flushing lists. The GPU cache is likely | 1800 | /* Remove anything from the flushing lists. The GPU cache is likely |
1802 | * to be lost on reset along with the data, so simply move the | 1801 | * to be lost on reset along with the data, so simply move the |
@@ -1918,8 +1917,7 @@ i915_gem_retire_requests(struct drm_device *dev) | |||
1918 | } | 1917 | } |
1919 | 1918 | ||
1920 | i915_gem_retire_requests_ring(dev, &dev_priv->render_ring); | 1919 | i915_gem_retire_requests_ring(dev, &dev_priv->render_ring); |
1921 | if (HAS_BSD(dev)) | 1920 | i915_gem_retire_requests_ring(dev, &dev_priv->bsd_ring); |
1922 | i915_gem_retire_requests_ring(dev, &dev_priv->bsd_ring); | ||
1923 | } | 1921 | } |
1924 | 1922 | ||
1925 | static void | 1923 | static void |
@@ -1942,8 +1940,7 @@ i915_gem_retire_work_handler(struct work_struct *work) | |||
1942 | 1940 | ||
1943 | if (!dev_priv->mm.suspended && | 1941 | if (!dev_priv->mm.suspended && |
1944 | (!list_empty(&dev_priv->render_ring.request_list) || | 1942 | (!list_empty(&dev_priv->render_ring.request_list) || |
1945 | (HAS_BSD(dev) && | 1943 | !list_empty(&dev_priv->bsd_ring.request_list))) |
1946 | !list_empty(&dev_priv->bsd_ring.request_list)))) | ||
1947 | queue_delayed_work(dev_priv->wq, &dev_priv->mm.retire_work, HZ); | 1944 | queue_delayed_work(dev_priv->wq, &dev_priv->mm.retire_work, HZ); |
1948 | mutex_unlock(&dev->struct_mutex); | 1945 | mutex_unlock(&dev->struct_mutex); |
1949 | } | 1946 | } |
@@ -2181,8 +2178,7 @@ i915_gpu_idle(struct drm_device *dev) | |||
2181 | 2178 | ||
2182 | lists_empty = (list_empty(&dev_priv->mm.flushing_list) && | 2179 | lists_empty = (list_empty(&dev_priv->mm.flushing_list) && |
2183 | list_empty(&dev_priv->render_ring.active_list) && | 2180 | list_empty(&dev_priv->render_ring.active_list) && |
2184 | (!HAS_BSD(dev) || | 2181 | list_empty(&dev_priv->bsd_ring.active_list)); |
2185 | list_empty(&dev_priv->bsd_ring.active_list))); | ||
2186 | if (lists_empty) | 2182 | if (lists_empty) |
2187 | return 0; | 2183 | return 0; |
2188 | 2184 | ||
@@ -2191,11 +2187,9 @@ i915_gpu_idle(struct drm_device *dev) | |||
2191 | if (ret) | 2187 | if (ret) |
2192 | return ret; | 2188 | return ret; |
2193 | 2189 | ||
2194 | if (HAS_BSD(dev)) { | 2190 | ret = i915_ring_idle(dev, &dev_priv->bsd_ring); |
2195 | ret = i915_ring_idle(dev, &dev_priv->bsd_ring); | 2191 | if (ret) |
2196 | if (ret) | 2192 | return ret; |
2197 | return ret; | ||
2198 | } | ||
2199 | 2193 | ||
2200 | return 0; | 2194 | return 0; |
2201 | } | 2195 | } |
@@ -4349,10 +4343,7 @@ i915_gem_idle(struct drm_device *dev) | |||
4349 | 4343 | ||
4350 | mutex_lock(&dev->struct_mutex); | 4344 | mutex_lock(&dev->struct_mutex); |
4351 | 4345 | ||
4352 | if (dev_priv->mm.suspended || | 4346 | if (dev_priv->mm.suspended) { |
4353 | (dev_priv->render_ring.gem_object == NULL) || | ||
4354 | (HAS_BSD(dev) && | ||
4355 | dev_priv->bsd_ring.gem_object == NULL)) { | ||
4356 | mutex_unlock(&dev->struct_mutex); | 4347 | mutex_unlock(&dev->struct_mutex); |
4357 | return 0; | 4348 | return 0; |
4358 | } | 4349 | } |
@@ -4491,8 +4482,7 @@ i915_gem_cleanup_ringbuffer(struct drm_device *dev) | |||
4491 | drm_i915_private_t *dev_priv = dev->dev_private; | 4482 | drm_i915_private_t *dev_priv = dev->dev_private; |
4492 | 4483 | ||
4493 | intel_cleanup_ring_buffer(dev, &dev_priv->render_ring); | 4484 | intel_cleanup_ring_buffer(dev, &dev_priv->render_ring); |
4494 | if (HAS_BSD(dev)) | 4485 | intel_cleanup_ring_buffer(dev, &dev_priv->bsd_ring); |
4495 | intel_cleanup_ring_buffer(dev, &dev_priv->bsd_ring); | ||
4496 | if (HAS_PIPE_CONTROL(dev)) | 4486 | if (HAS_PIPE_CONTROL(dev)) |
4497 | i915_gem_cleanup_pipe_control(dev); | 4487 | i915_gem_cleanup_pipe_control(dev); |
4498 | } | 4488 | } |
@@ -4522,11 +4512,11 @@ i915_gem_entervt_ioctl(struct drm_device *dev, void *data, | |||
4522 | } | 4512 | } |
4523 | 4513 | ||
4524 | BUG_ON(!list_empty(&dev_priv->render_ring.active_list)); | 4514 | BUG_ON(!list_empty(&dev_priv->render_ring.active_list)); |
4525 | BUG_ON(HAS_BSD(dev) && !list_empty(&dev_priv->bsd_ring.active_list)); | 4515 | BUG_ON(!list_empty(&dev_priv->bsd_ring.active_list)); |
4526 | BUG_ON(!list_empty(&dev_priv->mm.flushing_list)); | 4516 | BUG_ON(!list_empty(&dev_priv->mm.flushing_list)); |
4527 | BUG_ON(!list_empty(&dev_priv->mm.inactive_list)); | 4517 | BUG_ON(!list_empty(&dev_priv->mm.inactive_list)); |
4528 | BUG_ON(!list_empty(&dev_priv->render_ring.request_list)); | 4518 | BUG_ON(!list_empty(&dev_priv->render_ring.request_list)); |
4529 | BUG_ON(HAS_BSD(dev) && !list_empty(&dev_priv->bsd_ring.request_list)); | 4519 | BUG_ON(!list_empty(&dev_priv->bsd_ring.request_list)); |
4530 | mutex_unlock(&dev->struct_mutex); | 4520 | mutex_unlock(&dev->struct_mutex); |
4531 | 4521 | ||
4532 | ret = drm_irq_install(dev); | 4522 | ret = drm_irq_install(dev); |
@@ -4582,10 +4572,8 @@ i915_gem_load(struct drm_device *dev) | |||
4582 | INIT_LIST_HEAD(&dev_priv->mm.deferred_free_list); | 4572 | INIT_LIST_HEAD(&dev_priv->mm.deferred_free_list); |
4583 | INIT_LIST_HEAD(&dev_priv->render_ring.active_list); | 4573 | INIT_LIST_HEAD(&dev_priv->render_ring.active_list); |
4584 | INIT_LIST_HEAD(&dev_priv->render_ring.request_list); | 4574 | INIT_LIST_HEAD(&dev_priv->render_ring.request_list); |
4585 | if (HAS_BSD(dev)) { | 4575 | INIT_LIST_HEAD(&dev_priv->bsd_ring.active_list); |
4586 | INIT_LIST_HEAD(&dev_priv->bsd_ring.active_list); | 4576 | INIT_LIST_HEAD(&dev_priv->bsd_ring.request_list); |
4587 | INIT_LIST_HEAD(&dev_priv->bsd_ring.request_list); | ||
4588 | } | ||
4589 | for (i = 0; i < 16; i++) | 4577 | for (i = 0; i < 16; i++) |
4590 | INIT_LIST_HEAD(&dev_priv->fence_regs[i].lru_list); | 4578 | INIT_LIST_HEAD(&dev_priv->fence_regs[i].lru_list); |
4591 | INIT_DELAYED_WORK(&dev_priv->mm.retire_work, | 4579 | INIT_DELAYED_WORK(&dev_priv->mm.retire_work, |
@@ -4848,9 +4836,8 @@ i915_gpu_is_active(struct drm_device *dev) | |||
4848 | int lists_empty; | 4836 | int lists_empty; |
4849 | 4837 | ||
4850 | lists_empty = list_empty(&dev_priv->mm.flushing_list) && | 4838 | lists_empty = list_empty(&dev_priv->mm.flushing_list) && |
4851 | list_empty(&dev_priv->render_ring.active_list); | 4839 | list_empty(&dev_priv->render_ring.active_list) && |
4852 | if (HAS_BSD(dev)) | 4840 | list_empty(&dev_priv->bsd_ring.active_list); |
4853 | lists_empty &= list_empty(&dev_priv->bsd_ring.active_list); | ||
4854 | 4841 | ||
4855 | return !lists_empty; | 4842 | return !lists_empty; |
4856 | } | 4843 | } |
diff --git a/drivers/gpu/drm/i915/i915_gem_evict.c b/drivers/gpu/drm/i915/i915_gem_evict.c index 3d7fbf32bb1..d2733a1e2bc 100644 --- a/drivers/gpu/drm/i915/i915_gem_evict.c +++ b/drivers/gpu/drm/i915/i915_gem_evict.c | |||
@@ -215,8 +215,7 @@ i915_gem_evict_everything(struct drm_device *dev) | |||
215 | lists_empty = (list_empty(&dev_priv->mm.inactive_list) && | 215 | lists_empty = (list_empty(&dev_priv->mm.inactive_list) && |
216 | list_empty(&dev_priv->mm.flushing_list) && | 216 | list_empty(&dev_priv->mm.flushing_list) && |
217 | list_empty(&dev_priv->render_ring.active_list) && | 217 | list_empty(&dev_priv->render_ring.active_list) && |
218 | (!HAS_BSD(dev) | 218 | list_empty(&dev_priv->bsd_ring.active_list)); |
219 | || list_empty(&dev_priv->bsd_ring.active_list))); | ||
220 | if (lists_empty) | 219 | if (lists_empty) |
221 | return -ENOSPC; | 220 | return -ENOSPC; |
222 | 221 | ||
@@ -234,8 +233,7 @@ i915_gem_evict_everything(struct drm_device *dev) | |||
234 | lists_empty = (list_empty(&dev_priv->mm.inactive_list) && | 233 | lists_empty = (list_empty(&dev_priv->mm.inactive_list) && |
235 | list_empty(&dev_priv->mm.flushing_list) && | 234 | list_empty(&dev_priv->mm.flushing_list) && |
236 | list_empty(&dev_priv->render_ring.active_list) && | 235 | list_empty(&dev_priv->render_ring.active_list) && |
237 | (!HAS_BSD(dev) | 236 | list_empty(&dev_priv->bsd_ring.active_list)); |
238 | || list_empty(&dev_priv->bsd_ring.active_list))); | ||
239 | BUG_ON(!lists_empty); | 237 | BUG_ON(!lists_empty); |
240 | 238 | ||
241 | return 0; | 239 | return 0; |