Skip to content

Commit 68bfdc8

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>
1 parent 0d1a686 commit 68bfdc8

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
@@ -2563,7 +2563,6 @@ static int amdgpu_pmops_freeze(struct device *dev)
25632563
int r;
25642564

25652565
r = amdgpu_device_suspend(drm_dev, true);
2566-
adev->in_s4 = false;
25672566
if (r)
25682567
return r;
25692568

@@ -2575,8 +2574,13 @@ static int amdgpu_pmops_freeze(struct device *dev)
25752574
static int amdgpu_pmops_thaw(struct device *dev)
25762575
{
25772576
struct drm_device *drm_dev = dev_get_drvdata(dev);
2577+
struct amdgpu_device *adev = drm_to_adev(drm_dev);
2578+
int r;
25782579

2579-
return amdgpu_device_resume(drm_dev, true);
2580+
r = amdgpu_device_resume(drm_dev, true);
2581+
adev->in_s4 = false;
2582+
2583+
return r;
25802584
}
25812585

25822586
static int amdgpu_pmops_poweroff(struct device *dev)
@@ -2589,6 +2593,9 @@ static int amdgpu_pmops_poweroff(struct device *dev)
25892593
static int amdgpu_pmops_restore(struct device *dev)
25902594
{
25912595
struct drm_device *drm_dev = dev_get_drvdata(dev);
2596+
struct amdgpu_device *adev = drm_to_adev(drm_dev);
2597+
2598+
adev->in_s4 = false;
25922599

25932600
return amdgpu_device_resume(drm_dev, true);
25942601
}

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

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

34353435
return 0;
34363436
}
3437+
3438+
/* leave display off for S4 sequence */
3439+
if (adev->in_s4)
3440+
return 0;
3441+
34373442
/* Recreate dc_state - DC invalidates it when setting power state to S3. */
34383443
dc_state_release(dm_state->context);
34393444
dm_state->context = dc_state_create(dm->dc, NULL);

0 commit comments

Comments
 (0)