Merge pull request #70295 from worldofpeace/mutter-eglstreams

Mutter eglstreams

Changed files
+109 -5
nixos
modules
hardware
video
services
x11
display-managers
pkgs
desktops
gnome-3
core
mutter
development
libraries
egl-wayland
servers
x11
top-level
+3 -2
nixos/modules/hardware/video/nvidia.nix
···
config = mkIf enabled {
assertions = [
{
-
assertion = with config.services.xserver.displayManager; gdm.enable -> !gdm.wayland;
-
message = "NVIDIA drivers don't support wayland, set services.xserver.displayManager.gdm.wayland=false";
+
assertion = with config.services.xserver.displayManager; gdm.nvidiaWayland -> cfg.modesetting.enable;
+
message = "You cannot use wayland with GDM without modesetting enabled for NVIDIA drivers, set `hardware.nvidia.modesetting.enable = true`";
}
+
{
assertion = !optimusCfg.enable ||
(optimusCfg.nvidiaBusId != "" && optimusCfg.intelBusId != "");
+24 -1
nixos/modules/services/x11/display-managers/gdm.nix
···
wayland = mkOption {
default = true;
description = ''
-
Allow GDM run on Wayland instead of Xserver
+
Allow GDM to run on Wayland instead of Xserver.
+
Note to enable Wayland with Nvidia you need to
+
enable the <option>nvidiaWayland</option>.
'';
type = types.bool;
+
};
+
+
nvidiaWayland = mkOption {
+
default = false;
+
description = ''
+
Whether to allow wayland to be used with the proprietary
+
NVidia graphics driver.
+
'';
};
autoSuspend = mkOption {
···
services.accounts-daemon.enable = true;
services.dbus.packages = [ gdm ];
+
+
# We duplicate upstream's udev rules manually to make wayland with nvidia configurable
+
services.udev.extraRules = ''
+
# disable Wayland on Cirrus chipsets
+
ATTR{vendor}=="0x1013", ATTR{device}=="0x00b8", ATTR{subsystem_vendor}=="0x1af4", ATTR{subsystem_device}=="0x1100", RUN+="${gdm}/libexec/gdm-disable-wayland"
+
# disable Wayland on Hi1710 chipsets
+
ATTR{vendor}=="0x19e5", ATTR{device}=="0x1711", RUN+="${gdm}/libexec/gdm-disable-wayland"
+
${optionalString (!cfg.gdm.nvidiaWayland) ''
+
DRIVER=="nvidia", RUN+="${gdm}/libexec/gdm-disable-wayland"
+
''}
+
# disable Wayland when modesetting is disabled
+
IMPORT{cmdline}="nomodeset", RUN+="${gdm}/libexec/gdm-disable-wayland"
+
'';
systemd.user.services.dbus.wantedBy = [ "default.target" ];
+4 -1
pkgs/desktops/gnome-3/core/mutter/default.nix
···
, sysprof
, desktop-file-utils
, libcap_ng
+
, egl-wayland
}:
stdenv.mkDerivation rec {
···
mesonFlags = [
"-Dxwayland-path=${xwayland}/bin/Xwayland"
"-Dinstalled_tests=false" # TODO: enable these
+
"-Dwayland_eglstream=true"
+
"-Degl_device=true"
];
propagatedBuildInputs = [
···
gnome-desktop cairo pango cogl zenity libstartup_notification
geocode-glib libinput libgudev libwacom
libcanberra-gtk3 zenity xkeyboard_config libxkbfile
-
libxkbcommon pipewire xwayland
+
libxkbcommon pipewire xwayland egl-wayland
gnome-settings-daemon sysprof
];
+73
pkgs/development/libraries/egl-wayland/default.nix
···
+
{ lib
+
, stdenv
+
, fetchFromGitHub
+
, pkgconfig
+
, meson
+
, ninja
+
, libX11
+
, mesa
+
, wayland
+
}:
+
+
let
+
eglexternalplatform = stdenv.mkDerivation {
+
pname = "eglexternalplatform";
+
version = "1.1";
+
+
src = fetchFromGitHub {
+
owner = "Nvidia";
+
repo = "eglexternalplatform";
+
rev = "7c8f8e2218e46b1a4aa9538520919747f1184d86";
+
sha256 = "0lr5s2xa1zn220ghmbsiwgmx77l156wk54c7hybia0xpr9yr2nhb";
+
};
+
+
installPhase = ''
+
mkdir -p "$out/include/"
+
cp interface/eglexternalplatform.h "$out/include/"
+
cp interface/eglexternalplatformversion.h "$out/include/"
+
+
substituteInPlace eglexternalplatform.pc \
+
--replace "/usr/include/EGL" "$out/include"
+
mkdir -p "$out/share/pkgconfig"
+
cp eglexternalplatform.pc "$out/share/pkgconfig/"
+
'';
+
+
meta = with lib; {
+
license = licenses.mit;
+
};
+
};
+
+
in stdenv.mkDerivation rec {
+
pname = "egl-wayland";
+
version = "1.1.4";
+
+
outputs = [ "out" "dev" ];
+
+
src = fetchFromGitHub {
+
owner = "Nvidia";
+
repo = pname;
+
rev = version;
+
sha256 = "0wvamjcfycd7rgk7v14g2rin55xin9rfkxmivyay3cm08vnl7y1d";
+
};
+
+
nativeBuildInputs = [
+
meson
+
ninja
+
pkgconfig
+
];
+
+
buildInputs = [
+
eglexternalplatform
+
libX11
+
mesa
+
wayland
+
];
+
+
meta = with lib; {
+
description = "The EGLStream-based Wayland external platform";
+
homepage = https://github.com/NVIDIA/egl-wayland/;
+
license = licenses.mit;
+
platforms = platforms.linux;
+
maintainers = with maintainers; [ hedning ];
+
};
+
}
+3 -1
pkgs/servers/x11/xorg/xwayland.nix
···
-
{ stdenv, wayland, wayland-protocols, xorgserver, xkbcomp, xkeyboard_config, epoxy, libxslt, libunwind, makeWrapper }:
+
{ stdenv, wayland, wayland-protocols, xorgserver, xkbcomp, xkeyboard_config, epoxy, libxslt, libunwind, makeWrapper, egl-wayland }:
with stdenv.lib;
xorgserver.overrideAttrs (oldAttrs: {
name = "xwayland-${xorgserver.version}";
+
buildInputs = oldAttrs.buildInputs ++ [ egl-wayland ];
propagatedBuildInputs = oldAttrs.propagatedBuildInputs
++ [wayland wayland-protocols epoxy libxslt makeWrapper libunwind];
configureFlags = [
"--disable-docs"
"--disable-devel-docs"
"--enable-xwayland"
+
"--enable-xwayland-eglstream"
"--disable-xorg"
"--disable-xvfb"
"--disable-xnest"
+2
pkgs/top-level/all-packages.nix
···
inherit (darwin.apple_sdk.frameworks) Accelerate CoreGraphics CoreVideo;
+
egl-wayland = callPackage ../development/libraries/egl-wayland {};
+
elastix = callPackage ../development/libraries/science/biology/elastix { };
enchant1 = callPackage ../development/libraries/enchant/1.x.nix { };