[PATCH 3/3] drm/amdgpu/vpe: fix insert_nop ops

Zhang, Yifan Yifan1.Zhang at amd.com
Sat Oct 7 03:40:03 UTC 2023


[AMD Official Use Only - General]

This series is:

Reviewed-by: Yifan Zhang <yifan1.zhang at amd.com>

Best Regards,
Yifan

-----Original Message-----
From: Yu, Lang <Lang.Yu at amd.com>
Sent: Saturday, October 7, 2023 11:24 AM
To: Deucher, Alexander <Alexander.Deucher at amd.com>; Zhang, Yifan <Yifan1.Zhang at amd.com>; Chiu, Solomon <Solomon.Chiu at amd.com>
Cc: amd-gfx at lists.freedesktop.org; Yu, Lang <Lang.Yu at amd.com>
Subject: [PATCH 3/3] drm/amdgpu/vpe: fix insert_nop ops

Avoid infinite loop when count is 0.
This is missed in rebase.

Signed-off-by: Lang Yu <Lang.Yu at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c
index bb74478098bb..e81579708e96 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c
@@ -240,11 +240,12 @@ static void vpe_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)  {
        int i;

-       amdgpu_ring_write(ring, ring->funcs->nop |
+       for (i = 0; i < count; i++)
+               if (i == 0)
+                       amdgpu_ring_write(ring, ring->funcs->nop |
                                VPE_CMD_NOP_HEADER_COUNT(count - 1));
-
-       for (i = 0; i < count - 1; i++)
-               amdgpu_ring_write(ring, 0);
+               else
+                       amdgpu_ring_write(ring, ring->funcs->nop);
 }

 static uint64_t vpe_get_csa_mc_addr(struct amdgpu_ring *ring, uint32_t vmid)
--
2.25.1



More information about the amd-gfx mailing list