Commit 5d216f60 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau: allow nouveau_fence_ref() to be a noop

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 0bae1d61
...@@ -98,12 +98,7 @@ nv10_bo_put_tile_region(struct drm_device *dev, struct nouveau_drm_tile *tile, ...@@ -98,12 +98,7 @@ nv10_bo_put_tile_region(struct drm_device *dev, struct nouveau_drm_tile *tile,
if (tile) { if (tile) {
spin_lock(&drm->tile.lock); spin_lock(&drm->tile.lock);
if (fence) { tile->fence = nouveau_fence_ref(fence);
/* Mark it as pending. */
tile->fence = fence;
nouveau_fence_ref(fence);
}
tile->used = false; tile->used = false;
spin_unlock(&drm->tile.lock); spin_unlock(&drm->tile.lock);
} }
...@@ -1462,14 +1457,12 @@ nouveau_ttm_tt_unpopulate(struct ttm_tt *ttm) ...@@ -1462,14 +1457,12 @@ nouveau_ttm_tt_unpopulate(struct ttm_tt *ttm)
void void
nouveau_bo_fence(struct nouveau_bo *nvbo, struct nouveau_fence *fence) nouveau_bo_fence(struct nouveau_bo *nvbo, struct nouveau_fence *fence)
{ {
struct nouveau_fence *new_fence = nouveau_fence_ref(fence);
struct nouveau_fence *old_fence = NULL; struct nouveau_fence *old_fence = NULL;
if (likely(fence))
nouveau_fence_ref(fence);
spin_lock(&nvbo->bo.bdev->fence_lock); spin_lock(&nvbo->bo.bdev->fence_lock);
old_fence = nvbo->bo.sync_obj; old_fence = nvbo->bo.sync_obj;
nvbo->bo.sync_obj = fence; nvbo->bo.sync_obj = new_fence;
spin_unlock(&nvbo->bo.bdev->fence_lock); spin_unlock(&nvbo->bo.bdev->fence_lock);
nouveau_fence_unref(&old_fence); nouveau_fence_unref(&old_fence);
......
...@@ -306,7 +306,8 @@ nouveau_fence_unref(struct nouveau_fence **pfence) ...@@ -306,7 +306,8 @@ nouveau_fence_unref(struct nouveau_fence **pfence)
struct nouveau_fence * struct nouveau_fence *
nouveau_fence_ref(struct nouveau_fence *fence) nouveau_fence_ref(struct nouveau_fence *fence)
{ {
kref_get(&fence->kref); if (fence)
kref_get(&fence->kref);
return fence; return fence;
} }
......
...@@ -106,8 +106,7 @@ nouveau_gem_object_unmap(struct nouveau_bo *nvbo, struct nouveau_vma *vma) ...@@ -106,8 +106,7 @@ nouveau_gem_object_unmap(struct nouveau_bo *nvbo, struct nouveau_vma *vma)
if (mapped) { if (mapped) {
spin_lock(&nvbo->bo.bdev->fence_lock); spin_lock(&nvbo->bo.bdev->fence_lock);
if (nvbo->bo.sync_obj) fence = nouveau_fence_ref(nvbo->bo.sync_obj);
fence = nouveau_fence_ref(nvbo->bo.sync_obj);
spin_unlock(&nvbo->bo.bdev->fence_lock); spin_unlock(&nvbo->bo.bdev->fence_lock);
} }
...@@ -438,8 +437,7 @@ validate_sync(struct nouveau_channel *chan, struct nouveau_bo *nvbo) ...@@ -438,8 +437,7 @@ validate_sync(struct nouveau_channel *chan, struct nouveau_bo *nvbo)
int ret = 0; int ret = 0;
spin_lock(&nvbo->bo.bdev->fence_lock); spin_lock(&nvbo->bo.bdev->fence_lock);
if (nvbo->bo.sync_obj) fence = nouveau_fence_ref(nvbo->bo.sync_obj);
fence = nouveau_fence_ref(nvbo->bo.sync_obj);
spin_unlock(&nvbo->bo.bdev->fence_lock); spin_unlock(&nvbo->bo.bdev->fence_lock);
if (fence) { if (fence) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment