<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
comment inline.</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Kenneth Feng <kenneth.feng@amd.com><br>
<b>Sent:</b> Tuesday, November 3, 2020 4:07 PM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Feng, Kenneth <Kenneth.Feng@amd.com><br>
<b>Subject:</b> [PATCH] drm/amd/amdgpu: specify the power strategy for vcn use</font>
<div> </div>
</div>
<div class="BodyFragment">
<div class="PlainText" style="font-size: 11pt;">The power/performance control strategy is specific for vcn use case.<br>
Then this can optimize the power/performance when the workload is on vcn.<br>
<br>
Signed-off-by: Kenneth Feng <kenneth.feng@amd.com><br>
---<br>
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 7 ++++++-<br>
 1 file changed, 6 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 0145504e408b..2c3e111bab43 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c<br>
@@ -361,6 +361,8 @@ static void amdgpu_vcn_idle_work_handler(struct work_struct *work)<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>
+               amdgpu_dpm_switch_power_profile(adev, PP_SMC_POWER_PROFILE_VIDEO,<br>
+                               false);</div>
<div class="PlainText" style="font-size: 11pt;">[kevin]:</div>
<div class="PlainText" style="">
<div style="font-size: 12pt; margin: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; color: rgb(0, 0, 0);">
<span style="font-family: "segoe ui", "segoe ui web (west european)", "segoe ui", -apple-system, blinkmacsystemfont, roboto, "helvetica neue", sans-serif; font-size: 11pt; color: rgb(50, 49, 48); background-color: rgba(0, 0, 0, 0);">we'd better to check the
 return value here, if we really don't care the result, we can print a warning log for debug later.</span></div>
<div style="font-size: 12pt; margin: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; color: rgb(0, 0, 0);">
<span style="font-family: "segoe ui", "segoe ui web (west european)", "segoe ui", -apple-system, blinkmacsystemfont, roboto, "helvetica neue", sans-serif; font-size: 11pt; color: rgb(50, 49, 48); background-color: rgba(0, 0, 0, 0);"><br>
</span></div>
<div style="font-size: 12pt; margin: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; color: rgb(0, 0, 0);">
<span style="font-family: "segoe ui", "segoe ui web (west european)", "segoe ui", -apple-system, blinkmacsystemfont, roboto, "helvetica neue", sans-serif; font-size: 11pt; color: rgb(50, 49, 48); background-color: rgba(0, 0, 0, 0);">the patch is:</span></div>
<div style="font-size: 12pt; margin: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; color: rgb(0, 0, 0);">
<span style="font-size: 11pt; font-family: "segoe ui", "segoe ui web (west european)", "segoe ui", -apple-system, blinkmacsystemfont, roboto, "helvetica neue", sans-serif; color: rgb(50, 49, 48); background-color: rgba(0, 0, 0, 0);">Reviewed-by: Kevin Wang
 <kevin1.wang@amd.com></span><br>
</div>
<br>
</div>
<div class="PlainText" style="font-size: 11pt;">         } else {<br>
                 schedule_delayed_work(&adev->vcn.idle_work, VCN_IDLE_TIMEOUT);<br>
         }<br>
@@ -372,8 +374,11 @@ void amdgpu_vcn_ring_begin_use(struct amdgpu_ring *ring)<br>
 <br>
         atomic_inc(&adev->vcn.total_submission_cnt);<br>
 <br>
-       if (!cancel_delayed_work_sync(&adev->vcn.idle_work))<br>
+       if (!cancel_delayed_work_sync(&adev->vcn.idle_work)) {<br>
                 amdgpu_gfx_off_ctrl(adev, false);<br>
+               amdgpu_dpm_switch_power_profile(adev, PP_SMC_POWER_PROFILE_VIDEO,<br>
+                               true);<br>
+       }<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.17.1<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7CKevin1.Wang%40amd.com%7C72db727fcede4117919008d87fcf9c39%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637399876957953297%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=FRDabYo1xJiS3agbO5a478%2FPO0cDrfcYMfLDS%2BudrX8%3D&amp;reserved=0">https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7CKevin1.Wang%40amd.com%7C72db727fcede4117919008d87fcf9c39%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637399876957953297%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=FRDabYo1xJiS3agbO5a478%2FPO0cDrfcYMfLDS%2BudrX8%3D&amp;reserved=0</a><br>
</div>
</div>
</body>
</html>