drm/amdgpu: add missing cleanups for Polaris12 UVD/VCE on suspend
Subsystems (2)
PATCH 1/1 drm/amdgpu: add missing cleanups for Polaris12 UVD/VCE on suspend
Perform proper cleanups on UVD/VCE suspend: powergate enablement, clockgating enablement and dpm disablement. This can fix some hangs observed on suspending when UVD/VCE still using(e.g. issue "pm-suspend" when video is still playing).
--- drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 24 ++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/vce_v3_0.c | 23 +++++++++++++++++++++++ 2 files changed, 47 insertions(+)
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +24 -0
@@ -554,6 +554,30 @@ static int uvd_v6_0_suspend(void *handle)int r;struct amdgpu_device *adev = (struct amdgpu_device *)handle; +/* +* Proper cleanups before halting the HW engine: +* - cancel the delayed idle work +* - enable powergating +* - enable clockgating +* - disable dpm +* +* TODO: to align with the VCN implementation, move the +* jobs for clockgating/powergating/dpm setting to +* ->set_powergating_state(). +*/ +cancel_delayed_work_sync (&adev->uvd.idle_work); + +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_uvd (adev, false); + }else { +amdgpu_asic_set_uvd_clocks (adev,0 ,0 ); +/* shutdown the UVD block */ +amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_UVD , +AMD_PG_STATE_GATE ); +amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_UVD , +AMD_CG_STATE_GATE ); + } + r =uvd_v6_0_hw_fini (adev);if (r)return r;
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +23 -0
@@ -503,6 +503,29 @@ static int vce_v3_0_suspend(void *handle)int r;struct amdgpu_device *adev = (struct amdgpu_device *)handle; +/* +* Proper cleanups before halting the HW engine: +* - cancel the delayed idle work +* - enable powergating +* - enable clockgating +* - disable dpm +* +* TODO: to align with the VCN implementation, move the +* jobs for clockgating/powergating/dpm setting to +* ->set_powergating_state(). +*/ +cancel_delayed_work_sync (&adev->vce.idle_work); + +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_vce (adev, false); + }else { +amdgpu_asic_set_vce_clocks (adev,0 ,0 ); +amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_VCE , +AMD_PG_STATE_GATE ); +amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_VCE , +AMD_CG_STATE_GATE ); + } + r =vce_v3_0_hw_fini (adev);if (r)return r;
Signature · 1 line
2.29.0
[Public]
+Leo and James to review as well.
This patch is:
Regards,
Guchun
-----Original Message-----
From: Quan, Evan <[email protected]>
Sent: Thursday, August 19, 2021 11:09 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Chen, Guchun <[email protected]>; Lazar, Lijo <[email protected]>; Quan, Evan <[email protected]>; Pan, Xinhui <[email protected]>
Subject: [PATCH] drm/amdgpu: add missing cleanups for Polaris12 UVD/VCE on suspend
Perform proper cleanups on UVD/VCE suspend: powergate enablement, clockgating enablement and dpm disablement. This can fix some hangs observed on suspending when UVD/VCE still using(e.g. issue "pm-suspend" when video is still playing).
--- drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 24 ++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/vce_v3_0.c | 23 +++++++++++++++++++++++ 2 files changed, 47 insertions(+)
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +24 -0
@@ -554,6 +554,30 @@ static int uvd_v6_0_suspend(void *handle)int r;struct amdgpu_device *adev = (struct amdgpu_device *)handle; +/* +* Proper cleanups before halting the HW engine: +* - cancel the delayed idle work +* - enable powergating +* - enable clockgating +* - disable dpm +* +* TODO: to align with the VCN implementation, move the +* jobs for clockgating/powergating/dpm setting to +* ->set_powergating_state(). +*/ +cancel_delayed_work_sync (&adev->uvd.idle_work); + +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_uvd (adev, false); + }else { +amdgpu_asic_set_uvd_clocks (adev,0 ,0 ); +/* shutdown the UVD block */ +amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_UVD , +AMD_PG_STATE_GATE ); +amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_UVD , +AMD_CG_STATE_GATE ); + } + r =uvd_v6_0_hw_fini (adev);if (r)return r;
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +23 -0
@@ -503,6 +503,29 @@ static int vce_v3_0_suspend(void *handle)int r;struct amdgpu_device *adev = (struct amdgpu_device *)handle; +/* +* Proper cleanups before halting the HW engine: +* - cancel the delayed idle work +* - enable powergating +* - enable clockgating +* - disable dpm +* +* TODO: to align with the VCN implementation, move the +* jobs for clockgating/powergating/dpm setting to +* ->set_powergating_state(). +*/ +cancel_delayed_work_sync (&adev->vce.idle_work); + +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_vce (adev, false); + }else { +amdgpu_asic_set_vce_clocks (adev,0 ,0 ); +amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_VCE , +AMD_PG_STATE_GATE ); +amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_VCE , +AMD_CG_STATE_GATE ); + } + r =vce_v3_0_hw_fini (adev);if (r)return r;
--
2.29.0
[AMD Official Use Only]
Why not move changes into hw_fini?
Best Regards!
James Zhu
________________________________
From: amd-gfx <[email protected]> on behalf of Evan Quan <[email protected]>
Sent: Wednesday, August 18, 2021 11:08 PM
To: [email protected] <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Chen, Guchun <[email protected]>; Lazar, Lijo <[email protected]>; Quan, Evan <[email protected]>; Pan, Xinhui <[email protected]>
Subject: [PATCH] drm/amdgpu: add missing cleanups for Polaris12 UVD/VCE on suspend
Perform proper cleanups on UVD/VCE suspend: powergate enablement, clockgating enablement and dpm disablement. This can fix some hangs observed on suspending when UVD/VCE still using(e.g. issue "pm-suspend" when video is still playing).
--- drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 24 ++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/vce_v3_0.c | 23 +++++++++++++++++++++++ 2 files changed, 47 insertions(+)
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +24 -0
@@ -554,6 +554,30 @@ static int uvd_v6_0_suspend(void *handle)int r;struct amdgpu_device *adev = (struct amdgpu_device *)handle; +/* +* Proper cleanups before halting the HW engine: +* - cancel the delayed idle work +* - enable powergating +* - enable clockgating +* - disable dpm +* +* TODO: to align with the VCN implementation, move the +* jobs for clockgating/powergating/dpm setting to +* ->set_powergating_state(). +*/ +cancel_delayed_work_sync (&adev->uvd.idle_work); + +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_uvd (adev, false); + }else { +amdgpu_asic_set_uvd_clocks (adev,0 ,0 ); +/* shutdown the UVD block */ +amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_UVD , +AMD_PG_STATE_GATE ); +amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_UVD , +AMD_CG_STATE_GATE ); + } + r =uvd_v6_0_hw_fini (adev);if (r)return r;
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +23 -0
@@ -503,6 +503,29 @@ static int vce_v3_0_suspend(void *handle)int r;struct amdgpu_device *adev = (struct amdgpu_device *)handle; +/* +* Proper cleanups before halting the HW engine: +* - cancel the delayed idle work +* - enable powergating +* - enable clockgating +* - disable dpm +* +* TODO: to align with the VCN implementation, move the +* jobs for clockgating/powergating/dpm setting to +* ->set_powergating_state(). +*/ +cancel_delayed_work_sync (&adev->vce.idle_work); + +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_vce (adev, false); + }else { +amdgpu_asic_set_vce_clocks (adev,0 ,0 ); +amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_VCE , +AMD_PG_STATE_GATE ); +amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_VCE , +AMD_CG_STATE_GATE ); + } + r =vce_v3_0_hw_fini (adev);if (r)return r;
--
2.29.0
[AMD Official Use Only]
If that is done -
+ amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_UVD,
+ AMD_PG_STATE_GATE);
+ amdgpu_device_ip_set_clockgating_state(adev, AMD_IP_BLOCK_TYPE_UVD,
+ AMD_CG_STATE_GATE);
Usual order is CG followed by PG. It comes in the else part, so less likely to happen. Nice to fix for code correctness purpose.
Thanks,
Lijo
From: Zhu, James <[email protected]>
Sent: Thursday, August 19, 2021 7:49 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Chen, Guchun <[email protected]>; Lazar, Lijo <[email protected]>; Pan, Xinhui <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: add missing cleanups for Polaris12 UVD/VCE on suspend
[AMD Official Use Only]
Why not move changes into hw_fini?
Best Regards!
James Zhu
________________________________
From: amd-gfx <[email protected]<mailto:[email protected]>> on behalf of Evan Quan <[email protected]<mailto:[email protected]>>
Sent: Wednesday, August 18, 2021 11:08 PM
To: [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Deucher, Alexander <[email protected]<mailto:[email protected]>>; Chen, Guchun <[email protected]<mailto:[email protected]>>; Lazar, Lijo <[email protected]<mailto:[email protected]>>; Quan, Evan <[email protected]<mailto:[email protected]>>; Pan, Xinhui <[email protected]<mailto:[email protected]>>
Subject: [PATCH] drm/amdgpu: add missing cleanups for Polaris12 UVD/VCE on suspend
Perform proper cleanups on UVD/VCE suspend: powergate enablement, clockgating enablement and dpm disablement. This can fix some hangs observed on suspending when UVD/VCE still using(e.g. issue "pm-suspend" when video is still playing).
--- drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 24 ++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/vce_v3_0.c | 23 +++++++++++++++++++++++ 2 files changed, 47 insertions(+)
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +24 -0
@@ -554,6 +554,30 @@ static int uvd_v6_0_suspend(void *handle)int r;struct amdgpu_device *adev = (struct amdgpu_device *)handle; +/* +* Proper cleanups before halting the HW engine: +* - cancel the delayed idle work +* - enable powergating +* - enable clockgating +* - disable dpm +* +* TODO: to align with the VCN implementation, move the +* jobs for clockgating/powergating/dpm setting to +* ->set_powergating_state(). +*/ +cancel_delayed_work_sync (&adev->uvd.idle_work); + +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_uvd (adev, false); + }else { +amdgpu_asic_set_uvd_clocks (adev,0 ,0 ); +/* shutdown the UVD block */ +amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_UVD , +AMD_PG_STATE_GATE ); +amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_UVD , +AMD_CG_STATE_GATE ); + } + r =uvd_v6_0_hw_fini (adev);if (r)return r;
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +23 -0
@@ -503,6 +503,29 @@ static int vce_v3_0_suspend(void *handle)int r;struct amdgpu_device *adev = (struct amdgpu_device *)handle; +/* +* Proper cleanups before halting the HW engine: +* - cancel the delayed idle work +* - enable powergating +* - enable clockgating +* - disable dpm +* +* TODO: to align with the VCN implementation, move the +* jobs for clockgating/powergating/dpm setting to +* ->set_powergating_state(). +*/ +cancel_delayed_work_sync (&adev->vce.idle_work); + +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_vce (adev, false); + }else { +amdgpu_asic_set_vce_clocks (adev,0 ,0 ); +amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_VCE , +AMD_PG_STATE_GATE ); +amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_VCE , +AMD_CG_STATE_GATE ); + } + r =vce_v3_0_hw_fini (adev);if (r)return r;
--
2.29.0
[AMD Official Use Only]
From: Lazar, Lijo <[email protected]>
Sent: Thursday, August 19, 2021 10:36 PM
To: Zhu, James <[email protected]>; Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Chen, Guchun <[email protected]>; Pan, Xinhui <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: add missing cleanups for Polaris12 UVD/VCE on suspend
[AMD Official Use Only]
If that is done -
+ amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_UVD,
+ AMD_PG_STATE_GATE);
+ amdgpu_device_ip_set_clockgating_state(adev, AMD_IP_BLOCK_TYPE_UVD,
+ AMD_CG_STATE_GATE);
Usual order is CG followed by PG. It comes in the else part, so less likely to happen. Nice to fix for code correctness purpose.
[Quan, Evan] Thanks Lijo. Make sense to me. However, actually these code were copied from amdgpu_uvd_idle_work_handler() of amdgpu_uvd.c. Same logic was used there. So, maybe @Zhu, James<mailto:[email protected]> or @Liu, Leo<mailto:[email protected]> can share some insights about this.
BR
Evan
Thanks,
Lijo
From: Zhu, James <[email protected]<mailto:[email protected]>>
Sent: Thursday, August 19, 2021 7:49 PM
To: Quan, Evan <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>
Cc: Deucher, Alexander <[email protected]<mailto:[email protected]>>; Chen, Guchun <[email protected]<mailto:[email protected]>>; Lazar, Lijo <[email protected]<mailto:[email protected]>>; Pan, Xinhui <[email protected]<mailto:[email protected]>>
Subject: Re: [PATCH] drm/amdgpu: add missing cleanups for Polaris12 UVD/VCE on suspend
[AMD Official Use Only]
Why not move changes into hw_fini?
Best Regards!
James Zhu
________________________________
From: amd-gfx <[email protected]<mailto:[email protected]>> on behalf of Evan Quan <[email protected]<mailto:[email protected]>>
Sent: Wednesday, August 18, 2021 11:08 PM
To: [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Deucher, Alexander <[email protected]<mailto:[email protected]>>; Chen, Guchun <[email protected]<mailto:[email protected]>>; Lazar, Lijo <[email protected]<mailto:[email protected]>>; Quan, Evan <[email protected]<mailto:[email protected]>>; Pan, Xinhui <[email protected]<mailto:[email protected]>>
Subject: [PATCH] drm/amdgpu: add missing cleanups for Polaris12 UVD/VCE on suspend
Perform proper cleanups on UVD/VCE suspend: powergate enablement, clockgating enablement and dpm disablement. This can fix some hangs observed on suspending when UVD/VCE still using(e.g. issue "pm-suspend" when video is still playing).
--- drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 24 ++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/vce_v3_0.c | 23 +++++++++++++++++++++++ 2 files changed, 47 insertions(+)
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +24 -0
@@ -554,6 +554,30 @@ static int uvd_v6_0_suspend(void *handle)int r;struct amdgpu_device *adev = (struct amdgpu_device *)handle; +/* +* Proper cleanups before halting the HW engine: +* - cancel the delayed idle work +* - enable powergating +* - enable clockgating +* - disable dpm +* +* TODO: to align with the VCN implementation, move the +* jobs for clockgating/powergating/dpm setting to +* ->set_powergating_state(). +*/ +cancel_delayed_work_sync (&adev->uvd.idle_work); + +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_uvd (adev, false); + }else { +amdgpu_asic_set_uvd_clocks (adev,0 ,0 ); +/* shutdown the UVD block */ +amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_UVD , +AMD_PG_STATE_GATE ); +amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_UVD , +AMD_CG_STATE_GATE ); + } + r =uvd_v6_0_hw_fini (adev);if (r)return r;
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +23 -0
@@ -503,6 +503,29 @@ static int vce_v3_0_suspend(void *handle)int r;struct amdgpu_device *adev = (struct amdgpu_device *)handle; +/* +* Proper cleanups before halting the HW engine: +* - cancel the delayed idle work +* - enable powergating +* - enable clockgating +* - disable dpm +* +* TODO: to align with the VCN implementation, move the +* jobs for clockgating/powergating/dpm setting to +* ->set_powergating_state(). +*/ +cancel_delayed_work_sync (&adev->vce.idle_work); + +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_vce (adev, false); + }else { +amdgpu_asic_set_vce_clocks (adev,0 ,0 ); +amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_VCE , +AMD_PG_STATE_GATE ); +amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_VCE , +AMD_CG_STATE_GATE ); + } + r =vce_v3_0_hw_fini (adev);if (r)return r;
--
2.29.0
Quoted 32 lines · Evan
[AMD Official Use Only]
From: Lazar, Lijo <[email protected]>
Sent: Thursday, August 19, 2021 10:36 PM
To: Zhu, James <[email protected]>; Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Chen, Guchun <[email protected]>; Pan, Xinhui <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: add missing cleanups for Polaris12 UVD/VCE on suspend[AMD Official Use Only]
If that is done –
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +4
-0+amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_UVD , +AMD_PG_STATE_GATE ); +amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_UVD , +AMD_CG_STATE_GATE );
Quoted 4 lines
Usual order is CG followed by PG. It comes in the else part, so less likely to happen. Nice to fix for code correctness purpose.
[Quan, Evan] Thanks Lijo. Make sense to me. However, actually these code were copied from
amdgpu_uvd_idle_work_handler()ofamdgpu_uvd.c. Same logic was used there. So, maybe @Zhu, James or @Liu, Leo can share some insights about this.
It looks like it is wrong there as well. We should be gating the clocks before the power. The order is also wrong in amdgpu_uvd_ring_begin_use(). We need to ungate the power before the clocks
Alex
Quoted 132 lines
BR
Evan
Thanks,
Lijo
From: Zhu, James <[email protected]>
Sent: Thursday, August 19, 2021 7:49 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Chen, Guchun <[email protected]>; Lazar, Lijo <[email protected]>; Pan, Xinhui <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: add missing cleanups for Polaris12 UVD/VCE on suspend[AMD Official Use Only]
Why not move changes into
hw_fini?Best Regards!
James Zhu
________________________________
From: amd-gfx <[email protected]> on behalf of Evan Quan <[email protected]>
Sent: Wednesday, August 18, 2021 11:08 PM
To: [email protected] <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Chen, Guchun <[email protected]>; Lazar, Lijo <[email protected]>; Quan, Evan <[email protected]>; Pan, Xinhui <[email protected]>
Subject: [PATCH] drm/amdgpu: add missing cleanups for Polaris12 UVD/VCE on suspendPerform proper cleanups on UVD/VCE suspend: powergate enablement, clockgating enablement and dpm disablement. This can fix some hangs observed on suspending when UVD/VCE still using(e.g. issue "pm-suspend" when video is still playing).
Change-Id I36f39d9731e0a9638b52d5d92558b0ee9c23a9edSigned-off-by Evan Quan <[email protected]>Signed-off-by xinhui pan <[email protected]>--- drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 24 ++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/vce_v3_0.c | 23 +++++++++++++++++++++++ 2 files changed, 47 insertions(+)drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +24
-0@@ -554,6 +554,30 @@ static int uvd_v6_0_suspend(void *handle)int r;struct amdgpu_device *adev = (struct amdgpu_device *)handle; +/* +* Proper cleanups before halting the HW engine: +* - cancel the delayed idle work +* - enable powergating +* - enable clockgating +* - disable dpm +* +* TODO: to align with the VCN implementation, move the +* jobs for clockgating/powergating/dpm setting to +* ->set_powergating_state(). +*/ +cancel_delayed_work_sync (&adev->uvd.idle_work); + +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_uvd (adev, false); + }else { +amdgpu_asic_set_uvd_clocks (adev,0 ,0 ); +/* shutdown the UVD block */ +amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_UVD , +AMD_PG_STATE_GATE ); +amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_UVD , +AMD_CG_STATE_GATE ); + } + r =uvd_v6_0_hw_fini (adev);if (r)return r;drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +23
-1@@ -503,6 +503,29 @@ static int vce_v3_0_suspend(void *handle)int r;struct amdgpu_device *adev = (struct amdgpu_device *)handle; +/* +* Proper cleanups before halting the HW engine: +* - cancel the delayed idle work +* - enable powergating +* - enable clockgating +* - disable dpm +* +* TODO: to align with the VCN implementation, move the +* jobs for clockgating/powergating/dpm setting to +* ->set_powergating_state(). +*/ +cancel_delayed_work_sync (&adev->vce.idle_work); + +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_vce (adev, false); + }else { +amdgpu_asic_set_vce_clocks (adev,0 ,0 ); +amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_VCE , +AMD_PG_STATE_GATE ); +amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_VCE , +AMD_CG_STATE_GATE ); + } + r =vce_v3_0_hw_fini (adev);if (r)return r; --2.29.0
[AMD Official Use Only]
Quoted 55 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Friday, August 20, 2021 10:23 PM
To: Quan, Evan <[email protected]>
Cc: Lazar, Lijo <[email protected]>; Zhu, James <[email protected]>; [email protected]; Liu, Leo <[email protected]>; Deucher, Alexander <[email protected]>; Chen, Guchun <[email protected]>; Pan, Xinhui <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: add missing cleanups for Polaris12 UVD/VCE on suspendQuoted 9 lines · Evan
[AMD Official Use Only]
Quoted 3 lines
From: Lazar, Lijo <[email protected]>
Sent: Thursday, August 19, 2021 10:36 PM
To: Zhu, James <[email protected]>; Quan, EvanQuoted 12 lines
[email protected]
Cc: Deucher, Alexander <[email protected]>; Chen, Guchun <[email protected]>; Pan, Xinhui <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: add missing cleanups for Polaris12 UVD/VCE on suspend[AMD Official Use Only]
Quoted 5 lines
If that is done –
+ amdgpu_device_ip_set_powergating_state(adev,
AMD_IP_BLOCK_TYPE_UVD,Review
Quoted 2 lines
(quoted diff) +2
-0+ AMD_PG_STATE_GATE); + amdgpu_device_ip_set_clockgating_state(adev,
AMD_IP_BLOCK_TYPE_UVD,Quoted 6 lines
+
+AMD_CG_STATE_GATE);Usual order is CG followed by PG. It comes in the else part, so less likely to
happen. Nice to fix for code correctness purpose.
Quoted 2 lines
[Quan, Evan] Thanks Lijo. Make sense to me. However, actually these code
Quoted 8 lines
were copied from
amdgpu_uvd_idle_work_handler()ofamdgpu_uvd.c. Same logic was used there. So, maybe @Zhu, James or @Liu, Leo can share some insights about this.Quoted 1 line
It looks like it is wrong there as well. We should be gating the clocks before the power. The order is also wrong in
amdgpu_uvd_ring_begin_use(). We need to ungate the power before the clocks
[Quan, Evan] I created a patch for this. But during the verification, I got the errors below
[ 87.420822] [drm:uvd_v6_0_start [amdgpu]] *ERROR* UVD not responding, trying to reset the VCPU!!! [ 88.443029] [drm:uvd_v6_0_start [amdgpu]] *ERROR* UVD not responding, trying to reset the VCPU!!! [ 89.465386] [drm:uvd_v6_0_start [amdgpu]] *ERROR* UVD not responding, trying to reset the VCPU!!! [ 90.487629] [drm:uvd_v6_0_start [amdgpu]] *ERROR* UVD not responding, trying to reset the VCPU!!! [ 91.510380] [drm:uvd_v6_0_start [amdgpu]] *ERROR* UVD not responding, trying to reset the VCPU!!! [ 92.533782] [drm:uvd_v6_0_start [amdgpu]] *ERROR* UVD not responding, trying to reset the VCPU!!! [ 93.557400] [drm:uvd_v6_0_start [amdgpu]] *ERROR* UVD not responding, trying to reset the VCPU!!! [ 94.580708] [drm:uvd_v6_0_start [amdgpu]] *ERROR* UVD not responding, trying to reset the VCPU!!! [ 95.603832] [drm:uvd_v6_0_start [amdgpu]] *ERROR* UVD not responding, trying to reset the VCPU!!! [ 96.627727] [drm:uvd_v6_0_start [amdgpu]] *ERROR* UVD not responding, trying to reset the VCPU!!! [ 96.657453] [drm:uvd_v6_0_start [amdgpu]] *ERROR* UVD not responding, giving up!!! [ 96.665892] [drm:amdgpu_device_ip_set_powergating_state [amdgpu]] *ERROR* set_powergating_state of IP block <uvd_v6_0> failed -1 [ 97.697422] amdgpu 0000:02:00.0: [drm:amdgpu_ib_ring_tests [amdgpu]] *ERROR* IB test failed on uvd (-110). [ 98.721432] amdgpu 0000:02:00.0: [drm:amdgpu_ib_ring_tests [amdgpu]] *ERROR* IB test failed on uvd_enc0 (-110). [ 99.745407] amdgpu 0000:02:00.0: [drm:amdgpu_ib_ring_tests [amdgpu]] *ERROR* IB test failed on uvd_enc1 (-110). [ 99.857784] [drm:amdgpu_device_delayed_init_work_handler [amdgpu]] *ERROR* ib ring test failed (-110).
After checking the related source code roughly. It seems the underlaying implementation of -> set_powergating_state(e.g. uvd_v6_0_set_powergating_state ) performs more jobs than just power gating. And I guess maybe some of those jobs needs to be performed after -> set_clockgating_state. James and Leo may comment more.
BR
Evan
Quoted 151 lines
Alex
Quoted 60 lines
BR
Evan
Thanks,
Lijo
From: Zhu, James <[email protected]>
Sent: Thursday, August 19, 2021 7:49 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Chen, Guchun <[email protected]>; Lazar, Lijo <[email protected]>; Pan, Xinhui <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: add missing cleanups for Polaris12 UVD/VCE on suspend[AMD Official Use Only]
Why not move changes into
hw_fini?Best Regards!
James Zhu
________________________________
From: amd-gfx <[email protected]> on behalf of Evan Quan <[email protected]>
Sent: Wednesday, August 18, 2021 11:08 PM
To: [email protected] <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Chen, Guchun <[email protected]>; Lazar, Lijo <[email protected]>; Quan, Evan <[email protected]>; Pan, Xinhui <[email protected]>
Subject: [PATCH] drm/amdgpu: add missing cleanups for Polaris12 UVD/VCE on suspendPerform proper cleanups on UVD/VCE suspend: powergate enablement, clockgating enablement and dpm disablement. This can fix some hangs observed on suspending when UVD/VCE still using(e.g. issue "pm-suspend" when video is still playing).
Quoted 5 lines
Change-Id I36f39d9731e0a9638b52d5d92558b0ee9c23a9edSigned-off-by Evan Quan <[email protected]>Signed-off-by xinhui pan <[email protected]>--- drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 24++++++++++++++++++++++++
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c| 23+++++++++++++++++++++++
Quoted 20 lines
2 files changed, 47 insertions(+)drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +9
-0@@ -554,6 +554,30 @@ static int uvd_v6_0_suspend(void *handle)int r;struct amdgpu_device *adev = (struct amdgpu_device *)handle; +/* +* Proper cleanups before halting the HW engine: +* - cancel the delayed idle work +* - enable powergating +* - enable clockgating +* - disable dpm +* +* TODO: to align with the VCN implementation, move the +* jobs for clockgating/powergating/dpm setting to drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_suspend(void *handle) · line 575
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +10
-0+* ->set_powergating_state(). +*/ +cancel_delayed_work_sync (&adev->uvd.idle_work); + +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_uvd (adev, false); + }else { +amdgpu_asic_set_uvd_clocks (adev,0 ,0 ); +/* shutdown the UVD block */ + amdgpu_device_ip_set_powergating_state(adev,
AMD_IP_BLOCK_TYPE_UVD,drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_suspend(void *handle) · line 577
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +2
-0+ AMD_PG_STATE_GATE); + amdgpu_device_ip_set_clockgating_state(adev,
AMD_IP_BLOCK_TYPE_UVD,Quoted 23 lines
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +3
-0+ AMD_CG_STATE_GATE); + } + r =uvd_v6_0_hw_fini (adev);if (r)return r;drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +8
-0@@ -503,6 +503,29 @@ static int vce_v3_0_suspend(void *handle)int r;struct amdgpu_device *adev = (struct amdgpu_device *)handle; +/* +* Proper cleanups before halting the HW engine: +* - cancel the delayed idle work +* - enable powergating +* - enable clockgating +* - disable dpm +* +* TODO: to align with the VCN implementation, move the drivers/gpu/drm/amd/amdgpu/vce_v3_0.c static int vce_v3_0_suspend(void *handle) · line 523
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +10
-0+* jobs for clockgating/powergating/dpm setting to +* ->set_powergating_state(). +*/ +cancel_delayed_work_sync (&adev->vce.idle_work); + +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_vce (adev, false); + }else { +amdgpu_asic_set_vce_clocks (adev,0 ,0 ); + amdgpu_device_ip_set_powergating_state(adev,
AMD_IP_BLOCK_TYPE_VCE,drivers/gpu/drm/amd/amdgpu/vce_v3_0.c static int vce_v3_0_suspend(void *handle) · line 525
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +2
-0+ AMD_PG_STATE_GATE); + amdgpu_device_ip_set_clockgating_state(adev,
AMD_IP_BLOCK_TYPE_VCE,Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +3
-1+ AMD_CG_STATE_GATE); + } + r =vce_v3_0_hw_fini (adev);if (r)return r; --2.29.0
Quoted 86 lines · Evan
[AMD Official Use Only]
Quoted 55 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Friday, August 20, 2021 10:23 PM
To: Quan, Evan <[email protected]>
Cc: Lazar, Lijo <[email protected]>; Zhu, James <[email protected]>; [email protected]; Liu, Leo <[email protected]>; Deucher, Alexander <[email protected]>; Chen, Guchun <[email protected]>; Pan, Xinhui <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: add missing cleanups for Polaris12 UVD/VCE on suspendQuoted 9 lines · Evan
[AMD Official Use Only]
Quoted 3 lines
From: Lazar, Lijo <[email protected]>
Sent: Thursday, August 19, 2021 10:36 PM
To: Zhu, James <[email protected]>; Quan, EvanQuoted 12 lines
[email protected]
Cc: Deucher, Alexander <[email protected]>; Chen, Guchun <[email protected]>; Pan, Xinhui <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: add missing cleanups for Polaris12 UVD/VCE on suspend[AMD Official Use Only]
Quoted 5 lines
If that is done –
+ amdgpu_device_ip_set_powergating_state(adev,
AMD_IP_BLOCK_TYPE_UVD,Review
Quoted 2 lines
(quoted diff) +2
-0+ AMD_PG_STATE_GATE); + amdgpu_device_ip_set_clockgating_state(adev,
AMD_IP_BLOCK_TYPE_UVD,Quoted 6 lines
+
+AMD_CG_STATE_GATE);Usual order is CG followed by PG. It comes in the else part, so less likely to
happen. Nice to fix for code correctness purpose.
Quoted 2 lines
[Quan, Evan] Thanks Lijo. Make sense to me. However, actually these code
Quoted 8 lines
were copied from
amdgpu_uvd_idle_work_handler()ofamdgpu_uvd.c. Same logic was used there. So, maybe @Zhu, James or @Liu, Leo can share some insights about this.Quoted 1 line
It looks like it is wrong there as well. We should be gating the clocks before the power. The order is also wrong in
amdgpu_uvd_ring_begin_use(). We need to ungate the power before the clocks[Quan, Evan] I created a patch for this. But during the verification, I got the errors below
[ 87.420822] [drm:uvd_v6_0_start [amdgpu]] *ERROR* UVD not responding, trying to reset the VCPU!!! [ 88.443029] [drm:uvd_v6_0_start [amdgpu]] *ERROR* UVD not responding, trying to reset the VCPU!!! [ 89.465386] [drm:uvd_v6_0_start [amdgpu]] *ERROR* UVD not responding, trying to reset the VCPU!!! [ 90.487629] [drm:uvd_v6_0_start [amdgpu]] *ERROR* UVD not responding, trying to reset the VCPU!!! [ 91.510380] [drm:uvd_v6_0_start [amdgpu]] *ERROR* UVD not responding, trying to reset the VCPU!!! [ 92.533782] [drm:uvd_v6_0_start [amdgpu]] *ERROR* UVD not responding, trying to reset the VCPU!!! [ 93.557400] [drm:uvd_v6_0_start [amdgpu]] *ERROR* UVD not responding, trying to reset the VCPU!!! [ 94.580708] [drm:uvd_v6_0_start [amdgpu]] *ERROR* UVD not responding, trying to reset the VCPU!!! [ 95.603832] [drm:uvd_v6_0_start [amdgpu]] *ERROR* UVD not responding, trying to reset the VCPU!!! [ 96.627727] [drm:uvd_v6_0_start [amdgpu]] *ERROR* UVD not responding, trying to reset the VCPU!!! [ 96.657453] [drm:uvd_v6_0_start [amdgpu]] *ERROR* UVD not responding, giving up!!! [ 96.665892] [drm:amdgpu_device_ip_set_powergating_state [amdgpu]] *ERROR* set_powergating_state of IP block <uvd_v6_0> failed -1 [ 97.697422] amdgpu 0000:02:00.0: [drm:amdgpu_ib_ring_tests [amdgpu]] *ERROR* IB test failed on uvd (-110). [ 98.721432] amdgpu 0000:02:00.0: [drm:amdgpu_ib_ring_tests [amdgpu]] *ERROR* IB test failed on uvd_enc0 (-110). [ 99.745407] amdgpu 0000:02:00.0: [drm:amdgpu_ib_ring_tests [amdgpu]] *ERROR* IB test failed on uvd_enc1 (-110). [ 99.857784] [drm:amdgpu_device_delayed_init_work_handler [amdgpu]] *ERROR* ib ring test failed (-110).
Quoted 2 lines
After checking the related source code roughly. It seems the underlaying implementation of -> set_powergating_state(e.g.
uvd_v6_0_set_powergating_state) performs more jobs than just power gating. And I guess maybe some of those jobs needs to be performed after ->set_clockgating_state. James and Leo may comment more.
Ok. Thanks for checking. I have no objections to the patch as is. We can address the ordering questions later.
Alex
Quoted 153 lines
BR
EvanQuoted 151 lines
Alex
Quoted 60 lines
BR
Evan
Thanks,
Lijo
From: Zhu, James <[email protected]>
Sent: Thursday, August 19, 2021 7:49 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Chen, Guchun <[email protected]>; Lazar, Lijo <[email protected]>; Pan, Xinhui <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: add missing cleanups for Polaris12 UVD/VCE on suspend[AMD Official Use Only]
Why not move changes into
hw_fini?Best Regards!
James Zhu
________________________________
From: amd-gfx <[email protected]> on behalf of Evan Quan <[email protected]>
Sent: Wednesday, August 18, 2021 11:08 PM
To: [email protected] <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Chen, Guchun <[email protected]>; Lazar, Lijo <[email protected]>; Quan, Evan <[email protected]>; Pan, Xinhui <[email protected]>
Subject: [PATCH] drm/amdgpu: add missing cleanups for Polaris12 UVD/VCE on suspendPerform proper cleanups on UVD/VCE suspend: powergate enablement, clockgating enablement and dpm disablement. This can fix some hangs observed on suspending when UVD/VCE still using(e.g. issue "pm-suspend" when video is still playing).
Quoted 5 lines
Change-Id I36f39d9731e0a9638b52d5d92558b0ee9c23a9edSigned-off-by Evan Quan <[email protected]>Signed-off-by xinhui pan <[email protected]>--- drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 24++++++++++++++++++++++++
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c| 23+++++++++++++++++++++++
Quoted 20 lines
2 files changed, 47 insertions(+)drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +9
-0@@ -554,6 +554,30 @@ static int uvd_v6_0_suspend(void *handle)int r;struct amdgpu_device *adev = (struct amdgpu_device *)handle; +/* +* Proper cleanups before halting the HW engine: +* - cancel the delayed idle work +* - enable powergating +* - enable clockgating +* - disable dpm +* +* TODO: to align with the VCN implementation, move the +* jobs for clockgating/powergating/dpm setting to drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_suspend(void *handle) · line 575
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +10
-0+* ->set_powergating_state(). +*/ +cancel_delayed_work_sync (&adev->uvd.idle_work); + +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_uvd (adev, false); + }else { +amdgpu_asic_set_uvd_clocks (adev,0 ,0 ); +/* shutdown the UVD block */ + amdgpu_device_ip_set_powergating_state(adev,
AMD_IP_BLOCK_TYPE_UVD,drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_suspend(void *handle) · line 577
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +2
-0+ AMD_PG_STATE_GATE); + amdgpu_device_ip_set_clockgating_state(adev,
AMD_IP_BLOCK_TYPE_UVD,Quoted 23 lines
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +3
-0+ AMD_CG_STATE_GATE); + } + r =uvd_v6_0_hw_fini (adev);if (r)return r;drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +8
-0@@ -503,6 +503,29 @@ static int vce_v3_0_suspend(void *handle)int r;struct amdgpu_device *adev = (struct amdgpu_device *)handle; +/* +* Proper cleanups before halting the HW engine: +* - cancel the delayed idle work +* - enable powergating +* - enable clockgating +* - disable dpm +* +* TODO: to align with the VCN implementation, move the drivers/gpu/drm/amd/amdgpu/vce_v3_0.c static int vce_v3_0_suspend(void *handle) · line 523
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +10
-0+* jobs for clockgating/powergating/dpm setting to +* ->set_powergating_state(). +*/ +cancel_delayed_work_sync (&adev->vce.idle_work); + +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_vce (adev, false); + }else { +amdgpu_asic_set_vce_clocks (adev,0 ,0 ); + amdgpu_device_ip_set_powergating_state(adev,
AMD_IP_BLOCK_TYPE_VCE,drivers/gpu/drm/amd/amdgpu/vce_v3_0.c static int vce_v3_0_suspend(void *handle) · line 525
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +2
-0+ AMD_PG_STATE_GATE); + amdgpu_device_ip_set_clockgating_state(adev,
AMD_IP_BLOCK_TYPE_VCE,Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +3
-1+ AMD_CG_STATE_GATE); + } + r =vce_v3_0_hw_fini (adev);if (r)return r; --2.29.0
[AMD Official Use Only]
From: Zhu, James <[email protected]>
Sent: Thursday, August 19, 2021 10:19 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Chen, Guchun <[email protected]>; Lazar, Lijo <[email protected]>; Pan, Xinhui <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: add missing cleanups for Polaris12 UVD/VCE on suspend
[AMD Official Use Only]
Why not move changes into hw_fini?
[Quan, Evan] Sure, I can do that. Will send out a new patch with that updated.
BR
Evan
Best Regards!
James Zhu
________________________________
From: amd-gfx <[email protected]<mailto:[email protected]>> on behalf of Evan Quan <[email protected]<mailto:[email protected]>>
Sent: Wednesday, August 18, 2021 11:08 PM
To: [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Deucher, Alexander <[email protected]<mailto:[email protected]>>; Chen, Guchun <[email protected]<mailto:[email protected]>>; Lazar, Lijo <[email protected]<mailto:[email protected]>>; Quan, Evan <[email protected]<mailto:[email protected]>>; Pan, Xinhui <[email protected]<mailto:[email protected]>>
Subject: [PATCH] drm/amdgpu: add missing cleanups for Polaris12 UVD/VCE on suspend
Perform proper cleanups on UVD/VCE suspend: powergate enablement, clockgating enablement and dpm disablement. This can fix some hangs observed on suspending when UVD/VCE still using(e.g. issue "pm-suspend" when video is still playing).
--- drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 24 ++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/vce_v3_0.c | 23 +++++++++++++++++++++++ 2 files changed, 47 insertions(+)
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +24 -0
@@ -554,6 +554,30 @@ static int uvd_v6_0_suspend(void *handle)int r;struct amdgpu_device *adev = (struct amdgpu_device *)handle; +/* +* Proper cleanups before halting the HW engine: +* - cancel the delayed idle work +* - enable powergating +* - enable clockgating +* - disable dpm +* +* TODO: to align with the VCN implementation, move the +* jobs for clockgating/powergating/dpm setting to +* ->set_powergating_state(). +*/ +cancel_delayed_work_sync (&adev->uvd.idle_work); + +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_uvd (adev, false); + }else { +amdgpu_asic_set_uvd_clocks (adev,0 ,0 ); +/* shutdown the UVD block */ +amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_UVD , +AMD_PG_STATE_GATE ); +amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_UVD , +AMD_CG_STATE_GATE ); + } + r =uvd_v6_0_hw_fini (adev);if (r)return r;
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +23 -0
@@ -503,6 +503,29 @@ static int vce_v3_0_suspend(void *handle)int r;struct amdgpu_device *adev = (struct amdgpu_device *)handle; +/* +* Proper cleanups before halting the HW engine: +* - cancel the delayed idle work +* - enable powergating +* - enable clockgating +* - disable dpm +* +* TODO: to align with the VCN implementation, move the +* jobs for clockgating/powergating/dpm setting to +* ->set_powergating_state(). +*/ +cancel_delayed_work_sync (&adev->vce.idle_work); + +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_vce (adev, false); + }else { +amdgpu_asic_set_vce_clocks (adev,0 ,0 ); +amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_VCE , +AMD_PG_STATE_GATE ); +amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_VCE , +AMD_CG_STATE_GATE ); + } + r =vce_v3_0_hw_fini (adev);if (r)return r;
--
2.29.0