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

Commit f849c6d6 authored by Christian König's avatar Christian König Committed by Alex Deucher
Browse files

drm/ttm: simplify ttm_bo_wait



As far as I can see no need for a custom implementation any more.

Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 5bc73067
Loading
Loading
Loading
Loading
+4 −33
Original line number Original line Diff line number Diff line
@@ -1546,46 +1546,17 @@ EXPORT_SYMBOL(ttm_bo_unmap_virtual);
int ttm_bo_wait(struct ttm_buffer_object *bo,
int ttm_bo_wait(struct ttm_buffer_object *bo,
		bool interruptible, bool no_wait)
		bool interruptible, bool no_wait)
{
{
	struct reservation_object_list *fobj;
	long timeout = no_wait ? 0 : 15 * HZ;
	struct reservation_object *resv;
	struct fence *excl;
	long timeout = 15 * HZ;
	int i;

	resv = bo->resv;
	fobj = reservation_object_get_list(resv);
	excl = reservation_object_get_excl(resv);
	if (excl) {
		if (!fence_is_signaled(excl)) {
			if (no_wait)
				return -EBUSY;

			timeout = fence_wait_timeout(excl,
						     interruptible, timeout);
		}
	}


	for (i = 0; fobj && timeout > 0 && i < fobj->shared_count; ++i) {
	timeout = reservation_object_wait_timeout_rcu(bo->resv, true,
		struct fence *fence;
		fence = rcu_dereference_protected(fobj->shared[i],
						reservation_object_held(resv));

		if (!fence_is_signaled(fence)) {
			if (no_wait)
				return -EBUSY;

			timeout = fence_wait_timeout(fence,
						      interruptible, timeout);
						      interruptible, timeout);
		}
	}

	if (timeout < 0)
	if (timeout < 0)
		return timeout;
		return timeout;


	if (timeout == 0)
	if (timeout == 0)
		return -EBUSY;
		return -EBUSY;


	reservation_object_add_excl_fence(resv, NULL);
	reservation_object_add_excl_fence(bo->resv, NULL);
	return 0;
	return 0;
}
}
EXPORT_SYMBOL(ttm_bo_wait);
EXPORT_SYMBOL(ttm_bo_wait);