[PATCH] drm/amdgpu: Poweroff uvd/vce/vcn/acp block if they were disabled by user

Deucher, Alexander Alexander.Deucher at amd.com
Tue Oct 16 14:43:54 UTC 2018


Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

________________________________
From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> on behalf of Rex Zhu <Rex.Zhu at amd.com>
Sent: Tuesday, October 16, 2018 1:33:46 AM
To: amd-gfx at lists.freedesktop.org; Deucher, Alexander
Cc: Zhu, Rex
Subject: [PATCH] drm/amdgpu: Poweroff uvd/vce/vcn/acp block if they were disabled by user

If user disable uvd/vce/vcn/acp blocks via module
parameter ip_block_mask,
driver power off thoser blocks to save power.

Signed-off-by: Rex Zhu <Rex.Zhu at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 1e4dd09..3ffee08 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -1774,6 +1774,24 @@ static int amdgpu_device_set_pg_state(struct amdgpu_device *adev, enum amd_power

         for (j = 0; j < adev->num_ip_blocks; j++) {
                 i = state == AMD_PG_STATE_GATE ? j : adev->num_ip_blocks - j - 1;
+
+               /* try to power off VCE/UVD/VCN/ACP if they were disabled by user */
+               if ((adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_UVD ||
+                   adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_VCE ||
+                   adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_VCN ||
+                   adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_ACP) &&
+                   adev->ip_blocks[i].version->funcs->set_powergating_state) {
+                       if (!adev->ip_blocks[i].status.valid) {
+                               r = adev->ip_blocks[i].version->funcs->set_powergating_state((void *)adev,
+                                                                                       state);
+                               if (r) {
+                                       DRM_ERROR("set_powergating_state(gate) of IP block <%s> failed %d\n",
+                                         adev->ip_blocks[i].version->funcs->name, r);
+                                       return r;
+                               }
+                       }
+               }
+
                 if (!adev->ip_blocks[i].status.late_initialized)
                         continue;
                 /* skip CG for VCE/UVD, it's handled specially */
@@ -1791,6 +1809,7 @@ static int amdgpu_device_set_pg_state(struct amdgpu_device *adev, enum amd_power
                         }
                 }
         }
+
         return 0;
 }

--
1.9.1

_______________________________________________
amd-gfx mailing list
amd-gfx at lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20181016/777d6b46/attachment.html>


More information about the amd-gfx mailing list