<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<p style="font-family:Arial;font-size:11pt;color:#0078D7;margin:5pt;" align="Left">
[AMD Official Use Only - Internal Distribution Only]<br>
</p>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
</div>
This<span style="color:#c0c0c0"> </span>patch<span style="color:#c0c0c0"> </span>
is<span style="color:#c0c0c0"> </span>Reviewed-by:<span style="color:#c0c0c0"> </span>
James<span style="color:#c0c0c0"> </span>Zhu<span style="color:#c0c0c0"> </span><James.Zhu@amd.com>
<div id="appendonsend"></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>From:</b> Jiansong Chen <Jiansong.Chen@amd.com><br>
<b>Sent:</b> Friday, October 30, 2020 11:05 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Zhang, Hawking <Hawking.Zhang@amd.com>; Zhu, James <James.Zhu@amd.com>; Liu, Leo <Leo.Liu@amd.com>; Zhou1, Tao <Tao.Zhou1@amd.com>; Chen, Jiansong (Simon) <Jiansong.Chen@amd.com><br>
<b>Subject:</b> [PATCH v2] drm/amdgpu: disable gfxoff if VCN is busy</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Toggle on/off gfxoff during video playback to fix gpu hang.<br>
<br>
v2: change sequence to be more compatible with original code.<br>
<br>
Signed-off-by: Jiansong Chen <Jiansong.Chen@amd.com><br>
Change-Id: I5b938c446884268c2cda0801121a53da980e603a<br>
---<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 5 ++++-<br>
1 file changed, 4 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c<br>
index 277a8435dd06..62d4614d48eb 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c<br>
@@ -358,6 +358,7 @@ static void amdgpu_vcn_idle_work_handler(struct work_struct *work)<br>
}<br>
<br>
if (!fences && !atomic_read(&adev->vcn.total_submission_cnt)) {<br>
+ amdgpu_gfx_off_ctrl(adev, true);<br>
amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_VCN,<br>
AMD_PG_STATE_GATE);<br>
} else {<br>
@@ -370,7 +371,9 @@ void amdgpu_vcn_ring_begin_use(struct amdgpu_ring *ring)<br>
struct amdgpu_device *adev = ring->adev;<br>
<br>
atomic_inc(&adev->vcn.total_submission_cnt);<br>
- cancel_delayed_work_sync(&adev->vcn.idle_work);<br>
+<br>
+ if (!cancel_delayed_work_sync(&adev->vcn.idle_work))<br>
+ amdgpu_gfx_off_ctrl(adev, false);<br>
<br>
mutex_lock(&adev->vcn.vcn_pg_lock);<br>
amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_VCN,<br>
-- <br>
2.25.1<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>