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:29 -0500
committerDave Airlie <airlied@redhat.com>2010-11-21 22:25:18 -0500
commit702adba22433c175e8429a47760f35ca16caf1cd (patch)
treea9c6a1ad8ebaf9970a87b7047357b6d7232b70e6 /drivers/gpu/drm/ttm/ttm_execbuf_util.c
parent96726fe50feae74812a2ccf5d5da23cb01c0a413 (diff)
drm/ttm/radeon/nouveau: Kill the bo lock in favour of a bo device fence_lock
The bo lock used only to protect the bo sync object members, and since it is a per bo lock, fencing a buffer list will see a lot of locks and unlocks. Replace it with a per-device lock that protects the sync object members on *all* bos. Reading and setting these members will always be very quick, so the risc of heavy lock contention is microscopic. Note that waiting for sync objects will always take place outside of this lock. The bo device fence lock will eventually be replaced with a seqlock / rcu mechanism so we can determine that a bo is idle under a rcu / read seqlock. However this change will allow us to batch fencing and unreserving of buffers with a minimal amount of locking. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Jerome Glisse <j.glisse@gmail.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.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_execbuf_util.c b/drivers/gpu/drm/ttm/ttm_execbuf_util.c
index 7dcc6470e2f5..c3a2100bace6 100644
--- a/drivers/gpu/drm/ttm/ttm_execbuf_util.c
+++ b/drivers/gpu/drm/ttm/ttm_execbuf_util.c
@@ -203,14 +203,15 @@ void ttm_eu_fence_buffer_objects(struct list_head *list, void *sync_obj)
203 203
204 list_for_each_entry(entry, list, head) { 204 list_for_each_entry(entry, list, head) {
205 struct ttm_buffer_object *bo = entry->bo; 205 struct ttm_buffer_object *bo = entry->bo;
206 struct ttm_bo_driver *driver = bo->bdev->driver; 206 struct ttm_bo_device *bdev = bo->bdev;
207 struct ttm_bo_driver *driver = bdev->driver;
207 void *old_sync_obj; 208 void *old_sync_obj;
208 209
209 spin_lock(&bo->lock); 210 spin_lock(&bdev->fence_lock);
210 old_sync_obj = bo->sync_obj; 211 old_sync_obj = bo->sync_obj;
211 bo->sync_obj = driver->sync_obj_ref(sync_obj); 212 bo->sync_obj = driver->sync_obj_ref(sync_obj);
212 bo->sync_obj_arg = entry->new_sync_obj_arg; 213 bo->sync_obj_arg = entry->new_sync_obj_arg;
213 spin_unlock(&bo->lock); 214 spin_unlock(&bdev->fence_lock);
214 ttm_bo_unreserve(bo); 215 ttm_bo_unreserve(bo);
215 entry->reserved = false; 216 entry->reserved = false;
216 if (old_sync_obj) 217 if (old_sync_obj)