[PATCH 18/22] drm/amdgpu: Correct sdma_v4 get_wptr

Monk Liu Monk.Liu at amd.com
Mon Feb 26 05:18:16 UTC 2018


From: Emily Deng <Emily.Deng at amd.com>

the original method will change the wptr value in wb.

Change-Id: I984fabca35d9dcf1f5fa8ef7779b2afb7f7d7370
Signed-off-by: Emily Deng <Emily.Deng at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
index 3d5385d..8c6e408 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
@@ -240,13 +240,14 @@ static uint64_t sdma_v4_0_ring_get_wptr(struct amdgpu_ring *ring)
 	struct amdgpu_device *adev = ring->adev;
 	u64 *wptr = NULL;
 	uint64_t local_wptr = 0;
-
+	u64 tmp = 0;
 	if (ring->use_doorbell) {
 		/* XXX check if swapping is necessary on BE */
 		wptr = ((u64 *)&adev->wb.wb[ring->wptr_offs]);
 		DRM_DEBUG("wptr/doorbell before shift == 0x%016llx\n", *wptr);
-		*wptr = (*wptr) >> 2;
-		DRM_DEBUG("wptr/doorbell after shift == 0x%016llx\n", *wptr);
+		tmp = (*wptr) >> 2;
+		DRM_DEBUG("wptr/doorbell after shift == 0x%016llx\n", tmp);
+		return tmp;
 	} else {
 		u32 lowbit, highbit;
 		int me = (ring == &adev->sdma.instance[0].ring) ? 0 : 1;
@@ -260,9 +261,8 @@ static uint64_t sdma_v4_0_ring_get_wptr(struct amdgpu_ring *ring)
 		*wptr = highbit;
 		*wptr = (*wptr) << 32;
 		*wptr |= lowbit;
+		return *wptr;
 	}
-
-	return *wptr;
 }
 
 /**
-- 
2.7.4



More information about the amd-gfx mailing list