diff options
author | Tom St Denis <tom.stdenis@amd.com> | 2016-09-02 15:19:15 +0300 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2016-09-02 18:33:24 +0300 |
commit | 832c6ef765a6943edeb30db25f33c0a56560c532 (patch) | |
tree | a7ba685e3e6782054b72db53b040473357271f78 | |
parent | e7706b422c087da851448c420c90821622ee1721 (diff) | |
download | linux-832c6ef765a6943edeb30db25f33c0a56560c532.tar.xz |
drm/amd/amdgpu: Merge get_wptr functions in gfx6
Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c index d090f26bde4e..a6b76170b9c5 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c @@ -1660,11 +1660,18 @@ static u32 gfx_v6_0_ring_get_rptr(struct amdgpu_ring *ring) return ring->adev->wb.wb[ring->rptr_offs]; } -static u32 gfx_v6_0_ring_get_wptr_gfx(struct amdgpu_ring *ring) +static u32 gfx_v6_0_ring_get_wptr(struct amdgpu_ring *ring) { struct amdgpu_device *adev = ring->adev; - return RREG32(CP_RB0_WPTR); + if (ring == &adev->gfx.gfx_ring[0]) + return RREG32(CP_RB0_WPTR); + else if (ring == &adev->gfx.compute_ring[0]) + return RREG32(CP_RB1_WPTR); + else if (ring == &adev->gfx.compute_ring[1]) + return RREG32(CP_RB2_WPTR); + else + BUG(); } static void gfx_v6_0_ring_set_wptr_gfx(struct amdgpu_ring *ring) @@ -1675,22 +1682,6 @@ static void gfx_v6_0_ring_set_wptr_gfx(struct amdgpu_ring *ring) (void)RREG32(CP_RB0_WPTR); } -static u32 gfx_v6_0_ring_get_wptr_compute(struct amdgpu_ring *ring) -{ - struct amdgpu_device *adev = ring->adev; - u32 wptr; - - if (ring == &adev->gfx.compute_ring[0]) { - wptr = RREG32(CP_RB1_WPTR); - } else if (ring == &adev->gfx.compute_ring[1]) { - wptr = RREG32(CP_RB2_WPTR); - } else { - BUG(); - } - - return wptr; -} - static void gfx_v6_0_ring_set_wptr_compute(struct amdgpu_ring *ring) { struct amdgpu_device *adev = ring->adev; @@ -3125,7 +3116,7 @@ const struct amd_ip_funcs gfx_v6_0_ip_funcs = { static const struct amdgpu_ring_funcs gfx_v6_0_ring_funcs_gfx = { .get_rptr = gfx_v6_0_ring_get_rptr, - .get_wptr = gfx_v6_0_ring_get_wptr_gfx, + .get_wptr = gfx_v6_0_ring_get_wptr, .set_wptr = gfx_v6_0_ring_set_wptr_gfx, .parse_cs = NULL, .emit_ib = gfx_v6_0_ring_emit_ib_gfx, @@ -3142,7 +3133,7 @@ static const struct amdgpu_ring_funcs gfx_v6_0_ring_funcs_gfx = { static const struct amdgpu_ring_funcs gfx_v6_0_ring_funcs_compute = { .get_rptr = gfx_v6_0_ring_get_rptr, - .get_wptr = gfx_v6_0_ring_get_wptr_compute, + .get_wptr = gfx_v6_0_ring_get_wptr, .set_wptr = gfx_v6_0_ring_set_wptr_compute, .parse_cs = NULL, .emit_ib = gfx_v6_0_ring_emit_ib_compute, |