From dd1d577ac3b3b952bfebf846ecb61da6c48135d3 Mon Sep 17 00:00:00 2001 From: Tim Keller Date: Sun, 2 Feb 2025 11:03:16 -0600 Subject: [PATCH 1/5] mesa: backport dril patch that fixes xf86videointel --- pkgs/development/libraries/mesa/default.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix index 633770b6862c..ae264fa5adf7 100644 --- a/pkgs/development/libraries/mesa/default.nix +++ b/pkgs/development/libraries/mesa/default.nix @@ -141,6 +141,13 @@ in stdenv.mkDerivation { # cherry-picked from https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32719 # safe to remove for versions > 24.3.2 ./cross_clc.patch + + # dril fix for xf86videointel + # FIXME: remove when backported upstream + (fetchpatch { + url = "https://gitlab.freedesktop.org/mesa/mesa/-/commit/4ecd183c563670c5c3ab371d6b5596ecabbe6fad.diff"; + hash = "sha256-AXXp1MHXEsvua1SyzQUbQLVqaA4Iw1yziqvAce+UkxQ="; + }) ]; postPatch = '' From c103e585af9cb8a3077d137c032df95bc4b65594 Mon Sep 17 00:00:00 2001 From: Tim Keller Date: Sun, 2 Feb 2025 11:12:56 -0600 Subject: [PATCH 2/5] re-add and update xf86videointel 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 05ad31a0c1c6..5e1fc7faaf07 100644 --- a/pkgs/servers/x11/xorg/overrides.nix +++ b/pkgs/servers/x11/xorg/overrides.nix @@ -1017,10 +1017,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 xorg.utilmacros ]; + nativeBuildInputs = attrs.nativeBuildInputs ++ [autoreconfHook ]; + 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..54744f463bd9 --- /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 4958f38b3851ab675408a30547c298a64ffc2e21 Mon Sep 17 00:00:00 2001 From: tjk918 <36288711+tjk918@users.noreply.github.com> Date: Thu, 6 Feb 2025 18:34:08 -0600 Subject: [PATCH 3/5] Add fetchpatch dependency --- pkgs/development/libraries/mesa/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix index ae264fa5adf7..ce42f5fb54c8 100644 --- a/pkgs/development/libraries/mesa/default.nix +++ b/pkgs/development/libraries/mesa/default.nix @@ -6,6 +6,7 @@ , expat , fetchCrate , fetchFromGitLab +, fetchpatch , file , flex , glslang From 3d14d804bea359a22cfeb86e4ab63ab0c55588ff Mon Sep 17 00:00:00 2001 From: Tim Keller Date: Sat, 22 Feb 2025 10:51:43 -0600 Subject: [PATCH 4/5] nixos/doc: update the status of Intel Graphics with fixed intel driver xf86-video-intel is now working again due to a bug fix in Mesa. So this re-introduces the section on the intel driver and screen-tearing while discouraging its use generally. --- .../manual/configuration/x-windows.chapter.md | 34 +++++++++++++++---- .../manual/release-notes/rl-2411.section.md | 3 -- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/nixos/doc/manual/configuration/x-windows.chapter.md b/nixos/doc/manual/configuration/x-windows.chapter.md index 2c77c638ca2d..9537d52b6934 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 diff --git a/nixos/doc/manual/release-notes/rl-2411.section.md b/nixos/doc/manual/release-notes/rl-2411.section.md index 339c4bb38c36..f95073cd6fca 100644 --- a/nixos/doc/manual/release-notes/rl-2411.section.md +++ b/nixos/doc/manual/release-notes/rl-2411.section.md @@ -231,9 +231,6 @@ - The NVIDIA driver no longer defaults to the proprietary kernel module with versions >= 560. You will need to manually set `hardware.nvidia.open` to select the proprietary or open modules. -- The `intel` driver for the X server (`services.xserver.videoDrives = [ "intel" ]`) is no longer functional due to incompatibilities with the latest Mesa version. - All users are strongly encouraged to switch to the generic `modesetting` driver (the default one) whenever possible, for more information see the manual chapter on [Intel Graphics](#sec-x11--graphics-cards-intel) and issue [#342763](https://github.com/NixOS/nixpkgs/issues/342763). - - The `(buildPythonPackage { ... }).override` and `(buildPythonPackage { ... }).overrideDerivation` attributes is now deprecated and removed in favour of `overridePythonAttrs` and `lib.overrideDerivation`. This change does not affect the override interface of most Python packages, as [`.override`](https://nixos.org/manual/nixpkgs/unstable/#sec-pkg-override) provided by `callPackage` shadows such a locally-defined `override` attribute. The `.overrideDerivation` attribute of Python packages called with `callPackage` will also remain available after this change. From 65f2e3a98649733c6a7ef4da3bcb52a848a32c07 Mon Sep 17 00:00:00 2001 From: Tim Keller Date: Sat, 22 Feb 2025 18:09:25 -0600 Subject: [PATCH 5/5] Mention xf86-video-intel fix in 25.05 release notes and undo change to 24.11 release notes --- nixos/doc/manual/release-notes/rl-2411.section.md | 3 +++ nixos/doc/manual/release-notes/rl-2505.section.md | 2 ++ 2 files changed, 5 insertions(+) diff --git a/nixos/doc/manual/release-notes/rl-2411.section.md b/nixos/doc/manual/release-notes/rl-2411.section.md index f95073cd6fca..339c4bb38c36 100644 --- a/nixos/doc/manual/release-notes/rl-2411.section.md +++ b/nixos/doc/manual/release-notes/rl-2411.section.md @@ -231,6 +231,9 @@ - The NVIDIA driver no longer defaults to the proprietary kernel module with versions >= 560. You will need to manually set `hardware.nvidia.open` to select the proprietary or open modules. +- The `intel` driver for the X server (`services.xserver.videoDrives = [ "intel" ]`) is no longer functional due to incompatibilities with the latest Mesa version. + All users are strongly encouraged to switch to the generic `modesetting` driver (the default one) whenever possible, for more information see the manual chapter on [Intel Graphics](#sec-x11--graphics-cards-intel) and issue [#342763](https://github.com/NixOS/nixpkgs/issues/342763). + - The `(buildPythonPackage { ... }).override` and `(buildPythonPackage { ... }).overrideDerivation` attributes is now deprecated and removed in favour of `overridePythonAttrs` and `lib.overrideDerivation`. This change does not affect the override interface of most Python packages, as [`.override`](https://nixos.org/manual/nixpkgs/unstable/#sec-pkg-override) provided by `callPackage` shadows such a locally-defined `override` attribute. The `.overrideDerivation` attribute of Python packages called with `callPackage` will also remain available after this change. diff --git a/nixos/doc/manual/release-notes/rl-2505.section.md b/nixos/doc/manual/release-notes/rl-2505.section.md index d3df5e9d1ffe..99b1e4422873 100644 --- a/nixos/doc/manual/release-notes/rl-2505.section.md +++ b/nixos/doc/manual/release-notes/rl-2505.section.md @@ -47,6 +47,8 @@ - A new `pkgs.mattermost.buildPlugin` function has been added, which allows plugins to be built from source, including webapp frontends with a supported package-lock.json. See the Mattermost NixOS test and [manual](https://nixos.org/manual/nixpkgs/unstable/#sec-mattermost-plugins-build) for an example. - Note that the Mattermost module will create an account _without_ a well-known UID if the username differs from the default (`mattermost`). If you used Mattermost with a nonstandard username, you may want to review the module changes before upgrading. +- 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. + ## New Modules {#sec-release-25.05-new-modules}