<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
<p>sorry, I see we already have padding inside ring_alloc, I'll see why I still get
<br>
</p>
<p><br>
</p>
<p><font size="3" color="black" face="Calibri,Arial,Helvetica,sans-serif"><span style="font-size:12pt;" id="x_divtagdefaultwrapper">[drm:amdgpu_ring_insert_nop [amdgpu]] *ERROR* amdgpu: writing more dwords to the ring than expected!</span></font></p>
<p><br>
</p>
<p>BR Monk<br>
</p>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>发件人:</b> Liu, Monk<br>
<b>发送时间:</b> 2017年1月18日 15:04:57<br>
<b>收件人:</b> amd-gfx@lists.freedesktop.org<br>
<b>主题:</b> 答复: [PATCH] drm/amdgpu:fix write more dws to ring</font>
<div> </div>
</div>
<div>
<meta content="text/html; charset=UTF-8">
<style type="text/css" style="">
<!--
p
{margin-top:0;
margin-bottom:0}
-->
</style>
<div dir="ltr">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Hi Alex<br>
</p>
<p><br>
</p>
<p>previous patch is just for showing what I want to express :<br>
</p>
<p><br>
</p>
<p>I found "emit_frame_size" is not doable anymore for gfx ring ... <br>
</p>
<p><br>
</p>
<p>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.</p>
<p><br>
</p>
<p>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:</p>
<p><br>
</p>
<p><span>[drm:amdgpu_ring_insert_nop [amdgpu]] *ERROR* amdgpu: writing more dwords to the ring than expected!</span></p>
<p><span><br>
</span></p>
<p><span><br>
</span></p>
<p><span>any comments ?</span></p>
<p><span><br>
</span></p>
<p><span>BR Monk<br>
</span></p>
<p><span><br>
</span></p>
<p><span></span><br>
</p>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>发件人:</b> Monk Liu <Monk.Liu@amd.com><br>
<b>发送时间:</b> 2017年1月18日 14:56:46<br>
<b>收件人:</b> amd-gfx@lists.freedesktop.org<br>
<b>抄送:</b> Liu, Monk<br>
<b>主题:</b> [PATCH] drm/amdgpu:fix write more dws to ring</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">Change-Id: I745512ed7d181e2cd0ce668c86ccfbb2dec80d4d<br>
Signed-off-by: Monk Liu <Monk.Liu@amd.com><br>
---<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 7 ++-----<br>
1 file changed, 2 insertions(+), 5 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c<br>
index 9129b8c..6c24ed8 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c<br>
@@ -125,7 +125,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,<br>
unsigned patch_offset = ~0;<br>
struct amdgpu_vm *vm;<br>
uint64_t fence_ctx;<br>
- uint32_t status = 0, alloc_size;<br>
+ uint32_t status = 0;<br>
<br>
unsigned i;<br>
int r = 0;<br>
@@ -152,10 +152,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,<br>
return -EINVAL;<br>
}<br>
<br>
- alloc_size = ring->funcs->emit_frame_size + num_ibs *<br>
- ring->funcs->emit_ib_size;<br>
-<br>
- r = amdgpu_ring_alloc(ring, alloc_size);<br>
+ r = amdgpu_ring_alloc(ring, ring->funcs.align_mask + 1);<br>
if (r) {<br>
dev_err(adev->dev, "scheduling IB failed (%d).\n", r);<br>
return r;<br>
-- <br>
2.7.4<br>
<br>
</div>
</span></font></div>
</body>
</html>