aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2013-11-12 19:23:46 -0500
committerBen Skeggs <bskeggs@redhat.com>2013-11-13 23:55:06 -0500
commit5d216f6013d54a6085d5e499407aec6d67e79990 (patch)
tree472870c1928b1533644b8b3e44e5517d0bdc44fa /drivers/gpu
parent0bae1d61c7512580f1622a880d82164c9534fce3 (diff)
drm/nouveau: allow nouveau_fence_ref() to be a noop
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_bo.c13
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_fence.c3
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_gem.c6
3 files changed, 7 insertions, 15 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
index 949ab0cbc4ab..129aceed407d 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -98,12 +98,7 @@ nv10_bo_put_tile_region(struct drm_device *dev, struct nouveau_drm_tile *tile,
98 98
99 if (tile) { 99 if (tile) {
100 spin_lock(&drm->tile.lock); 100 spin_lock(&drm->tile.lock);
101 if (fence) { 101 tile->fence = nouveau_fence_ref(fence);
102 /* Mark it as pending. */
103 tile->fence = fence;
104 nouveau_fence_ref(fence);
105 }
106
107 tile->used = false; 102 tile->used = false;
108 spin_unlock(&drm->tile.lock); 103 spin_unlock(&drm->tile.lock);
109 } 104 }
@@ -1462,14 +1457,12 @@ nouveau_ttm_tt_unpopulate(struct ttm_tt *ttm)
1462void 1457void
1463nouveau_bo_fence(struct nouveau_bo *nvbo, struct nouveau_fence *fence) 1458nouveau_bo_fence(struct nouveau_bo *nvbo, struct nouveau_fence *fence)
1464{ 1459{
1460 struct nouveau_fence *new_fence = nouveau_fence_ref(fence);
1465 struct nouveau_fence *old_fence = NULL; 1461 struct nouveau_fence *old_fence = NULL;
1466 1462
1467 if (likely(fence))
1468 nouveau_fence_ref(fence);
1469
1470 spin_lock(&nvbo->bo.bdev->fence_lock); 1463 spin_lock(&nvbo->bo.bdev->fence_lock);
1471 old_fence = nvbo->bo.sync_obj; 1464 old_fence = nvbo->bo.sync_obj;
1472 nvbo->bo.sync_obj = fence; 1465 nvbo->bo.sync_obj = new_fence;
1473 spin_unlock(&nvbo->bo.bdev->fence_lock); 1466 spin_unlock(&nvbo->bo.bdev->fence_lock);
1474 1467
1475 nouveau_fence_unref(&old_fence); 1468 nouveau_fence_unref(&old_fence);
diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.c b/drivers/gpu/drm/nouveau/nouveau_fence.c
index 34b82711e7c8..40cf52e6d6d2 100644
--- a/drivers/gpu/drm/nouveau/nouveau_fence.c
+++ b/drivers/gpu/drm/nouveau/nouveau_fence.c
@@ -306,7 +306,8 @@ nouveau_fence_unref(struct nouveau_fence **pfence)
306struct nouveau_fence * 306struct nouveau_fence *
307nouveau_fence_ref(struct nouveau_fence *fence) 307nouveau_fence_ref(struct nouveau_fence *fence)
308{ 308{
309 kref_get(&fence->kref); 309 if (fence)
310 kref_get(&fence->kref);
310 return fence; 311 return fence;
311} 312}
312 313
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c
index 418a6177a653..c60f65a815d3 100644
--- a/drivers/gpu/drm/nouveau/nouveau_gem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
@@ -106,8 +106,7 @@ nouveau_gem_object_unmap(struct nouveau_bo *nvbo, struct nouveau_vma *vma)
106 106
107 if (mapped) { 107 if (mapped) {
108 spin_lock(&nvbo->bo.bdev->fence_lock); 108 spin_lock(&nvbo->bo.bdev->fence_lock);
109 if (nvbo->bo.sync_obj) 109 fence = nouveau_fence_ref(nvbo->bo.sync_obj);
110 fence = nouveau_fence_ref(nvbo->bo.sync_obj);
111 spin_unlock(&nvbo->bo.bdev->fence_lock); 110 spin_unlock(&nvbo->bo.bdev->fence_lock);
112 } 111 }
113 112
@@ -438,8 +437,7 @@ validate_sync(struct nouveau_channel *chan, struct nouveau_bo *nvbo)
438 int ret = 0; 437 int ret = 0;
439 438
440 spin_lock(&nvbo->bo.bdev->fence_lock); 439 spin_lock(&nvbo->bo.bdev->fence_lock);
441 if (nvbo->bo.sync_obj) 440 fence = nouveau_fence_ref(nvbo->bo.sync_obj);
442 fence = nouveau_fence_ref(nvbo->bo.sync_obj);
443 spin_unlock(&nvbo->bo.bdev->fence_lock); 441 spin_unlock(&nvbo->bo.bdev->fence_lock);
444 442
445 if (fence) { 443 if (fence) {