答复: [PATCH] drm/amdgpu:fix write more dws to ring

Liu, Monk Monk.Liu at amd.com
Wed Jan 18 07:04:57 UTC 2017


Hi Alex


previous patch is just for showing what I want to express :


I found "emit_frame_size" is not doable anymore for gfx ring ...


we already set "funcs->align_mask" to 0xff which means "amdgpu_ring_commit" call will automatically insert some NOP to make each submission 256 dword aligned (and will be 512 if we used above 256 DWs), so at least we need 256 dw per submit.


but (emit_frame_size + ib_count * emit_ib_size)  is always less than 256 , and if we pass it to amdgpu_ring_alloc, we'll run into this issue:


[drm:amdgpu_ring_insert_nop [amdgpu]] *ERROR* amdgpu: writing more dwords to the ring than expected!



any comments ?


BR Monk



________________________________
发件人: Monk Liu <Monk.Liu at amd.com>
发送时间: 2017年1月18日 14:56:46
收件人: amd-gfx at lists.freedesktop.org
抄送: Liu, Monk
主题: [PATCH] drm/amdgpu:fix write more dws to ring

Change-Id: I745512ed7d181e2cd0ce668c86ccfbb2dec80d4d
Signed-off-by: Monk Liu <Monk.Liu at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
index 9129b8c..6c24ed8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
@@ -125,7 +125,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
         unsigned patch_offset = ~0;
         struct amdgpu_vm *vm;
         uint64_t fence_ctx;
-       uint32_t status = 0, alloc_size;
+       uint32_t status = 0;

         unsigned i;
         int r = 0;
@@ -152,10 +152,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
                 return -EINVAL;
         }

-       alloc_size = ring->funcs->emit_frame_size + num_ibs *
-               ring->funcs->emit_ib_size;
-
-       r = amdgpu_ring_alloc(ring, alloc_size);
+       r = amdgpu_ring_alloc(ring, ring->funcs.align_mask + 1);
         if (r) {
                 dev_err(adev->dev, "scheduling IB failed (%d).\n", r);
                 return r;
--
2.7.4

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20170118/199f9c68/attachment.html>


More information about the amd-gfx mailing list