git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #70295 from worldofpeace/mutter-eglstreams

Mutter eglstreams

commit1b5df99e7aefbeb7e0566bf819f502908399488c authorworldofpeace <worldofpeace@protonmail.ch> dateWed 27 Nov 2019, 05:29 (7 years ago) parenta1f82dbd41a2e3
6 files changed+109−5
nixos/modules/hardware/video/nvidia.nix+3−2 nixos/modules/services/x11/display-managers/gdm.nix+24−1 pkgs/desktops/gnome-3/core/mutter/default.nix+4−1 pkgs/development/libraries/egl-wayland/default.nix+73 pkgs/servers/x11/xorg/xwayland.nix+3−1 pkgs/top-level/all-packages.nix+2
nixos/modules/hardware/video/nvidia.nix+3−2
@@ -111,9 +111,10 @@ in
111111 config = mkIf enabled {
112112 assertions = [
113113 {
114− assertion = with config.services.xserver.displayManager; gdm.enable -> !gdm.wayland;
115− message = "NVIDIA drivers don't support wayland, set services.xserver.displayManager.gdm.wayland=false";
114+ assertion = with config.services.xserver.displayManager; gdm.nvidiaWayland -> cfg.modesetting.enable;
115+ message = "You cannot use wayland with GDM without modesetting enabled for NVIDIA drivers, set `hardware.nvidia.modesetting.enable = true`";
116116 }
117+
117118 {
118119 assertion = !optimusCfg.enable ||
119120 (optimusCfg.nvidiaBusId != "" && optimusCfg.intelBusId != "");
nixos/modules/services/x11/display-managers/gdm.nix+24−1
@@ -126,11 +126,21 @@ in
126126 wayland = mkOption {
127127 default = true;
128128 description = ''
129− Allow GDM run on Wayland instead of Xserver
129+ Allow GDM to run on Wayland instead of Xserver.
130+ Note to enable Wayland with Nvidia you need to
131+ enable the <option>nvidiaWayland</option>.
130132 '';
131133 type = types.bool;
132134 };
133135
136+ nvidiaWayland = mkOption {
137+ default = false;
138+ description = ''
139+ Whether to allow wayland to be used with the proprietary
140+ NVidia graphics driver.
141+ '';
142+ };
143+
134144 autoSuspend = mkOption {
135145 default = true;
136146 description = ''
@@ -237,6 +247,19 @@ in
237247
238248 services.dbus.packages = [ gdm ];
239249
250+ # We duplicate upstream's udev rules manually to make wayland with nvidia configurable
251+ services.udev.extraRules = ''
252+ # disable Wayland on Cirrus chipsets
253+ ATTR{vendor}=="0x1013", ATTR{device}=="0x00b8", ATTR{subsystem_vendor}=="0x1af4", ATTR{subsystem_device}=="0x1100", RUN+="${gdm}/libexec/gdm-disable-wayland"
254+ # disable Wayland on Hi1710 chipsets
255+ ATTR{vendor}=="0x19e5", ATTR{device}=="0x1711", RUN+="${gdm}/libexec/gdm-disable-wayland"
256+ ${optionalString (!cfg.gdm.nvidiaWayland) ''
257+ DRIVER=="nvidia", RUN+="${gdm}/libexec/gdm-disable-wayland"
258+ ''}
259+ # disable Wayland when modesetting is disabled
260+ IMPORT{cmdline}="nomodeset", RUN+="${gdm}/libexec/gdm-disable-wayland"
261+ '';
262+
240263 systemd.user.services.dbus.wantedBy = [ "default.target" ];
241264
242265 programs.dconf.profiles.gdm =
pkgs/desktops/gnome-3/core/mutter/default.nix+4−1
@@ -10,6 +10,7 @@
1010, sysprof
1111, desktop-file-utils
1212, libcap_ng
13+, egl-wayland
1314}:
1415
1516stdenv.mkDerivation rec {
@@ -26,6 +27,8 @@ stdenv.mkDerivation rec {
2627 mesonFlags = [
2728 "-Dxwayland-path=${xwayland}/bin/Xwayland"
2829 "-Dinstalled_tests=false" # TODO: enable these
30+ "-Dwayland_eglstream=true"
31+ "-Degl_device=true"
2932 ];
3033
3134 propagatedBuildInputs = [
@@ -52,7 +55,7 @@ stdenv.mkDerivation rec {
5255 gnome-desktop cairo pango cogl zenity libstartup_notification
5356 geocode-glib libinput libgudev libwacom
5457 libcanberra-gtk3 zenity xkeyboard_config libxkbfile
55− libxkbcommon pipewire xwayland
58+ libxkbcommon pipewire xwayland egl-wayland
5659 gnome-settings-daemon sysprof
5760 ];
5861
pkgs/development/libraries/egl-wayland/default.nixnew file+73
@@ -0,0 +1,73 @@
1+{ lib
2+, stdenv
3+, fetchFromGitHub
4+, pkgconfig
5+, meson
6+, ninja
7+, libX11
8+, mesa
9+, wayland
10+}:
11+
12+let
13+ eglexternalplatform = stdenv.mkDerivation {
14+ pname = "eglexternalplatform";
15+ version = "1.1";
16+
17+ src = fetchFromGitHub {
18+ owner = "Nvidia";
19+ repo = "eglexternalplatform";
20+ rev = "7c8f8e2218e46b1a4aa9538520919747f1184d86";
21+ sha256 = "0lr5s2xa1zn220ghmbsiwgmx77l156wk54c7hybia0xpr9yr2nhb";
22+ };
23+
24+ installPhase = ''
25+ mkdir -p "$out/include/"
26+ cp interface/eglexternalplatform.h "$out/include/"
27+ cp interface/eglexternalplatformversion.h "$out/include/"
28+
29+ substituteInPlace eglexternalplatform.pc \
30+ --replace "/usr/include/EGL" "$out/include"
31+ mkdir -p "$out/share/pkgconfig"
32+ cp eglexternalplatform.pc "$out/share/pkgconfig/"
33+ '';
34+
35+ meta = with lib; {
36+ license = licenses.mit;
37+ };
38+ };
39+
40+in stdenv.mkDerivation rec {
41+ pname = "egl-wayland";
42+ version = "1.1.4";
43+
44+ outputs = [ "out" "dev" ];
45+
46+ src = fetchFromGitHub {
47+ owner = "Nvidia";
48+ repo = pname;
49+ rev = version;
50+ sha256 = "0wvamjcfycd7rgk7v14g2rin55xin9rfkxmivyay3cm08vnl7y1d";
51+ };
52+
53+ nativeBuildInputs = [
54+ meson
55+ ninja
56+ pkgconfig
57+ ];
58+
59+ buildInputs = [
60+ eglexternalplatform
61+ libX11
62+ mesa
63+ wayland
64+ ];
65+
66+ meta = with lib; {
67+ description = "The EGLStream-based Wayland external platform";
68+ homepage = https://github.com/NVIDIA/egl-wayland/;
69+ license = licenses.mit;
70+ platforms = platforms.linux;
71+ maintainers = with maintainers; [ hedning ];
72+ };
73+}
pkgs/servers/x11/xorg/xwayland.nix+3−1
@@ -1,16 +1,18 @@
1−{ stdenv, wayland, wayland-protocols, xorgserver, xkbcomp, xkeyboard_config, epoxy, libxslt, libunwind, makeWrapper }:
1+{ stdenv, wayland, wayland-protocols, xorgserver, xkbcomp, xkeyboard_config, epoxy, libxslt, libunwind, makeWrapper, egl-wayland }:
22
33with stdenv.lib;
44
55xorgserver.overrideAttrs (oldAttrs: {
66
77 name = "xwayland-${xorgserver.version}";
8+ buildInputs = oldAttrs.buildInputs ++ [ egl-wayland ];
89 propagatedBuildInputs = oldAttrs.propagatedBuildInputs
910 ++ [wayland wayland-protocols epoxy libxslt makeWrapper libunwind];
1011 configureFlags = [
1112 "--disable-docs"
1213 "--disable-devel-docs"
1314 "--enable-xwayland"
15+ "--enable-xwayland-eglstream"
1416 "--disable-xorg"
1517 "--disable-xvfb"
1618 "--disable-xnest"
pkgs/top-level/all-packages.nix+2
@@ -11030,6 +11030,8 @@ in
1103011030 inherit (darwin.apple_sdk.frameworks) Accelerate CoreGraphics CoreVideo;
1103111031 };
1103211032
11033+ egl-wayland = callPackage ../development/libraries/egl-wayland {};
11034+
1103311035 elastix = callPackage ../development/libraries/science/biology/elastix { };
1103411036
1103511037 enchant1 = callPackage ../development/libraries/enchant/1.x.nix { };