From b40c21b17c01e8b40214ec517e5dde41e3ba3a36 Mon Sep 17 00:00:00 2001 From: Tim Keller Date: Sat, 8 Mar 2025 08:29:57 -0600 Subject: [PATCH 1/3] xorg.xf86videointel: re-add driver --- pkgs/servers/x11/xorg/overrides.nix | 24 +++++++++++++--- .../x11/xorg/use_crocus_and_iris.patch | 28 +++++++++++++++++++ 2 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 pkgs/servers/x11/xorg/use_crocus_and_iris.patch diff --git a/pkgs/servers/x11/xorg/overrides.nix b/pkgs/servers/x11/xorg/overrides.nix index 2dc81662f425..31437cd944a8 100644 --- a/pkgs/servers/x11/xorg/overrides.nix +++ b/pkgs/servers/x11/xorg/overrides.nix @@ -1009,10 +1009,26 @@ self: super: meta = attrs.meta // { mainProgram = "xinit"; }; }); - xf86videointel = throw '' - xf86videointel has been removed as the package is unmaintained and the driver is no longer functional. - Please remove "intel" from `services.xserver.videoDrivers` and switch to the "modesetting" driver. - ''; # Added 2024-12-16; + xf86videointel = super.xf86videointel.overrideAttrs (attrs: { + # the update script only works with released tarballs :-/ + name = "xf86-video-intel-2024-05-06"; + src = fetchFromGitLab { + domain = "gitlab.freedesktop.org"; + group = "xorg"; + owner = "driver"; + repo = "xf86-video-intel"; + rev = "ce811e78882d9f31636351dfe65351f4ded52c74"; + sha256 = "sha256-PKCxFHMwxgbew0gkxNBKiezWuqlFG6bWLkmtUNyoF8Q="; + }; + buildInputs = attrs.buildInputs ++ [ xorg.libXScrnSaver xorg.libXv xorg.pixman ]; + nativeBuildInputs = attrs.nativeBuildInputs ++ [ autoreconfHook xorg.utilmacros xorg.xorgserver ]; + configureFlags = [ "--with-default-dri=3" "--enable-tools" ]; + patches = [ ./use_crocus_and_iris.patch ]; + + meta = attrs.meta // { + platforms = ["i686-linux" "x86_64-linux"]; + }; + }); xf86videoopenchrome = super.xf86videoopenchrome.overrideAttrs (attrs: { buildInputs = attrs.buildInputs ++ [ xorg.libXv ]; diff --git a/pkgs/servers/x11/xorg/use_crocus_and_iris.patch b/pkgs/servers/x11/xorg/use_crocus_and_iris.patch new file mode 100644 index 000000000000..52c693380983 --- /dev/null +++ b/pkgs/servers/x11/xorg/use_crocus_and_iris.patch @@ -0,0 +1,28 @@ +--- a/src/uxa/intel_dri.c ++++ b/src/uxa/intel_dri.c +@@ -1540,8 +1540,10 @@ + return has_i830_dri() ? "i830" : "i915"; + else if (INTEL_INFO(intel)->gen < 040) + return "i915"; ++ else if (INTEL_INFO(intel)->gen < 0100) ++ return "crocus"; + else +- return "i965"; ++ return "iris"; + } + + return s; +--- a/src/sna/sna_dri2.c ++++ b/src/sna/sna_dri2.c +@@ -3707,8 +3707,10 @@ + return has_i830_dri() ? "i830" : "i915"; + else if (sna->kgem.gen < 040) + return "i915"; ++ else if (sna->kgem.gen < 0100) ++ return "crocus"; + else +- return "i965"; ++ return "iris"; + } + + return s; From c6e354f52f6b2c71cb18029db613270841be6dca Mon Sep 17 00:00:00 2001 From: Tim Keller Date: Sat, 8 Mar 2025 08:30:12 -0600 Subject: [PATCH 2/3] nixos/doc: xf86videointel is available again --- .../manual/configuration/x-windows.chapter.md | 34 +++++++++++++++---- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/nixos/doc/manual/configuration/x-windows.chapter.md b/nixos/doc/manual/configuration/x-windows.chapter.md index 2c77c638ca2d..78974f84de4f 100644 --- a/nixos/doc/manual/configuration/x-windows.chapter.md +++ b/nixos/doc/manual/configuration/x-windows.chapter.md @@ -123,6 +123,24 @@ setting](https://en.wikipedia.org/wiki/Mode_setting) (KMS) mechanism, it supports Glamor (2D graphics acceleration via OpenGL) and is actively maintained, it may perform worse in some cases (like in old chipsets). +There is a second driver, `intel` (provided by the xf86-video-intel package), +specific to older Intel iGPUs from generation 2 to 9. It is not recommended by +most distributions: it lacks several modern features (for example, it doesn't +support Glamor) and the package hasn't been officially updated since 2015. + +Third generation and older iGPUs (15-20+ years old) are not supported by the +`modesetting` driver (X will crash upon startup). Thus, the `intel` driver is +required for these chipsets. +Otherwise, the results vary depending on the hardware, so you may have to try +both drivers. Use the option +[](#opt-services.xserver.videoDrivers) +to set one. The recommended configuration for modern systems is: + +```nix +{ + services.xserver.videoDrivers = [ "modesetting" ]; +} +``` ::: {.note} The `modesetting` driver doesn't currently provide a `TearFree` option (this will become available in an upcoming X.org release), So, without using a @@ -130,20 +148,22 @@ compositor (for example, see [](#opt-services.picom.enable)) you will experience screen tearing. ::: -There also used to be a second driver, `intel` (provided by the -xf86-video-intel package), specific to older Intel iGPUs from generation 2 to -9. -This driver hasn't been maintained in years and was removed in NixOS 24.11 -after it stopped working. If you chipset is too old to be supported by -`modesetting` and have no other choice you may try an unsupported NixOS version -(reportedly working up to NixOS 24.05) and set +If you experience screen tearing no matter what, this configuration was +reported to resolve the issue: ```nix { services.xserver.videoDrivers = [ "intel" ]; + services.xserver.deviceSection = '' + Option "DRI" "2" + Option "TearFree" "true" + ''; } ``` +Note that this will likely downgrade the performance compared to +`modesetting` or `intel` with DRI 3 (default). + ## Proprietary NVIDIA drivers {#sec-x11-graphics-cards-nvidia} NVIDIA provides a proprietary driver for its graphics cards that has From 2762812d2c4f6dbb0e785cffb77f286148eaef29 Mon Sep 17 00:00:00 2001 From: Tim Keller Date: Sat, 8 Mar 2025 08:30:29 -0600 Subject: [PATCH 3/3] nixos/doc/release-notes: mention xf86videointel has been fixed --- nixos/doc/manual/release-notes/rl-2505.section.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nixos/doc/manual/release-notes/rl-2505.section.md b/nixos/doc/manual/release-notes/rl-2505.section.md index 41f1b9cf1ccb..500609fc8a28 100644 --- a/nixos/doc/manual/release-notes/rl-2505.section.md +++ b/nixos/doc/manual/release-notes/rl-2505.section.md @@ -37,6 +37,8 @@ - `nixos-option` has been rewritten to a Nix expression called by a simple bash script. This lowers our maintenance threshold, makes eval errors less verbose, adds support for flake-based configurations, descending into `attrsOf` and `listOf` submodule options, and `--show-trace`. +- The `intel` video driver for X.org (from the xf86-video-intel package) which was previously removed because it was non-functional has been fixed and the driver has been re-introduced. + - The Mattermost module ({option}`services.mattermost`) and packages (`mattermost` and `mmctl`) have been substantially updated: - {option}`services.mattermost.preferNixConfig` now defaults to true if you advance {option}`system.stateVersion` to 25.05. This means that if you have {option}`services.mattermost.mutableConfig` set, NixOS will override your settings to those that you define in the module. It is recommended to leave this at the default, even if you used a mutable config before, because it will ensure that your Mattermost data directories are correct. If you moved your data directories, you may want to review the module changes before upgrading. - Mattermost telemetry reporting is now disabled by default, though security update notifications are enabled. Look at {option}`services.mattermost.telemetry` for options to control this behavior.