<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p><br>
</p>
<br>
<div class="moz-cite-prefix">On 8/10/2018 12:02 PM, Zhu, Rex wrote:<br>
</div>
<blockquote type="cite"
cite="mid:BYAPR12MB2775F1BD12A3F215A6F5C936FB240@BYAPR12MB2775.namprd12.prod.outlook.com">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<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,Helvetica,sans-serif;"
dir="ltr">
<p style="margin-top:0;margin-bottom:0">I am Ok with the check
when call vce_v3_0_hw_fini.</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">But we may still need to
call amdpug_vce_suspend/resume.</p>
</div>
</blockquote>
Done in V2. Have moved the check such that both are executed.<br>
Regards,<br>
Shirish S<br>
<blockquote type="cite"
cite="mid:BYAPR12MB2775F1BD12A3F215A6F5C936FB240@BYAPR12MB2775.namprd12.prod.outlook.com">
<div id="divtagdefaultwrapper"
style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;"
dir="ltr">
<p style="margin-top:0;margin-bottom:0"><br>
and not sure whether need to do ring test when resume back.</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Best Regards</p>
<p style="margin-top:0;margin-bottom:0">Rex<br>
</p>
<div style="color: rgb(0, 0, 0);">
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt"
face="Calibri, sans-serif" color="#000000"><b>From:</b> S,
Shirish<br>
<b>Sent:</b> Friday, August 10, 2018 2:15 PM<br>
<b>To:</b> Deucher, Alexander; Zhu, Rex; Liu, Leo<br>
<b>Cc:</b> <a class="moz-txt-link-abbreviated" href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a>; S, Shirish<br>
<b>Subject:</b> [PATCH] drm/amdpu/vce_v3: skip suspend and
resume if powergated</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span
style="font-size:11pt;">
<div class="PlainText">This patch adds a mechanism by
which the VCE 3.0 block<br>
shall check if it was enabled or in use before
suspending,<br>
if it was powergated while entering suspend then there<br>
is no need to repeat it in vce_3_0_suspend().<br>
Similarly, if the block was powergated while entering
suspend<br>
itself then there is no need to resume it.<br>
<br>
By this we not only make the suspend and resume
sequence<br>
more efficient, but also optimize the overall amdgpu
suspend<br>
and resume time by reducing the ring intialize and
tests<br>
for unused IP blocks.<br>
<br>
Signed-off-by: Shirish S <a class="moz-txt-link-rfc2396E" href="mailto:shirish.s@amd.com"><shirish.s@amd.com></a><br>
---<br>
drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 ++<br>
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c | 21
+++++++++++++++++++++<br>
2 files changed, 23 insertions(+)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
b/drivers/gpu/drm/amd/amdgpu/amdgpu.h<br>
index 07924d4..aa85063 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h<br>
@@ -1035,6 +1035,8 @@ struct amdgpu_device {<br>
<br>
/* vce */<br>
struct amdgpu_vce vce;<br>
+ bool is_vce_pg;<br>
+ bool
is_vce_disabled;<br>
<br>
/* vcn */<br>
struct amdgpu_vcn vcn;<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c
b/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c<br>
index cc6ce6c..822cfd6 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c<br>
@@ -326,6 +326,7 @@ static int vce_v3_0_start(struct
amdgpu_device *adev)<br>
WREG32(mmGRBM_GFX_INDEX,
mmGRBM_GFX_INDEX_DEFAULT);<br>
mutex_unlock(&adev->grbm_idx_mutex);<br>
<br>
+ adev->is_vce_pg = false;<br>
return 0;<br>
}<br>
<br>
@@ -355,6 +356,7 @@ static int vce_v3_0_stop(struct
amdgpu_device *adev)<br>
WREG32(mmGRBM_GFX_INDEX,
mmGRBM_GFX_INDEX_DEFAULT);<br>
mutex_unlock(&adev->grbm_idx_mutex);<br>
<br>
+ adev->is_vce_pg = true;<br>
return 0;<br>
}<br>
<br>
@@ -506,6 +508,17 @@ static int vce_v3_0_suspend(void
*handle)<br>
int r;<br>
struct amdgpu_device *adev = (struct
amdgpu_device *)handle;<br>
<br>
+ /* Proceed with suspend sequence only if VCE
is started<br>
+ * Mark the block as being disabled if its
stopped.<br>
+ */<br>
+ if (adev->is_vce_pg) {<br>
+ DRM_DEBUG("VCE is already powergated,
not suspending\n");<br>
+ adev->is_vce_disabled = true;<br>
+ return 0;<br>
+ }<br>
+<br>
+ adev->is_vce_disabled = false;<br>
+<br>
r = vce_v3_0_hw_fini(adev);<br>
if (r)<br>
return r;<br>
@@ -518,6 +531,14 @@ static int vce_v3_0_resume(void
*handle)<br>
int r;<br>
struct amdgpu_device *adev = (struct
amdgpu_device *)handle;<br>
<br>
+ /* Proceed with resume sequence if VCE was
enabled<br>
+ * while suspending.<br>
+ */<br>
+ if (adev->is_vce_disabled) {<br>
+ DRM_DEBUG("VCE is powergated, not
resuming the block\n");<br>
+ return 0;<br>
+ }<br>
+<br>
r = amdgpu_vce_resume(adev);<br>
if (r)<br>
return r;<br>
-- <br>
2.7.4<br>
<br>
</div>
</span></font></div>
</div>
</div>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Regards,
Shirish S</pre>
</body>
</html>