[6/6] drm/amd/amdgpu: Merge get_wptr functions in gfx8

Submitted by Tom St Denis on Sept. 2, 2016, 12:49 p.m.

Details

Message ID 20160902124908.18360-7-tom.stdenis@amd.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Tom St Denis Sept. 2, 2016, 12:49 p.m.
Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index 02056762ea06..d8b17745bc19 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
@@ -5840,12 +5840,12 @@  static u32 gfx_v8_0_ring_get_rptr(struct amdgpu_ring *ring)
 	return ring->adev->wb.wb[ring->rptr_offs];
 }
 
-static u32 gfx_v8_0_ring_get_wptr_gfx(struct amdgpu_ring *ring)
+static u32 gfx_v8_0_ring_get_wptr(struct amdgpu_ring *ring)
 {
 	struct amdgpu_device *adev = ring->adev;
 
-	if (ring->use_doorbell)
-		/* XXX check if swapping is necessary on BE */
+	if (ring->use_doorbell ||
+	    ring != &adev->gfx.gfx_ring[0])
 		return ring->adev->wb.wb[ring->wptr_offs];
 	else
 		return RREG32(mmCP_RB0_WPTR);
@@ -6051,11 +6051,6 @@  static void gfx_v8_0_ring_emit_vm_flush(struct amdgpu_ring *ring,
 	}
 }
 
-static u32 gfx_v8_0_ring_get_wptr_compute(struct amdgpu_ring *ring)
-{
-	return ring->adev->wb.wb[ring->wptr_offs];
-}
-
 static void gfx_v8_0_ring_set_wptr_compute(struct amdgpu_ring *ring)
 {
 	struct amdgpu_device *adev = ring->adev;
@@ -6259,7 +6254,7 @@  const struct amd_ip_funcs gfx_v8_0_ip_funcs = {
 
 static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_gfx = {
 	.get_rptr = gfx_v8_0_ring_get_rptr,
-	.get_wptr = gfx_v8_0_ring_get_wptr_gfx,
+	.get_wptr = gfx_v8_0_ring_get_wptr,
 	.set_wptr = gfx_v8_0_ring_set_wptr_gfx,
 	.parse_cs = NULL,
 	.emit_ib = gfx_v8_0_ring_emit_ib_gfx,
@@ -6278,7 +6273,7 @@  static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_gfx = {
 
 static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_compute = {
 	.get_rptr = gfx_v8_0_ring_get_rptr,
-	.get_wptr = gfx_v8_0_ring_get_wptr_compute,
+	.get_wptr = gfx_v8_0_ring_get_wptr,
 	.set_wptr = gfx_v8_0_ring_set_wptr_compute,
 	.parse_cs = NULL,
 	.emit_ib = gfx_v8_0_ring_emit_ib_compute,