Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dd7cfd64 authored by Maarten Lankhorst's avatar Maarten Lankhorst
Browse files

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: default avatarMaarten Lankhorst <maarten.lankhorst@canonical.com>
parent 7040138f
Loading
Loading
Loading
Loading
+8 −17
Original line number Diff line number Diff line
@@ -1212,9 +1212,7 @@ nouveau_bo_move(struct ttm_buffer_object *bo, bool evict, bool intr,
	}

	/* Fallback to software copy. */
	spin_lock(&bo->bdev->fence_lock);
	ret = ttm_bo_wait(bo, true, intr, no_wait_gpu);
	spin_unlock(&bo->bdev->fence_lock);
	if (ret == 0)
		ret = ttm_bo_move_memcpy(bo, evict, no_wait_gpu, new_mem);

@@ -1457,26 +1455,19 @@ nouveau_ttm_tt_unpopulate(struct ttm_tt *ttm)
	ttm_pool_unpopulate(ttm);
}

static void
nouveau_bo_fence_unref(void **sync_obj)
{
	nouveau_fence_unref((struct nouveau_fence **)sync_obj);
}

void
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;

	lockdep_assert_held(&nvbo->bo.resv->lock.base);

	spin_lock(&nvbo->bo.bdev->fence_lock);
	old_fence = nvbo->bo.sync_obj;
	nvbo->bo.sync_obj = new_fence;
	spin_unlock(&nvbo->bo.bdev->fence_lock);

	nouveau_fence_unref(&old_fence);
}

static void
nouveau_bo_fence_unref(void **sync_obj)
{
	nouveau_fence_unref((struct nouveau_fence **)sync_obj);
	nouveau_bo_fence_unref(&nvbo->bo.sync_obj);
	nvbo->bo.sync_obj = nouveau_fence_ref(fence);
}

static void *
+1 −5
Original line number Diff line number Diff line
@@ -722,11 +722,7 @@ nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb,
		goto fail_unpin;

	/* synchronise rendering channel with the kernel's channel */
	spin_lock(&new_bo->bo.bdev->fence_lock);
	fence = nouveau_fence_ref(new_bo->bo.sync_obj);
	spin_unlock(&new_bo->bo.bdev->fence_lock);
	ret = nouveau_fence_sync(fence, chan);
	nouveau_fence_unref(&fence);
	ret = nouveau_fence_sync(new_bo->bo.sync_obj, chan);
	if (ret) {
		ttm_bo_unreserve(&new_bo->bo);
		goto fail_unpin;
+2 −14
Original line number Diff line number Diff line
@@ -103,9 +103,7 @@ nouveau_gem_object_unmap(struct nouveau_bo *nvbo, struct nouveau_vma *vma)
	list_del(&vma->head);

	if (mapped) {
		spin_lock(&nvbo->bo.bdev->fence_lock);
		fence = nouveau_fence_ref(nvbo->bo.sync_obj);
		spin_unlock(&nvbo->bo.bdev->fence_lock);
	}

	if (fence) {
@@ -430,17 +428,11 @@ retry:
static int
validate_sync(struct nouveau_channel *chan, struct nouveau_bo *nvbo)
{
	struct nouveau_fence *fence = NULL;
	struct nouveau_fence *fence = nvbo->bo.sync_obj;
	int ret = 0;

	spin_lock(&nvbo->bo.bdev->fence_lock);
	fence = nouveau_fence_ref(nvbo->bo.sync_obj);
	spin_unlock(&nvbo->bo.bdev->fence_lock);

	if (fence) {
	if (fence)
		ret = nouveau_fence_sync(fence, chan);
		nouveau_fence_unref(&fence);
	}

	return ret;
}
@@ -659,9 +651,7 @@ nouveau_gem_pushbuf_reloc_apply(struct nouveau_cli *cli,
				data |= r->vor;
		}

		spin_lock(&nvbo->bo.bdev->fence_lock);
		ret = ttm_bo_wait(&nvbo->bo, false, false, false);
		spin_unlock(&nvbo->bo.bdev->fence_lock);
		if (ret) {
			NV_PRINTK(error, cli, "reloc wait_idle failed: %d\n", ret);
			break;
@@ -894,11 +884,9 @@ nouveau_gem_ioctl_cpu_prep(struct drm_device *dev, void *data,

	ret = ttm_bo_reserve(&nvbo->bo, true, false, false, NULL);
	if (!ret) {
		spin_lock(&nvbo->bo.bdev->fence_lock);
		ret = ttm_bo_wait(&nvbo->bo, true, true, true);
		if (!no_wait && ret)
			fence = nouveau_fence_ref(nvbo->bo.sync_obj);
		spin_unlock(&nvbo->bo.bdev->fence_lock);

		ttm_bo_unreserve(&nvbo->bo);
	}
+0 −2
Original line number Diff line number Diff line
@@ -628,9 +628,7 @@ static int qxl_reap_surf(struct qxl_device *qdev, struct qxl_bo *surf, bool stal
	if (stall)
		mutex_unlock(&qdev->surf_evict_mutex);

	spin_lock(&surf->tbo.bdev->fence_lock);
	ret = ttm_bo_wait(&surf->tbo, true, true, !stall);
	spin_unlock(&surf->tbo.bdev->fence_lock);

	if (stall)
		mutex_lock(&qdev->surf_evict_mutex);
+0 −4
Original line number Diff line number Diff line
@@ -60,9 +60,6 @@ int qxl_fence_remove_release(struct qxl_fence *qfence, uint32_t rel_id)
{
	void *ret;
	int retval = 0;
	struct qxl_bo *bo = container_of(qfence, struct qxl_bo, fence);

	spin_lock(&bo->tbo.bdev->fence_lock);

	ret = radix_tree_delete(&qfence->tree, rel_id);
	if (ret == qfence)
@@ -71,7 +68,6 @@ int qxl_fence_remove_release(struct qxl_fence *qfence, uint32_t rel_id)
		DRM_DEBUG("didn't find fence in radix tree for %d\n", rel_id);
		retval = -ENOENT;
	}
	spin_unlock(&bo->tbo.bdev->fence_lock);
	return retval;
}

Loading