From e7af4b04bc4c3f9d02fd88554b37a974f1ba67f5 Mon Sep 17 00:00:00 2001 From: Oleh Nykyforchyn Date: Sun, 3 May 2026 21:37:52 +0300 Subject: [PATCH] (release) xserver: config: split 10-nvidia.conf file XLibre 10-nvidia.conf is extended w.r.t. XOrg version and can be overwritten by NVidia installers or packages, hence it is safer to split it into 10-nvidia.conf (a common part) and 10-nvidia-modules.conf (an extra part). This patch also provides /etc/X11/xorg.conf.d/10-nvidia.conf.debian and /etc/X11/xorg.conf.d/10-nvidia-modules.conf.debian files that, when .debian suffix is removed, shadow the respective files in /usr/share/X11/xorg.conf.d and set Debian specific search directories for drivers and modules. Signed-off-by: Oleh Nykyforchyn --- config/10-nvidia-modules.conf.debian.in | 16 ++++++++++++++++ config/10-nvidia-modules.conf.in | 15 +++++++++++++++ config/10-nvidia.conf.debian.in | 16 ++++++++++++++++ config/10-nvidia.conf.in | 19 +++++++++---------- config/meson.build | 18 ++++++++++++++++++ 5 files changed, 74 insertions(+), 10 deletions(-) create mode 100644 config/10-nvidia-modules.conf.debian.in create mode 100644 config/10-nvidia-modules.conf.in create mode 100644 config/10-nvidia.conf.debian.in diff --git a/config/10-nvidia-modules.conf.debian.in b/config/10-nvidia-modules.conf.debian.in new file mode 100644 index 0000000000..9b07698381 --- /dev/null +++ b/config/10-nvidia-modules.conf.debian.in @@ -0,0 +1,16 @@ +# This xorg.conf.d configuration snippet is a Debian version of a supplement to +# /etc/X11/xorg.conf.d/10-nvidia.conf that sets module paths for nvidia GLX libraries +# when it detects a device driven by the nvidia-drm kernel driver. +# Please note that this works on Linux kernels version 6.12 or higher +# with CONFIG_DRM enabled, and only if the nvidia-drm.ko kernel module +# for the versions 390 and later of the nvidia driver or the nvidia.ko +# kernel module for the version 340 is loaded before the X server is started. + +Section "OutputClass" + Identifier "NVidia-modules" + MatchDriver "nvidia-drm" + Module "glx" + Module "glxserver_nvidia" + # Debian specific directories + ModulePath "/usr/lib/x86_64-linux-gnu/nvidia/xorg,/usr/lib/nvidia/nvidia" +EndSection diff --git a/config/10-nvidia-modules.conf.in b/config/10-nvidia-modules.conf.in new file mode 100644 index 0000000000..3063804c4b --- /dev/null +++ b/config/10-nvidia-modules.conf.in @@ -0,0 +1,15 @@ +# This xorg.conf.d configuration snippet is a supplement to +# 10-nvidia.conf that sets module paths for nvidia GLX libraries +# when it detects a device driven by the nvidia-drm kernel driver. +# Please note that this works on Linux kernels version 6.12 or higher +# with CONFIG_DRM enabled, and only if the nvidia-drm.ko kernel module +# for the versions 390 and later of the nvidia driver or the nvidia.ko +# kernel module for the version 340 is loaded before the X server is started. + +Section "OutputClass" + Identifier "NVidia-modules" + MatchDriver "nvidia-drm" + Module "glx" + Module "glxserver_nvidia" + ModulePath "@libdir@/nvidia/xorg" +EndSection diff --git a/config/10-nvidia.conf.debian.in b/config/10-nvidia.conf.debian.in new file mode 100644 index 0000000000..018dc1b24c --- /dev/null +++ b/config/10-nvidia.conf.debian.in @@ -0,0 +1,16 @@ +# This xorg.conf.d configuration snippet for Debian configures the X server to +# automatically load the nvidia X driver when it detects a device +# driven by the nvidia-drm kernel driver. +# Please note that this works on Linux kernels version 6.12 or higher +# with CONFIG_DRM enabled, and only if the nvidia-drm.ko kernel module +# for the versions 390 and later of the nvidia driver or the nvidia.ko +# kernel module for the version 340 is loaded before the X server is started. + +Section "OutputClass" + Identifier "NVidia" + MatchDriver "nvidia-drm" + Driver "nvidia" + Option "AllowEmptyInitialConfiguration" + # Debian specific directories + ModulePath "/usr/lib/x86_64-linux-gnu/nvidia/xorg,/usr/lib/nvidia/nvidia" +EndSection diff --git a/config/10-nvidia.conf.in b/config/10-nvidia.conf.in index ff7236289a..315bf98992 100644 --- a/config/10-nvidia.conf.in +++ b/config/10-nvidia.conf.in @@ -1,16 +1,15 @@ # This xorg.conf.d configuration snippet configures the X server to -# automatically load the nvidia X driver and nvidia GLX libraries -# when it detects a device driven by nvidia-drm.ko kernel module. +# automatically load the nvidia X driver when it detects a device +# driven by the nvidia-drm kernel driver. # Please note that this works on Linux kernels version 6.12 or higher # with CONFIG_DRM enabled, and only if the nvidia-drm.ko kernel module -# is loaded before the X server is started. +# for the versions 390 and later of the nvidia driver or the nvidia.ko +# kernel module for the version 340 is loaded before the X server is started. Section "OutputClass" - Identifier "NVidia" - MatchDriver "nvidia-drm" - Driver "nvidia" - Module "glx" - Module "glxserver_nvidia" - Option "AllowEmptyInitialConfiguration" - ModulePath "@libdir@/nvidia/xorg" + Identifier "NVidia" + MatchDriver "nvidia-drm" + Driver "nvidia" + Option "AllowEmptyInitialConfiguration" + ModulePath "@libdir@/nvidia/xorg" EndSection diff --git a/config/meson.build b/config/meson.build index a4f73c7cd1..b6f9e3987f 100644 --- a/config/meson.build +++ b/config/meson.build @@ -34,6 +34,24 @@ if build_xorg configuration: nvidia_conf, install_dir: join_paths(get_option('datadir'), 'X11/xorg.conf.d'), ) + configure_file( + input: '10-nvidia-modules.conf.in', + output: '10-nvidia-modules.conf', + configuration: nvidia_conf, + install_dir: join_paths(get_option('datadir'), 'X11/xorg.conf.d'), + ) + configure_file( + input: '10-nvidia.conf.debian.in', + output: '10-nvidia.conf.debian', + configuration: nvidia_conf, + install_dir: join_paths(get_option('sysconfdir'), 'X11/xorg.conf.d'), + ) + configure_file( + input: '10-nvidia-modules.conf.debian.in', + output: '10-nvidia-modules.conf.debian', + configuration: nvidia_conf, + install_dir: join_paths(get_option('sysconfdir'), 'X11/xorg.conf.d'), + ) endif libxserver_config = static_library('xserver_config',