Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Mario Limonciello and committed by
Alex Deucher
68bfdc8d 0d1a686b

+14 -2
+9 -2
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
··· 2563 2563 int r; 2564 2564 2565 2565 r = amdgpu_device_suspend(drm_dev, true); 2566 - adev->in_s4 = false; 2567 2566 if (r) 2568 2567 return r; 2569 2568 ··· 2574 2575 static int amdgpu_pmops_thaw(struct device *dev) 2575 2576 { 2576 2577 struct drm_device *drm_dev = dev_get_drvdata(dev); 2578 + struct amdgpu_device *adev = drm_to_adev(drm_dev); 2579 + int r; 2577 2580 2578 - return amdgpu_device_resume(drm_dev, true); 2581 + r = amdgpu_device_resume(drm_dev, true); 2582 + adev->in_s4 = false; 2583 + 2584 + return r; 2579 2585 } 2580 2586 2581 2587 static int amdgpu_pmops_poweroff(struct device *dev) ··· 2593 2589 static int amdgpu_pmops_restore(struct device *dev) 2594 2590 { 2595 2591 struct drm_device *drm_dev = dev_get_drvdata(dev); 2592 + struct amdgpu_device *adev = drm_to_adev(drm_dev); 2593 + 2594 + adev->in_s4 = false; 2596 2595 2597 2596 return amdgpu_device_resume(drm_dev, true); 2598 2597 }
+5
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
··· 3434 3434 3435 3435 return 0; 3436 3436 } 3437 + 3438 + /* leave display off for S4 sequence */ 3439 + if (adev->in_s4) 3440 + return 0; 3441 + 3437 3442 /* Recreate dc_state - DC invalidates it when setting power state to S3. */ 3438 3443 dc_state_release(dm_state->context); 3439 3444 dm_state->context = dc_state_create(dm->dc, NULL);