Skip to content

Commit 2092d80

Browse files
committed
fix xf86videointel driver (#378393)
2 parents 21c57a8 + 65f2e3a commit 2092d80

File tree

5 files changed

+85
-11
lines changed

5 files changed

+85
-11
lines changed

nixos/doc/manual/configuration/x-windows.chapter.md

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,27 +123,47 @@ setting](https://en.wikipedia.org/wiki/Mode_setting) (KMS) mechanism, it
123123
supports Glamor (2D graphics acceleration via OpenGL) and is actively
124124
maintained, it may perform worse in some cases (like in old chipsets).
125125

126+
There is a second driver, `intel` (provided by the xf86-video-intel package),
127+
specific to older Intel iGPUs from generation 2 to 9. It is not recommended by
128+
most distributions: it lacks several modern features (for example, it doesn't
129+
support Glamor) and the package hasn't been officially updated since 2015.
130+
131+
Third generation and older iGPUs (15-20+ years old) are not supported by the
132+
`modesetting` driver (X will crash upon startup). Thus, the `intel` driver is
133+
required for these chipsets.
134+
Otherwise, the results vary depending on the hardware, so you may have to try
135+
both drivers. Use the option
136+
[](#opt-services.xserver.videoDrivers)
137+
to set one. The recommended configuration for modern systems is:
138+
139+
```nix
140+
{
141+
services.xserver.videoDrivers = [ "modesetting" ];
142+
}
143+
```
126144
::: {.note}
127145
The `modesetting` driver doesn't currently provide a `TearFree` option (this
128146
will become available in an upcoming X.org release), So, without using a
129147
compositor (for example, see [](#opt-services.picom.enable)) you will
130148
experience screen tearing.
131149
:::
132150

133-
There also used to be a second driver, `intel` (provided by the
134-
xf86-video-intel package), specific to older Intel iGPUs from generation 2 to
135-
9.
136-
This driver hasn't been maintained in years and was removed in NixOS 24.11
137-
after it stopped working. If you chipset is too old to be supported by
138-
`modesetting` and have no other choice you may try an unsupported NixOS version
139-
(reportedly working up to NixOS 24.05) and set
151+
If you experience screen tearing no matter what, this configuration was
152+
reported to resolve the issue:
140153

141154
```nix
142155
{
143156
services.xserver.videoDrivers = [ "intel" ];
157+
services.xserver.deviceSection = ''
158+
Option "DRI" "2"
159+
Option "TearFree" "true"
160+
'';
144161
}
145162
```
146163

164+
Note that this will likely downgrade the performance compared to
165+
`modesetting` or `intel` with DRI 3 (default).
166+
147167
## Proprietary NVIDIA drivers {#sec-x11-graphics-cards-nvidia}
148168

149169
NVIDIA provides a proprietary driver for its graphics cards that has

nixos/doc/manual/release-notes/rl-2505.section.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151
- 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.
5252
- 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.
5353

54+
- 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.
55+
5456
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
5557

5658
## New Modules {#sec-release-25.05-new-modules}

pkgs/development/libraries/mesa/default.nix

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
, expat
77
, fetchCrate
88
, fetchFromGitLab
9+
, fetchpatch
910
, file
1011
, flex
1112
, glslang
@@ -141,6 +142,13 @@ in stdenv.mkDerivation {
141142
# cherry-picked from https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32719
142143
# safe to remove for versions > 24.3.2
143144
./cross_clc.patch
145+
146+
# dril fix for xf86videointel
147+
# FIXME: remove when backported upstream
148+
(fetchpatch {
149+
url = "https://gitlab.freedesktop.org/mesa/mesa/-/commit/4ecd183c563670c5c3ab371d6b5596ecabbe6fad.diff";
150+
hash = "sha256-AXXp1MHXEsvua1SyzQUbQLVqaA4Iw1yziqvAce+UkxQ=";
151+
})
144152
];
145153

146154
postPatch = ''

pkgs/servers/x11/xorg/overrides.nix

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,10 +1009,26 @@ self: super:
10091009
meta = attrs.meta // { mainProgram = "xinit"; };
10101010
});
10111011

1012-
xf86videointel = throw ''
1013-
xf86videointel has been removed as the package is unmaintained and the driver is no longer functional.
1014-
Please remove "intel" from `services.xserver.videoDrivers` and switch to the "modesetting" driver.
1015-
''; # Added 2024-12-16;
1012+
xf86videointel = super.xf86videointel.overrideAttrs (attrs: {
1013+
# the update script only works with released tarballs :-/
1014+
name = "xf86-video-intel-2024-05-06";
1015+
src = fetchFromGitLab {
1016+
domain = "gitlab.freedesktop.org";
1017+
group = "xorg";
1018+
owner = "driver";
1019+
repo = "xf86-video-intel";
1020+
rev = "ce811e78882d9f31636351dfe65351f4ded52c74";
1021+
sha256 = "sha256-PKCxFHMwxgbew0gkxNBKiezWuqlFG6bWLkmtUNyoF8Q=";
1022+
};
1023+
buildInputs = attrs.buildInputs ++ [ xorg.libXScrnSaver xorg.libXv xorg.pixman xorg.utilmacros ];
1024+
nativeBuildInputs = attrs.nativeBuildInputs ++ [autoreconfHook ];
1025+
configureFlags = [ "--with-default-dri=3" "--enable-tools" ];
1026+
patches = [ ./use_crocus_and_iris.patch ];
1027+
1028+
meta = attrs.meta // {
1029+
platforms = ["i686-linux" "x86_64-linux"];
1030+
};
1031+
});
10161032

10171033
xf86videoopenchrome = super.xf86videoopenchrome.overrideAttrs (attrs: {
10181034
buildInputs = attrs.buildInputs ++ [ xorg.libXv ];
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
--- a/src/uxa/intel_dri.c
2+
+++ b/src/uxa/intel_dri.c
3+
@@ -1540,8 +1540,10 @@
4+
return has_i830_dri() ? "i830" : "i915";
5+
else if (INTEL_INFO(intel)->gen < 040)
6+
return "i915";
7+
+ else if (INTEL_INFO(intel)->gen < 0100)
8+
+ return "crocus";
9+
else
10+
- return "i965";
11+
+ return "iris";
12+
}
13+
14+
return s;
15+
--- a/src/sna/sna_dri2.c
16+
+++ b/src/sna/sna_dri2.c
17+
@@ -3707,8 +3707,10 @@
18+
return has_i830_dri() ? "i830" : "i915";
19+
else if (sna->kgem.gen < 040)
20+
return "i915";
21+
+ else if (sna->kgem.gen < 0100)
22+
+ return "crocus";
23+
else
24+
- return "i965";
25+
+ return "iris";
26+
}
27+
28+
return s;

0 commit comments

Comments
 (0)