Skip to content

Commit bf756fb

Browse files
Evan Quanalexdeucher
authored andcommitted
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). Signed-off-by: Evan Quan <[email protected]> Signed-off-by: xinhui pan <[email protected]> Reviewed-by: Guchun Chen <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 2f617f4 commit bf756fb

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,30 @@ static int uvd_v6_0_hw_fini(void *handle)
543543
{
544544
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
545545

546+
/*
547+
* Proper cleanups before halting the HW engine:
548+
* - cancel the delayed idle work
549+
* - enable powergating
550+
* - enable clockgating
551+
* - disable dpm
552+
*
553+
* TODO: to align with the VCN implementation, move the
554+
* jobs for clockgating/powergating/dpm setting to
555+
* ->set_powergating_state().
556+
*/
557+
cancel_delayed_work_sync(&adev->uvd.idle_work);
558+
559+
if (adev->pm.dpm_enabled) {
560+
amdgpu_dpm_enable_uvd(adev, false);
561+
} else {
562+
amdgpu_asic_set_uvd_clocks(adev, 0, 0);
563+
/* shutdown the UVD block */
564+
amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_UVD,
565+
AMD_PG_STATE_GATE);
566+
amdgpu_device_ip_set_clockgating_state(adev, AMD_IP_BLOCK_TYPE_UVD,
567+
AMD_CG_STATE_GATE);
568+
}
569+
546570
if (RREG32(mmUVD_STATUS) != 0)
547571
uvd_v6_0_stop(adev);
548572

drivers/gpu/drm/amd/amdgpu/vce_v3_0.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,29 @@ static int vce_v3_0_hw_fini(void *handle)
490490
int r;
491491
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
492492

493+
/*
494+
* Proper cleanups before halting the HW engine:
495+
* - cancel the delayed idle work
496+
* - enable powergating
497+
* - enable clockgating
498+
* - disable dpm
499+
*
500+
* TODO: to align with the VCN implementation, move the
501+
* jobs for clockgating/powergating/dpm setting to
502+
* ->set_powergating_state().
503+
*/
504+
cancel_delayed_work_sync(&adev->vce.idle_work);
505+
506+
if (adev->pm.dpm_enabled) {
507+
amdgpu_dpm_enable_vce(adev, false);
508+
} else {
509+
amdgpu_asic_set_vce_clocks(adev, 0, 0);
510+
amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_VCE,
511+
AMD_PG_STATE_GATE);
512+
amdgpu_device_ip_set_clockgating_state(adev, AMD_IP_BLOCK_TYPE_VCE,
513+
AMD_CG_STATE_GATE);
514+
}
515+
493516
r = vce_v3_0_wait_for_idle(handle);
494517
if (r)
495518
return r;

0 commit comments

Comments
 (0)