Commit 92988e60 authored by Tom St Denis's avatar Tom St Denis Committed by Alex Deucher

amdgpu/vce3: Simplify idle and wait for idle code

More LOC reductions in VCE3 code.  This patch simplifies the is_idle and
wait_for_idle logic.
Signed-off-by: default avatarTom St Denis <tom.stdenis@amd.com>
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
parent 1dab5f06
...@@ -535,17 +535,9 @@ static bool vce_v3_0_is_idle(void *handle) ...@@ -535,17 +535,9 @@ static bool vce_v3_0_is_idle(void *handle)
{ {
struct amdgpu_device *adev = (struct amdgpu_device *)handle; struct amdgpu_device *adev = (struct amdgpu_device *)handle;
u32 mask = 0; u32 mask = 0;
int idx;
for (idx = 0; idx < 2; ++idx) {
if (adev->vce.harvest_config & (1 << idx))
continue;
if (idx == 0) mask |= (adev->vce.harvest_config & (1<<0)) ? 0 : SRBM_STATUS2__VCE0_BUSY_MASK;
mask |= SRBM_STATUS2__VCE0_BUSY_MASK; mask |= (adev->vce.harvest_config & (1<<1)) ? 0 : SRBM_STATUS2__VCE1_BUSY_MASK;
else
mask |= SRBM_STATUS2__VCE1_BUSY_MASK;
}
return !(RREG32(mmSRBM_STATUS2) & mask); return !(RREG32(mmSRBM_STATUS2) & mask);
} }
...@@ -554,23 +546,11 @@ static int vce_v3_0_wait_for_idle(void *handle) ...@@ -554,23 +546,11 @@ static int vce_v3_0_wait_for_idle(void *handle)
{ {
unsigned i; unsigned i;
struct amdgpu_device *adev = (struct amdgpu_device *)handle; struct amdgpu_device *adev = (struct amdgpu_device *)handle;
u32 mask = 0;
int idx;
for (idx = 0; idx < 2; ++idx) { for (i = 0; i < adev->usec_timeout; i++)
if (adev->vce.harvest_config & (1 << idx)) if (vce_v3_0_is_idle(handle))
continue;
if (idx == 0)
mask |= SRBM_STATUS2__VCE0_BUSY_MASK;
else
mask |= SRBM_STATUS2__VCE1_BUSY_MASK;
}
for (i = 0; i < adev->usec_timeout; i++) {
if (!(RREG32(mmSRBM_STATUS2) & mask))
return 0; return 0;
}
return -ETIMEDOUT; return -ETIMEDOUT;
} }
......
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