Skip to content

Commit 4afacc9

Browse files
superm1alexdeucher
authored andcommitted
drm/amd: Keep display off while going into S4
When userspace invokes S4 the flow is: 1) amdgpu_pmops_prepare() 2) amdgpu_pmops_freeze() 3) Create hibernation image 4) amdgpu_pmops_thaw() 5) Write out image to disk 6) Turn off system Then on resume amdgpu_pmops_restore() is called. This flow has a problem that because amdgpu_pmops_thaw() is called it will call amdgpu_device_resume() which will resume all of the GPU. This includes turning the display hardware back on and discovering connectors again. This is an unexpected experience for the display to turn back on. Adjust the flow so that during the S4 sequence display hardware is not turned back on. Reported-by: Xaver Hugl <xaver.hugl@gmail.com> Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/2038 Cc: Muhammad Usama Anjum <usama.anjum@collabora.com> Tested-by: Muhammad Usama Anjum <usama.anjum@collabora.com> Acked-by: Alex Deucher <alexander.deucher@amd.com> Acked-by: Harry Wentland <harry.wentland@amd.com> Link: https://lore.kernel.org/r/20250306185124.44780-1-mario.limonciello@amd.com Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 68bfdc8)
1 parent e204aab commit 4afacc9

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2555,7 +2555,6 @@ static int amdgpu_pmops_freeze(struct device *dev)
25552555
int r;
25562556

25572557
r = amdgpu_device_suspend(drm_dev, true);
2558-
adev->in_s4 = false;
25592558
if (r)
25602559
return r;
25612560

@@ -2567,8 +2566,13 @@ static int amdgpu_pmops_freeze(struct device *dev)
25672566
static int amdgpu_pmops_thaw(struct device *dev)
25682567
{
25692568
struct drm_device *drm_dev = dev_get_drvdata(dev);
2569+
struct amdgpu_device *adev = drm_to_adev(drm_dev);
2570+
int r;
25702571

2571-
return amdgpu_device_resume(drm_dev, true);
2572+
r = amdgpu_device_resume(drm_dev, true);
2573+
adev->in_s4 = false;
2574+
2575+
return r;
25722576
}
25732577

25742578
static int amdgpu_pmops_poweroff(struct device *dev)
@@ -2581,6 +2585,9 @@ static int amdgpu_pmops_poweroff(struct device *dev)
25812585
static int amdgpu_pmops_restore(struct device *dev)
25822586
{
25832587
struct drm_device *drm_dev = dev_get_drvdata(dev);
2588+
struct amdgpu_device *adev = drm_to_adev(drm_dev);
2589+
2590+
adev->in_s4 = false;
25842591

25852592
return amdgpu_device_resume(drm_dev, true);
25862593
}

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3373,6 +3373,11 @@ static int dm_resume(struct amdgpu_ip_block *ip_block)
33733373

33743374
return 0;
33753375
}
3376+
3377+
/* leave display off for S4 sequence */
3378+
if (adev->in_s4)
3379+
return 0;
3380+
33763381
/* Recreate dc_state - DC invalidates it when setting power state to S3. */
33773382
dc_state_release(dm_state->context);
33783383
dm_state->context = dc_state_create(dm->dc, NULL);

0 commit comments

Comments
 (0)