aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/ttm/ttm_execbuf_util.c
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom@vmware.com>2010-11-17 07:28:30 -0500
committerDave Airlie <airlied@redhat.com>2010-11-21 22:25:20 -0500
commit95762c2b34069bf4adb7929969f1f5f5fc8a38df (patch)
tree5c792e65dbdb4e7cb2c04b5a8058a929e8acc23d /drivers/gpu/drm/ttm/ttm_execbuf_util.c
parent702adba22433c175e8429a47760f35ca16caf1cd (diff)
drm/ttm: Improved fencing of buffer object lists
Drastically reduce the number of spin lock / unlock operations by performing unreserving and fencing under global locks. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Jerome Glisse <j.glisse@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/ttm/ttm_execbuf_util.c')
-rw-r--r--drivers/gpu/drm/ttm/ttm_execbuf_util.c36
1 files changed, 25 insertions, 11 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_execbuf_util.c b/drivers/gpu/drm/ttm/ttm_execbuf_util.c
index c3a2100bace6..b6da65cc502a 100644
--- a/drivers/gpu/drm/ttm/ttm_execbuf_util.c
+++ b/drivers/gpu/drm/ttm/ttm_execbuf_util.c
@@ -200,22 +200,36 @@ EXPORT_SYMBOL(ttm_eu_reserve_buffers);
200void ttm_eu_fence_buffer_objects(struct list_head *list, void *sync_obj) 200void ttm_eu_fence_buffer_objects(struct list_head *list, void *sync_obj)
201{ 201{
202 struct ttm_validate_buffer *entry; 202 struct ttm_validate_buffer *entry;
203 struct ttm_buffer_object *bo;
204 struct ttm_bo_global *glob;
205 struct ttm_bo_device *bdev;
206 struct ttm_bo_driver *driver;
203 207
204 list_for_each_entry(entry, list, head) { 208 if (list_empty(list))
205 struct ttm_buffer_object *bo = entry->bo; 209 return;
206 struct ttm_bo_device *bdev = bo->bdev; 210
207 struct ttm_bo_driver *driver = bdev->driver; 211 bo = list_first_entry(list, struct ttm_validate_buffer, head)->bo;
208 void *old_sync_obj; 212 bdev = bo->bdev;
213 driver = bdev->driver;
214 glob = bo->glob;
209 215
210 spin_lock(&bdev->fence_lock); 216 spin_lock(&bdev->fence_lock);
211 old_sync_obj = bo->sync_obj; 217 spin_lock(&glob->lru_lock);
218
219 list_for_each_entry(entry, list, head) {
220 bo = entry->bo;
221 entry->old_sync_obj = bo->sync_obj;
212 bo->sync_obj = driver->sync_obj_ref(sync_obj); 222 bo->sync_obj = driver->sync_obj_ref(sync_obj);
213 bo->sync_obj_arg = entry->new_sync_obj_arg; 223 bo->sync_obj_arg = entry->new_sync_obj_arg;
214 spin_unlock(&bdev->fence_lock); 224 ttm_bo_unreserve_locked(bo);
215 ttm_bo_unreserve(bo);
216 entry->reserved = false; 225 entry->reserved = false;
217 if (old_sync_obj) 226 }
218 driver->sync_obj_unref(&old_sync_obj); 227 spin_unlock(&glob->lru_lock);
228 spin_unlock(&bdev->fence_lock);
229
230 list_for_each_entry(entry, list, head) {
231 if (entry->old_sync_obj)
232 driver->sync_obj_unref(&entry->old_sync_obj);
219 } 233 }
220} 234}
221EXPORT_SYMBOL(ttm_eu_fence_buffer_objects); 235EXPORT_SYMBOL(ttm_eu_fence_buffer_objects);