<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">
<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">Reviewed-by: Alex Deucher <alexander.deucher@amd.com><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>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Rex Zhu <Rex.Zhu@amd.com><br>
<b>Sent:</b> Tuesday, October 16, 2018 1:33:46 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org; Deucher, Alexander<br>
<b>Cc:</b> Zhu, Rex<br>
<b>Subject:</b> [PATCH] drm/amdgpu: Poweroff uvd/vce/vcn/acp block if they were disabled by user</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">If user disable uvd/vce/vcn/acp blocks via module<br>
parameter ip_block_mask,<br>
driver power off thoser blocks to save power.<br>
<br>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com><br>
---<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 19 +++++++++++++++++++<br>
1 file changed, 19 insertions(+)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
index 1e4dd09..3ffee08 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
@@ -1774,6 +1774,24 @@ static int amdgpu_device_set_pg_state(struct amdgpu_device *adev, enum amd_power<br>
<br>
for (j = 0; j < adev->num_ip_blocks; j++) {<br>
i = state == AMD_PG_STATE_GATE ? j : adev->num_ip_blocks - j - 1;<br>
+<br>
+ /* try to power off VCE/UVD/VCN/ACP if they were disabled by user */<br>
+ if ((adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_UVD ||<br>
+ adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_VCE ||<br>
+ adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_VCN ||<br>
+ adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_ACP) &&<br>
+ adev->ip_blocks[i].version->funcs->set_powergating_state) {<br>
+ if (!adev->ip_blocks[i].status.valid) {<br>
+ r = adev->ip_blocks[i].version->funcs->set_powergating_state((void *)adev,<br>
+ state);<br>
+ if (r) {<br>
+ DRM_ERROR("set_powergating_state(gate) of IP block <%s> failed %d\n",<br>
+ adev->ip_blocks[i].version->funcs->name, r);<br>
+ return r;<br>
+ }<br>
+ }<br>
+ }<br>
+<br>
if (!adev->ip_blocks[i].status.late_initialized)<br>
continue;<br>
/* skip CG for VCE/UVD, it's handled specially */<br>
@@ -1791,6 +1809,7 @@ static int amdgpu_device_set_pg_state(struct amdgpu_device *adev, enum amd_power<br>
}<br>
}<br>
}<br>
+<br>
return 0;<br>
}<br>
<br>
-- <br>
1.9.1<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><br>
</div>
</span></font></div>
</body>
</html>