machines/home: add amd gpu patch
This commit is contained in:
parent
2d7911a3a0
commit
07cb32d30e
3 changed files with 58 additions and 0 deletions
|
@ -4,6 +4,7 @@
|
||||||
imports = [
|
imports = [
|
||||||
# Include the results of the hardware scan.
|
# Include the results of the hardware scan.
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
|
./patches.nix
|
||||||
../modules/common.nix
|
../modules/common.nix
|
||||||
../modules/sound.nix
|
../modules/sound.nix
|
||||||
../modules/window_manager.nix
|
../modules/window_manager.nix
|
||||||
|
|
20
machines/home/patches.nix
Normal file
20
machines/home/patches.nix
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
# Fix black screen after resuming from suspend
|
||||||
|
# Source: https://discourse.nixos.org/t/black-screen-when-resuming-from-suspend/10299
|
||||||
|
#
|
||||||
|
# Issue: https://gitlab.freedesktop.org/drm/amd/-/issues/2223
|
||||||
|
# Fixed in 6.1-rc4
|
||||||
|
specialisation."amdgpu-patch-2223" = {
|
||||||
|
inheritParentConfig = true;
|
||||||
|
configuration = {
|
||||||
|
boot.loader.grub.configurationName = "amdgpu-patch-2223";
|
||||||
|
#boot.kernelPackages = pkgs.linuxPackages_6_0;
|
||||||
|
boot.kernelPatches = [
|
||||||
|
{
|
||||||
|
name = "amdgpu-patch";
|
||||||
|
patch = ./patches/fail_suspend.patch;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
37
machines/home/patches/fail_suspend.patch
Normal file
37
machines/home/patches/fail_suspend.patch
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
|
||||||
|
index fb9b9349215b8..12c69b7ee54df 100644
|
||||||
|
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
|
||||||
|
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
|
||||||
|
@@ -4047,15 +4047,17 @@ void amdgpu_device_fini_sw(struct amdgpu_device *adev)
|
||||||
|
* at suspend time.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
-static void amdgpu_device_evict_resources(struct amdgpu_device *adev)
|
||||||
|
+static int amdgpu_device_evict_resources(struct amdgpu_device *adev)
|
||||||
|
{
|
||||||
|
+ int ret;
|
||||||
|
/* No need to evict vram on APUs for suspend to ram or s2idle */
|
||||||
|
if ((adev->in_s3 || adev->in_s0ix) && (adev->flags & AMD_IS_APU))
|
||||||
|
- return;
|
||||||
|
+ return 0;
|
||||||
|
|
||||||
|
- if (amdgpu_ttm_evict_resources(adev, TTM_PL_VRAM))
|
||||||
|
+ ret = amdgpu_ttm_evict_resources(adev, TTM_PL_VRAM);
|
||||||
|
+ if (ret)
|
||||||
|
DRM_WARN("evicting device resources failed\n");
|
||||||
|
-
|
||||||
|
+ return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
@@ -4105,7 +4107,9 @@ int amdgpu_device_suspend(struct drm_device *dev, bool fbcon)
|
||||||
|
if (!adev->in_s0ix)
|
||||||
|
amdgpu_amdkfd_suspend(adev, adev->in_runpm);
|
||||||
|
|
||||||
|
- amdgpu_device_evict_resources(adev);
|
||||||
|
+ r = amdgpu_device_evict_resources(adev);
|
||||||
|
+ if (r)
|
||||||
|
+ return r;
|
||||||
|
|
||||||
|
amdgpu_fence_driver_hw_fini(adev);
|
||||||
|
|
Loading…
Reference in a new issue