From 36525d00053dc0e94536d7a15db4bd8aeecd8874 Mon Sep 17 00:00:00 2001 From: Vasiliy Stelmachenok Date: Sat, 28 Mar 2026 21:05:05 +0300 Subject: [PATCH 1/2] profiles/nvidia: Eliminate early KMS usage in favor of proper systemd chainload Signed-off-by: Vasiliy Stelmachenok --- profiles/pci/graphic_drivers/profiles.toml | 35 ++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/profiles/pci/graphic_drivers/profiles.toml b/profiles/pci/graphic_drivers/profiles.toml index 07bb560..f523b02 100644 --- a/profiles/pci/graphic_drivers/profiles.toml +++ b/profiles/pci/graphic_drivers/profiles.toml @@ -48,9 +48,36 @@ conditional_packages = """ """ pre_install = """ - cat </etc/mkinitcpio.conf.d/10-chwd.conf + cat << 'EOF' | install -Dm644 /dev/stdin /etc/udev/rules.d/30-chwd-nvidia.rules # This file is automatically generated by chwd. PLEASE DO NOT EDIT IT. -MODULES+=(nvidia nvidia_modeset nvidia_uvm nvidia_drm) +ACTION=="add", SUBSYSTEM=="module", KERNEL=="nvidia_drm", TAG+="systemd", ENV{SYSTEMD_WANTS}+="nvidia-module-load.target" +EOF + + cat << 'EOF' | install -Dm644 /dev/stdin /etc/systemd/system/nvidia-module-load.target +# This file is automatically generated by chwd. PLEASE DO NOT EDIT IT. +[Unit] +Description=NVIDIA module load target +Documentation=man:systemd.special(7) +JobTimeoutSec=10s + +# Make this a synchronization point on NVIDIA module load +After=sys-module-nvidia_drm.device +Wants=sys-module-nvidia_drm.device +EOF + + mkdir -p /etc/systemd/system/getty@.service.d /etc/systemd/system/display-manager.service.d + cat << 'EOF' | install -Dm644 /dev/stdin /etc/systemd/system/getty@.service.d/30-chwd-nvidia.conf +# This file is automatically generated by chwd. PLEASE DO NOT EDIT IT. +[Unit] +Wants=nvidia-module-load.target +After=nvidia-module-load.target +EOF + + cat << 'EOF' | install -Dm644 /dev/stdin /etc/systemd/system/display-manager.service.d/30-chwd-nvidia.conf +# This file is automatically generated by chwd. PLEASE DO NOT EDIT IT. +[Unit] +Wants=nvidia-module-load.target +After=nvidia-module-load.target EOF # Remove kms hook from mkinitcpio.conf on desktops @@ -92,6 +119,10 @@ EOF pre_remove = """ rm -f /etc/mkinitcpio.conf.d/10-chwd.conf rm -f /etc/mkinitcpio.conf.d/10-chwd-kms.conf + rm -f /etc/udev/rules.d/30-chwd-nvidia.rules + rm -f /etc/systemd/system/getty@.service.d/30-chwd-nvidia.conf + rm -f /etc/systemd/system/display-manager.service.d/30-chwd-nvidia.conf + rm -f /etc/systemd/system/nvidia-module-load.target """ post_remove = """ rm -f /etc/profile.d/nvidia-rtd3-workaround.sh From b328f816741775ec4f8381e15ddce473385c679a Mon Sep 17 00:00:00 2001 From: Vasiliy Stelmachenok Date: Mon, 30 Mar 2026 21:53:05 +0300 Subject: [PATCH 2/2] profiles/amd: Eliminate early KMS usage in favor of proper systemd chainload Signed-off-by: Vasiliy Stelmachenok --- profiles/pci/graphic_drivers/profiles.toml | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/profiles/pci/graphic_drivers/profiles.toml b/profiles/pci/graphic_drivers/profiles.toml index f523b02..7a87f2e 100644 --- a/profiles/pci/graphic_drivers/profiles.toml +++ b/profiles/pci/graphic_drivers/profiles.toml @@ -344,6 +344,50 @@ if [ -z "$(lspci -d "10de:*:030x")" ]; then echo "opencl-mesa lib32-opencl-mesa" fi """ +pre_install = """ + cat << 'EOF' | install -Dm644 /dev/stdin /etc/udev/rules.d/30-chwd-amdgpu.rules +# This file is automatically generated by chwd. PLEASE DO NOT EDIT IT. +ACTION=="add", SUBSYSTEM=="module", KERNEL=="amdgpu", TAG+="systemd", ENV{SYSTEMD_WANTS}+="amdgpu-module-load.target" +EOF + + cat << 'EOF' | install -Dm644 /dev/stdin /etc/systemd/system/amdgpu-module-load.target +# This file is automatically generated by chwd. PLEASE DO NOT EDIT IT. +[Unit] +Description=amdgpu module load target +Documentation=man:systemd.special(7) +JobTimeoutSec=10s + +# Make this a synchronization point on amdgpu module load +After=sys-module-amdgpu.device +Wants=sys-module-amdgpu.device +EOF + + mkdir -p /etc/systemd/system/getty@.service.d /etc/systemd/system/display-manager.service.d + cat << 'EOF' | install -Dm644 /dev/stdin /etc/systemd/system/getty@.service.d/30-chwd-amdgpu.conf +# This file is automatically generated by chwd. PLEASE DO NOT EDIT IT. +[Unit] +Wants=amdgpu-module-load.target +After=amdgpu-module-load.target +EOF + + cat << 'EOF' | install -Dm644 /dev/stdin /etc/systemd/system/display-manager.service.d/30-chwd-amdgpu.conf +# This file is automatically generated by chwd. PLEASE DO NOT EDIT IT. +[Unit] +Wants=amdgpu-module-load.target +After=amdgpu-module-load.target +EOF + + cat <<'EOF' >/etc/mkinitcpio.conf.d/10-chwd-amdgpu-kms.conf +# This file is automatically generated by chwd. PLEASE DO NOT EDIT IT. +HOOKS=(${HOOKS[@]/kms/}) +EOF +""" +pre_remove = """ + rm -f /etc/udev/rules.d/30-chwd-amdgpu.rules + rm -f /etc/systemd/system/getty@.service.d/30-chwd-amdgpu.conf + rm -f /etc/systemd/system/display-manager.service.d/30-chwd-amdgpu.conf + rm -f /etc/systemd/system/amdgpu-module-load.target +""" [fallback] desc = 'Fallback profile'