From 951601ccab7c3e8f9afa3ed78f2046863e6fa81d Mon Sep 17 00:00:00 2001 From: K900 Date: Sun, 16 Jun 2024 13:39:52 +0300 Subject: [PATCH] treewide: drop amdgpu-pro It's dead, Jim. --- .../manual/configuration/x-windows.chapter.md | 17 -- nixos/modules/hardware/video/amdgpu-pro.nix | 69 ------ nixos/modules/module-list.nix | 1 - nixos/modules/services/x11/xserver.nix | 2 +- pkgs/os-specific/linux/amdgpu-pro/default.nix | 222 ------------------ pkgs/top-level/linux-kernels.nix | 3 +- 6 files changed, 2 insertions(+), 312 deletions(-) delete mode 100644 nixos/modules/hardware/video/amdgpu-pro.nix delete mode 100644 pkgs/os-specific/linux/amdgpu-pro/default.nix diff --git a/nixos/doc/manual/configuration/x-windows.chapter.md b/nixos/doc/manual/configuration/x-windows.chapter.md index 31752330dd9a8..172f29723b01b 100644 --- a/nixos/doc/manual/configuration/x-windows.chapter.md +++ b/nixos/doc/manual/configuration/x-windows.chapter.md @@ -183,23 +183,6 @@ If you have an older card, you may have to use one of the legacy drivers: You may need to reboot after enabling this driver to prevent a clash with other kernel modules. -## Proprietary AMD drivers {#sec-x11--graphics-cards-amd} - -AMD provides a proprietary driver for its graphics cards that is not -enabled by default because it's not Free Software, is often broken in -nixpkgs and as of this writing doesn't offer more features or -performance. If you still want to use it anyway, you need to explicitly -set: - -```nix -{ - services.xserver.videoDrivers = [ "amdgpu-pro" ]; -} -``` - -You will need to reboot after enabling this driver to prevent a clash -with other kernel modules. - ## Touchpads {#sec-x11-touchpads} Support for Synaptics touchpads (found in many laptops such as the Dell diff --git a/nixos/modules/hardware/video/amdgpu-pro.nix b/nixos/modules/hardware/video/amdgpu-pro.nix deleted file mode 100644 index 2a86280eec8cb..0000000000000 --- a/nixos/modules/hardware/video/amdgpu-pro.nix +++ /dev/null @@ -1,69 +0,0 @@ -# This module provides the proprietary AMDGPU-PRO drivers. - -{ config, lib, pkgs, ... }: - -with lib; - -let - - drivers = config.services.xserver.videoDrivers; - - enabled = elem "amdgpu-pro" drivers; - - package = config.boot.kernelPackages.amdgpu-pro; - package32 = pkgs.pkgsi686Linux.linuxPackages.amdgpu-pro.override { kernel = null; }; - - opengl = config.hardware.opengl; - -in - -{ - - config = mkIf enabled { - services.xserver.drivers = singleton - { name = "amdgpu"; modules = [ package ]; display = true; }; - - hardware.opengl.package = package; - hardware.opengl.package32 = package32; - hardware.opengl.setLdLibraryPath = true; - - boot.extraModulePackages = [ package.kmod ]; - - boot.kernelPackages = pkgs.linuxKernel.packagesFor - (pkgs.linuxKernel.kernels.linux_5_10.override { - structuredExtraConfig = { - DEVICE_PRIVATE = kernel.yes; - KALLSYMS_ALL = kernel.yes; - }; - }); - - hardware.firmware = [ package.fw ]; - - systemd.tmpfiles.settings.amdgpu-pro = { - "/run/amdgpu"."L+".argument = "${package}/opt/amdgpu"; - "/run/amdgpu-pro"."L+".argument = "${package}/opt/amdgpu-pro"; - }; - - system.requiredKernelConfig = with config.lib.kernelConfig; [ - (isYes "DEVICE_PRIVATE") - (isYes "KALLSYMS_ALL") - ]; - - boot.initrd.extraUdevRulesCommands = mkIf (!config.boot.initrd.systemd.enable) '' - cp -v ${package}/etc/udev/rules.d/*.rules $out/ - ''; - boot.initrd.services.udev.packages = [ package ]; - - environment.systemPackages = - [ package.vulkan ] ++ - # this isn't really DRI, but we'll reuse this option for now - optional config.hardware.opengl.driSupport32Bit package32.vulkan; - - environment.etc = { - "modprobe.d/blacklist-radeon.conf".source = package + "/etc/modprobe.d/blacklist-radeon.conf"; - amd.source = package + "/etc/amd"; - }; - - }; - -} diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index b20e98a9f229b..77b39c6db353d 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -103,7 +103,6 @@ ./hardware/uni-sync.nix ./hardware/usb-modeswitch.nix ./hardware/usb-storage.nix - ./hardware/video/amdgpu-pro.nix ./hardware/video/bumblebee.nix ./hardware/video/capture/mwprocapture.nix ./hardware/video/displaylink.nix diff --git a/nixos/modules/services/x11/xserver.nix b/nixos/modules/services/x11/xserver.nix index 5a86d055c2719..48cd8cef13477 100644 --- a/nixos/modules/services/x11/xserver.nix +++ b/nixos/modules/services/x11/xserver.nix @@ -302,7 +302,7 @@ in default = [ "modesetting" "fbdev" ]; example = [ "nvidia" - "amdgpu-pro" + "amdgpu" ]; # TODO(@oxij): think how to easily add the rest, like those nvidia things relatedPackages = concatLists diff --git a/pkgs/os-specific/linux/amdgpu-pro/default.nix b/pkgs/os-specific/linux/amdgpu-pro/default.nix deleted file mode 100644 index ade6da99810b2..0000000000000 --- a/pkgs/os-specific/linux/amdgpu-pro/default.nix +++ /dev/null @@ -1,222 +0,0 @@ -{ lib -, stdenv -, fetchurl -, elfutils -, xorg -, patchelf -, libxcb -, libxshmfence -, perl -, zlib -, expat -, libffi_3_3 -, libselinux -, libdrm -, udev -, kernel ? null -}: - -with lib; - -let - - bitness = if stdenv.is64bit then "64" else "32"; - - libArch = - if stdenv.hostPlatform.system == "i686-linux" then - "i386-linux-gnu" - else if stdenv.hostPlatform.system == "x86_64-linux" then - "x86_64-linux-gnu" - else throw "amdgpu-pro is Linux only. Sorry ${stdenv.hostPlatform.system}."; - -in stdenv.mkDerivation rec { - - version = "21.30"; - pname = "amdgpu-pro"; - build = "${version}-1290604"; - - src = fetchurl { - url = "https://drivers.amd.com/drivers/linux/amdgpu-pro-${build}-ubuntu-20.04.tar.xz"; - sha256 = "sha256-WECqxjo2WLP3kMWeVyJgYufkvHTzwGaj57yeMGXiQ4I="; - curlOpts = "--referer https://www.amd.com/en/support/kb/release-notes/rn-amdgpu-unified-linux-21-30"; - }; - - postUnpack = '' - mkdir root - pushd $sourceRoot - for deb in *_all.deb *_${if stdenv.is64bit then "amd64" else "i386"}.deb - do - ar p $deb data.tar.xz | tar -C ../root -xJ - done - popd - # if we don't use a short sourceRoot, compilation can fail due to command - # line length - sourceRoot=root - ''; - - passthru = optionalAttrs (kernel != null) { - kmod = stdenv.mkDerivation rec { - inherit version src postUnpack; - name = "${pname}-${version}-kmod-${kernel.dev.version}"; - - postPatch = '' - pushd usr/src/amdgpu-* - patchShebangs amd/dkms/*.sh - substituteInPlace amd/dkms/pre-build.sh --replace "./configure" "./configure --with-linux=${kernel.dev}/lib/modules/${kernel.modDirVersion}/source --with-linux-obj=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" - popd - ''; - - preConfigure = '' - pushd usr/src/amdgpu-* - makeFlags="$makeFlags M=$(pwd)" - amd/dkms/pre-build.sh ${kernel.version} - popd - ''; - - postBuild = '' - pushd usr/src/amdgpu-* - find -name \*.ko -exec xz {} \; - popd - ''; - - makeFlags = optionalString (kernel != null) "-C ${kernel.dev}/lib/modules/${kernel.modDirVersion}/build modules"; - - installPhase = '' - runHook preInstall - - pushd usr/src/amdgpu-* - find -name \*.ko.xz -exec install -Dm444 {} $out/lib/modules/${kernel.modDirVersion}/kernel/drivers/gpu/drm/{} \; - popd - - runHook postInstall - ''; - - # without this we get a collision with the ttm module from linux - meta.priority = 4; - }; - - fw = stdenv.mkDerivation rec { - inherit version src postUnpack; - name = "${pname}-${version}-fw"; - - installPhase = '' - runHook preInstall - - mkdir -p $out/lib - cp -r usr/src/amdgpu-*/firmware $out/lib/firmware - - runHook postInstall - ''; - }; - }; - - outputs = [ "out" "vulkan" ]; - - depLibPath = makeLibraryPath [ - stdenv.cc.cc.lib - zlib - libxcb - libxshmfence - elfutils - expat - libffi_3_3 - libselinux - # libudev is not listed in any dependencies, but is loaded dynamically - udev - xorg.libXext - xorg.libX11 - xorg.libXfixes - xorg.libXdamage - xorg.libXxf86vm - ]; - - installPhase = '' - runHook preInstall - - mkdir -p $out - - cp -r usr/lib/${libArch} $out/lib - cp -r usr/share $out/share - - mkdir -p $out/opt/amdgpu{,-pro} - cp -r opt/amdgpu-pro/lib/${libArch} $out/opt/amdgpu-pro/lib - cp -r opt/amdgpu/lib/${libArch} $out/opt/amdgpu/lib - - pushd $out/lib - ln -s ../opt/amdgpu-pro/lib/libGL.so* . - ln -s ../opt/amdgpu-pro/lib/libEGL.so* . - popd - - # short name to allow replacement below - ln -s lib/dri $out/dri - - '' + optionalString (stdenv.is64bit) '' - mkdir -p $out/etc - pushd etc - cp -r modprobe.d udev amd $out/etc - popd - - cp -r lib/udev/rules.d/* $out/etc/udev/rules.d - cp -r opt/amdgpu/lib/xorg $out/lib/xorg - cp -r opt/amdgpu-pro/lib/xorg/* $out/lib/xorg - cp -r opt/amdgpu/share $out/opt/amdgpu/share - '' + '' - - mkdir -p $vulkan/share/vulkan/icd.d - install opt/amdgpu-pro/etc/vulkan/icd.d/amd_icd${bitness}.json $vulkan/share/vulkan/icd.d - - runHook postInstall - ''; - - preFixup = (if stdenv.is64bit - # this could also be done with LIBGL_DRIVERS_PATH, but it would need to be - # set in the user session and for Xorg - then '' - expr1='s:/opt/amdgpu/lib/x86_64-linux-gnu/dri\0:/run/opengl-driver/lib/dri\0\0\0\0\0\0\0\0\0\0\0:g' - expr2='s:/usr/lib/x86_64-linux-gnu/dri[\0\:]:/run/opengl-driver/lib/dri\0\0\0\0:g' - perl -pi -e "$expr2" $out/lib/xorg/modules/extensions/libglx.so - '' - else '' - expr1='s:/opt/amdgpu/lib/i386-linux-gnu/dri\0:/run/opengl-driver-32/lib/dri\0\0\0\0\0\0:g' - # we replace a different path on 32-bit because it's the only one long - # enough to fit the target path :( - expr2='s:/usr/lib/i386-linux-gnu/dri[\0\:]:/run/opengl-driver-32/dri\0\0\0:g' - '') + '' - perl -pi -e "$expr1" \ - $out/opt/amdgpu/lib/libEGL.so.1.0.0 \ - $out/opt/amdgpu/lib/libgbm.so.1.0.0 \ - $out/opt/amdgpu/lib/libGL.so.1.2.0 - - perl -pi -e "$expr2" \ - $out/opt/amdgpu-pro/lib/libEGL.so.1 \ - $out/opt/amdgpu-pro/lib/libGL.so.1.2 \ - $out/opt/amdgpu-pro/lib/libGLX_amd.so.0 - - find $out -type f -exec perl -pi -e 's:/opt/amdgpu-pro/:/run/amdgpu-pro/:g' {} \; - find $out -type f -exec perl -pi -e 's:/opt/amdgpu/:/run/amdgpu/:g' {} \; - - substituteInPlace $vulkan/share/vulkan/icd.d/*.json --replace /opt/amdgpu-pro/lib/${libArch} "$out/opt/amdgpu-pro/lib" - ''; - - # doing this in post because shrinking breaks things that dynamically load - postFixup = '' - libPath="$out/opt/amdgpu/lib:$out/opt/amdgpu-pro/lib:$depLibPath" - find "$out" -name '*.so*' -type f -exec patchelf --set-rpath "$libPath" {} \; - ''; - - buildInputs = [ - libdrm - patchelf - perl - ]; - - enableParallelBuilding = true; - - meta = with lib; { - description = "AMDGPU-PRO drivers"; - homepage = "https://www.amd.com/en/support"; - license = licenses.unfree; - platforms = platforms.linux; - maintainers = with maintainers; [ corngood ]; - }; -} diff --git a/pkgs/top-level/linux-kernels.nix b/pkgs/top-level/linux-kernels.nix index 8f491dd848b58..db0c819e69935 100644 --- a/pkgs/top-level/linux-kernels.nix +++ b/pkgs/top-level/linux-kernels.nix @@ -318,8 +318,6 @@ in { akvcam = callPackage ../os-specific/linux/akvcam { }; - amdgpu-pro = callPackage ../os-specific/linux/amdgpu-pro { }; - apfs = callPackage ../os-specific/linux/apfs { }; ax99100 = callPackage ../os-specific/linux/ax99100 {}; @@ -605,6 +603,7 @@ in { rtl8723bs = throw "rtl8723bs was added in mainline kernel version 4.12"; # Added 2023-06-14 vm-tools = self.mm-tools; xmm7360-pci = throw "Support for the XMM7360 WWAN card was added to the iosm kmod in mainline kernel version 5.18"; + amdgpu-pro = throw "amdgpu-pro was removed due to lack of maintenance"; # Added 2024-06-16 }); hardenedPackagesFor = kernel: overrides: packagesFor (hardenedKernelFor kernel overrides);