aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaarten Lankhorst <maarten.lankhorst@canonical.com>2014-01-21 07:07:31 -0500
committerMaarten Lankhorst <maarten.lankhorst@canonical.com>2014-09-01 04:16:43 -0400
commitdd7cfd641228abb2669d8d047d5ec377b1835900 (patch)
tree3011650dbd99b204025f65afceb92c40f09da5f9
parent7040138ff85501931138970663a988f48c0666f0 (diff)
drm/ttm: kill fence_lock
No users are left, kill it off! :D Conversion to the reservation api is next on the list, after that the functionality can be restored with rcu. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_bo.c25
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_display.c6
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_gem.c16
-rw-r--r--drivers/gpu/drm/qxl/qxl_cmd.c2
-rw-r--r--drivers/gpu/drm/qxl/qxl_fence.c4
-rw-r--r--drivers/gpu/drm/qxl/qxl_object.h2
-rw-r--r--drivers/gpu/drm/qxl/qxl_release.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_display.c7
-rw-r--r--drivers/gpu/drm/radeon/radeon_object.c2
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo.c75
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo_util.c5
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo_vm.c3
-rw-r--r--drivers/gpu/drm/ttm/ttm_execbuf_util.c2
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c4
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_resource.c16
-rw-r--r--include/drm/ttm/ttm_bo_api.h5
-rw-r--r--include/drm/ttm/ttm_bo_driver.h3
17 files changed, 37 insertions, 142 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
index ed966f51e29b..8d8e5f6340d0 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -1212,9 +1212,7 @@ nouveau_bo_move(struct ttm_buffer_object *bo, bool evict, bool intr,
1212 } 1212 }
1213 1213
1214 /* Fallback to software copy. */ 1214 /* Fallback to software copy. */
1215 spin_lock(&bo->bdev->fence_lock);
1216 ret = ttm_bo_wait(bo, true, intr, no_wait_gpu); 1215 ret = ttm_bo_wait(bo, true, intr, no_wait_gpu);
1217 spin_unlock(&bo->bdev->fence_lock);
1218 if (ret == 0) 1216 if (ret == 0)
1219 ret = ttm_bo_move_memcpy(bo, evict, no_wait_gpu, new_mem); 1217 ret = ttm_bo_move_memcpy(bo, evict, no_wait_gpu, new_mem);
1220 1218
@@ -1457,26 +1455,19 @@ nouveau_ttm_tt_unpopulate(struct ttm_tt *ttm)
1457 ttm_pool_unpopulate(ttm); 1455 ttm_pool_unpopulate(ttm);
1458} 1456}
1459 1457
1458static void
1459nouveau_bo_fence_unref(void **sync_obj)
1460{
1461 nouveau_fence_unref((struct nouveau_fence **)sync_obj);
1462}
1463
1460void 1464void
1461nouveau_bo_fence(struct nouveau_bo *nvbo, struct nouveau_fence *fence) 1465nouveau_bo_fence(struct nouveau_bo *nvbo, struct nouveau_fence *fence)
1462{ 1466{
1463 struct nouveau_fence *new_fence = nouveau_fence_ref(fence);
1464 struct nouveau_fence *old_fence = NULL;
1465
1466 lockdep_assert_held(&nvbo->bo.resv->lock.base); 1467 lockdep_assert_held(&nvbo->bo.resv->lock.base);
1467 1468
1468 spin_lock(&nvbo->bo.bdev->fence_lock); 1469 nouveau_bo_fence_unref(&nvbo->bo.sync_obj);
1469 old_fence = nvbo->bo.sync_obj; 1470 nvbo->bo.sync_obj = nouveau_fence_ref(fence);
1470 nvbo->bo.sync_obj = new_fence;
1471 spin_unlock(&nvbo->bo.bdev->fence_lock);
1472
1473 nouveau_fence_unref(&old_fence);
1474}
1475
1476static void
1477nouveau_bo_fence_unref(void **sync_obj)
1478{
1479 nouveau_fence_unref((struct nouveau_fence **)sync_obj);
1480} 1471}
1481 1472
1482static void * 1473static void *
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
index 54b1f3d8fc7f..e6867b9ebb46 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.c
+++ b/drivers/gpu/drm/nouveau/nouveau_display.c
@@ -722,11 +722,7 @@ nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb,
722 goto fail_unpin; 722 goto fail_unpin;
723 723
724 /* synchronise rendering channel with the kernel's channel */ 724 /* synchronise rendering channel with the kernel's channel */
725 spin_lock(&new_bo->bo.bdev->fence_lock); 725 ret = nouveau_fence_sync(new_bo->bo.sync_obj, chan);
726 fence = nouveau_fence_ref(new_bo->bo.sync_obj);
727 spin_unlock(&new_bo->bo.bdev->fence_lock);
728 ret = nouveau_fence_sync(fence, chan);
729 nouveau_fence_unref(&fence);
730 if (ret) { 726 if (ret) {
731 ttm_bo_unreserve(&new_bo->bo); 727 ttm_bo_unreserve(&new_bo->bo);
732 goto fail_unpin; 728 goto fail_unpin;
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c
index 0054315eb879..1650c0bdb0fc 100644
--- a/drivers/gpu/drm/nouveau/nouveau_gem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
@@ -103,9 +103,7 @@ nouveau_gem_object_unmap(struct nouveau_bo *nvbo, struct nouveau_vma *vma)
103 list_del(&vma->head); 103 list_del(&vma->head);
104 104
105 if (mapped) { 105 if (mapped) {
106 spin_lock(&nvbo->bo.bdev->fence_lock);
107 fence = nouveau_fence_ref(nvbo->bo.sync_obj); 106 fence = nouveau_fence_ref(nvbo->bo.sync_obj);
108 spin_unlock(&nvbo->bo.bdev->fence_lock);
109 } 107 }
110 108
111 if (fence) { 109 if (fence) {
@@ -430,17 +428,11 @@ retry:
430static int 428static int
431validate_sync(struct nouveau_channel *chan, struct nouveau_bo *nvbo) 429validate_sync(struct nouveau_channel *chan, struct nouveau_bo *nvbo)
432{ 430{
433 struct nouveau_fence *fence = NULL; 431 struct nouveau_fence *fence = nvbo->bo.sync_obj;
434 int ret = 0; 432 int ret = 0;
435 433
436 spin_lock(&nvbo->bo.bdev->fence_lock); 434 if (fence)
437 fence = nouveau_fence_ref(nvbo->bo.sync_obj);
438 spin_unlock(&nvbo->bo.bdev->fence_lock);
439
440 if (fence) {
441 ret = nouveau_fence_sync(fence, chan); 435 ret = nouveau_fence_sync(fence, chan);
442 nouveau_fence_unref(&fence);
443 }
444 436
445 return ret; 437 return ret;
446} 438}
@@ -659,9 +651,7 @@ nouveau_gem_pushbuf_reloc_apply(struct nouveau_cli *cli,
659 data |= r->vor; 651 data |= r->vor;
660 } 652 }
661 653
662 spin_lock(&nvbo->bo.bdev->fence_lock);
663 ret = ttm_bo_wait(&nvbo->bo, false, false, false); 654 ret = ttm_bo_wait(&nvbo->bo, false, false, false);
664 spin_unlock(&nvbo->bo.bdev->fence_lock);
665 if (ret) { 655 if (ret) {
666 NV_PRINTK(error, cli, "reloc wait_idle failed: %d\n", ret); 656 NV_PRINTK(error, cli, "reloc wait_idle failed: %d\n", ret);
667 break; 657 break;
@@ -894,11 +884,9 @@ nouveau_gem_ioctl_cpu_prep(struct drm_device *dev, void *data,
894 884
895 ret = ttm_bo_reserve(&nvbo->bo, true, false, false, NULL); 885 ret = ttm_bo_reserve(&nvbo->bo, true, false, false, NULL);
896 if (!ret) { 886 if (!ret) {
897 spin_lock(&nvbo->bo.bdev->fence_lock);
898 ret = ttm_bo_wait(&nvbo->bo, true, true, true); 887 ret = ttm_bo_wait(&nvbo->bo, true, true, true);
899 if (!no_wait && ret) 888 if (!no_wait && ret)
900 fence = nouveau_fence_ref(nvbo->bo.sync_obj); 889 fence = nouveau_fence_ref(nvbo->bo.sync_obj);
901 spin_unlock(&nvbo->bo.bdev->fence_lock);
902 890
903 ttm_bo_unreserve(&nvbo->bo); 891 ttm_bo_unreserve(&nvbo->bo);
904 } 892 }
diff --git a/drivers/gpu/drm/qxl/qxl_cmd.c b/drivers/gpu/drm/qxl/qxl_cmd.c
index eb89653a7a17..45fad7b45486 100644
--- a/drivers/gpu/drm/qxl/qxl_cmd.c
+++ b/drivers/gpu/drm/qxl/qxl_cmd.c
@@ -628,9 +628,7 @@ static int qxl_reap_surf(struct qxl_device *qdev, struct qxl_bo *surf, bool stal
628 if (stall) 628 if (stall)
629 mutex_unlock(&qdev->surf_evict_mutex); 629 mutex_unlock(&qdev->surf_evict_mutex);
630 630
631 spin_lock(&surf->tbo.bdev->fence_lock);
632 ret = ttm_bo_wait(&surf->tbo, true, true, !stall); 631 ret = ttm_bo_wait(&surf->tbo, true, true, !stall);
633 spin_unlock(&surf->tbo.bdev->fence_lock);
634 632
635 if (stall) 633 if (stall)
636 mutex_lock(&qdev->surf_evict_mutex); 634 mutex_lock(&qdev->surf_evict_mutex);
diff --git a/drivers/gpu/drm/qxl/qxl_fence.c b/drivers/gpu/drm/qxl/qxl_fence.c
index ae59e91cfb9a..c7248418117d 100644
--- a/drivers/gpu/drm/qxl/qxl_fence.c
+++ b/drivers/gpu/drm/qxl/qxl_fence.c
@@ -60,9 +60,6 @@ int qxl_fence_remove_release(struct qxl_fence *qfence, uint32_t rel_id)
60{ 60{
61 void *ret; 61 void *ret;