aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/ttm
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/ttm')
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo.c30
-rw-r--r--drivers/gpu/drm/ttm/ttm_lock.c5
2 files changed, 2 insertions, 33 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 4c2299299ab2..555ebb12ace8 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -1718,40 +1718,12 @@ int ttm_bo_wait(struct ttm_buffer_object *bo,
1718} 1718}
1719EXPORT_SYMBOL(ttm_bo_wait); 1719EXPORT_SYMBOL(ttm_bo_wait);
1720 1720
1721void ttm_bo_unblock_reservation(struct ttm_buffer_object *bo)
1722{
1723 atomic_set(&bo->reserved, 0);
1724 wake_up_all(&bo->event_queue);
1725}
1726
1727int ttm_bo_block_reservation(struct ttm_buffer_object *bo, bool interruptible,
1728 bool no_wait)
1729{
1730 int ret;
1731
1732 while (unlikely(atomic_cmpxchg(&bo->reserved, 0, 1) != 0)) {
1733 if (no_wait)
1734 return -EBUSY;
1735 else if (interruptible) {
1736 ret = wait_event_interruptible
1737 (bo->event_queue, atomic_read(&bo->reserved) == 0);
1738 if (unlikely(ret != 0))
1739 return ret;
1740 } else {
1741 wait_event(bo->event_queue,
1742 atomic_read(&bo->reserved) == 0);
1743 }
1744 }
1745 return 0;
1746}
1747
1748int ttm_bo_synccpu_write_grab(struct ttm_buffer_object *bo, bool no_wait) 1721int ttm_bo_synccpu_write_grab(struct ttm_buffer_object *bo, bool no_wait)
1749{ 1722{
1750 int ret = 0; 1723 int ret = 0;
1751 1724
1752 /* 1725 /*
1753 * Using ttm_bo_reserve instead of ttm_bo_block_reservation 1726 * Using ttm_bo_reserve makes sure the lru lists are updated.
1754 * makes sure the lru lists are updated.
1755 */ 1727 */
1756 1728
1757 ret = ttm_bo_reserve(bo, true, no_wait, false, 0); 1729 ret = ttm_bo_reserve(bo, true, no_wait, false, 0);
diff --git a/drivers/gpu/drm/ttm/ttm_lock.c b/drivers/gpu/drm/ttm/ttm_lock.c
index 3d172ef04ee1..de41e55a944a 100644
--- a/drivers/gpu/drm/ttm/ttm_lock.c
+++ b/drivers/gpu/drm/ttm/ttm_lock.c
@@ -204,7 +204,6 @@ static int __ttm_vt_unlock(struct ttm_lock *lock)
204 lock->flags &= ~TTM_VT_LOCK; 204 lock->flags &= ~TTM_VT_LOCK;
205 wake_up_all(&lock->queue); 205 wake_up_all(&lock->queue);
206 spin_unlock(&lock->lock); 206 spin_unlock(&lock->lock);
207 printk(KERN_INFO TTM_PFX "vt unlock.\n");
208 207
209 return ret; 208 return ret;
210} 209}
@@ -265,10 +264,8 @@ int ttm_vt_lock(struct ttm_lock *lock,
265 ttm_lock_type, &ttm_vt_lock_remove, NULL); 264 ttm_lock_type, &ttm_vt_lock_remove, NULL);
266 if (ret) 265 if (ret)
267 (void)__ttm_vt_unlock(lock); 266 (void)__ttm_vt_unlock(lock);
268 else { 267 else
269 lock->vt_holder = tfile; 268 lock->vt_holder = tfile;
270 printk(KERN_INFO TTM_PFX "vt lock.\n");
271 }
272 269
273 return ret; 270 return ret;
274} 271}