[PATCH] drm/amdgpu: clean up the count calculation for nop

Sunil Khatri sunil.khatri at amd.com
Wed Jul 31 09:35:36 UTC 2024


clean up the calculation for nops count before
commit in the ring.

Signed-off-by: Sunil Khatri <sunil.khatri at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
index 0d72d2cbb64b..2c8218332c65 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
@@ -142,9 +142,8 @@ void amdgpu_ring_commit(struct amdgpu_ring *ring)
 	uint32_t count;
 
 	/* We pad to match fetch size */
-	count = ring->funcs->align_mask + 1 -
-		(ring->wptr & ring->funcs->align_mask);
-	count %= ring->funcs->align_mask + 1;
+	count = ring->funcs->align_mask -
+		((ring->wptr + ring->funcs->align_mask) & ring->funcs->align_mask);
 
 	if (count != 0)
 		ring->funcs->insert_nop(ring, count);
-- 
2.34.1



More information about the amd-gfx mailing list