From 8221d706f4f39337e28644f333aefbca41ac0d18 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Christian=20K=C3=B6nig?= Date: Wed, 2 Sep 2015 12:14:57 -0400 Subject: [PATCH] drm/amdgpu: partially revert "modify amdgpu_fence_wait_any() to amdgpu_fence_wait_multiple()" v2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit That isn't used any more. v2: rebase Signed-off-by: Christian König Reviewed-by: Chunming Zhou Signed-off-by: Alex Deucher --- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 11 +++--- drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 44 +++++------------------ drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c | 4 +-- 3 files changed, 16 insertions(+), 43 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index c6812f2e198e..b66938dbb5cf 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h @@ -440,12 +440,11 @@ int amdgpu_fence_wait_next(struct amdgpu_ring *ring); int amdgpu_fence_wait_empty(struct amdgpu_ring *ring); unsigned amdgpu_fence_count_emitted(struct amdgpu_ring *ring); -signed long amdgpu_fence_wait_multiple(struct amdgpu_device *adev, - struct fence **array, - uint32_t count, - bool wait_all, - bool intr, - signed long t); +signed long amdgpu_fence_wait_any(struct amdgpu_device *adev, + struct fence **array, + uint32_t count, + bool intr, + signed long t); struct amdgpu_fence *amdgpu_fence_ref(struct amdgpu_fence *fence); void amdgpu_fence_unref(struct amdgpu_fence **fence); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c index f446bf2fedc9..1be2bd6d07ea 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c @@ -851,22 +851,6 @@ static bool amdgpu_test_signaled_any(struct fence **fences, uint32_t count) return false; } -static bool amdgpu_test_signaled_all(struct fence **fences, uint32_t count) -{ - int idx; - struct fence *fence; - - for (idx = 0; idx < count; ++idx) { - fence = fences[idx]; - if (fence) { - if (!test_bit(FENCE_FLAG_SIGNALED_BIT, &fence->flags)) - return false; - } - } - - return true; -} - struct amdgpu_wait_cb { struct fence_cb base; struct task_struct *task; @@ -885,7 +869,7 @@ static signed long amdgpu_fence_default_wait(struct fence *f, bool intr, struct amdgpu_fence *fence = to_amdgpu_fence(f); struct amdgpu_device *adev = fence->ring->adev; - return amdgpu_fence_wait_multiple(adev, &f, 1, false, intr, t); + return amdgpu_fence_wait_any(adev, &f, 1, intr, t); } /** @@ -894,23 +878,18 @@ static signed long amdgpu_fence_default_wait(struct fence *f, bool intr, * @adev: amdgpu device * @array: the fence array with amdgpu fence pointer * @count: the number of the fence array - * @wait_all: the flag of wait all(true) or wait any(false) * @intr: when sleep, set the current task interruptable or not * @t: timeout to wait * - * If wait_all is true, it will return when all fences are signaled or timeout. - * If wait_all is false, it will return when any fence is signaled or timeout. + * It will return when any fence is signaled or timeout. */ -signed long amdgpu_fence_wait_multiple(struct amdgpu_device *adev, - struct fence **array, - uint32_t count, - bool wait_all, - bool intr, - signed long t) -{ - long idx = 0; +signed long amdgpu_fence_wait_any(struct amdgpu_device *adev, + struct fence **array, uint32_t count, + bool intr, signed long t) +{ struct amdgpu_wait_cb *cb; struct fence *fence; + unsigned idx; BUG_ON(!array); @@ -927,10 +906,7 @@ signed long amdgpu_fence_wait_multiple(struct amdgpu_device *adev, if (fence_add_callback(fence, &cb[idx].base, amdgpu_fence_wait_cb)) { /* The fence is already signaled */ - if (wait_all) - continue; - else - goto fence_rm_cb; + goto fence_rm_cb; } } } @@ -945,9 +921,7 @@ signed long amdgpu_fence_wait_multiple(struct amdgpu_device *adev, * amdgpu_test_signaled_any must be called after * set_current_state to prevent a race with wake_up_process */ - if (!wait_all && amdgpu_test_signaled_any(array, count)) - break; - if (wait_all && amdgpu_test_signaled_all(array, count)) + if (amdgpu_test_signaled_any(array, count)) break; if (adev->needs_reset) { diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c index b92525329d6c..74dad270362c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c @@ -367,8 +367,8 @@ int amdgpu_sa_bo_new(struct amdgpu_device *adev, } while (amdgpu_sa_bo_next_hole(sa_manager, fences, tries)); spin_unlock(&sa_manager->wq.lock); - t = amdgpu_fence_wait_multiple(adev, fences, AMDGPU_MAX_RINGS, false, false, - MAX_SCHEDULE_TIMEOUT); + t = amdgpu_fence_wait_any(adev, fences, AMDGPU_MAX_RINGS, + false, MAX_SCHEDULE_TIMEOUT); r = (t > 0) ? 0 : t; spin_lock(&sa_manager->wq.lock); /* if we have nothing to wait for block */ -- 2.34.1