Merge pull request #70295 from worldofpeace/mutter-eglstreams

Mutter eglstreams
This commit is contained in:
worldofpeace 2019-11-27 05:29:58 +00:00 committed by GitHub
commit 1b5df99e7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 109 additions and 5 deletions

View file

@ -111,9 +111,10 @@ in
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 != "");

View file

@ -126,11 +126,21 @@ in
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 {
default = true;
description = ''
@ -237,6 +247,19 @@ in
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" ];
programs.dconf.profiles.gdm =

View file

@ -10,6 +10,7 @@
, sysprof
, desktop-file-utils
, libcap_ng
, egl-wayland
}:
stdenv.mkDerivation rec {
@ -26,6 +27,8 @@ stdenv.mkDerivation rec {
mesonFlags = [
"-Dxwayland-path=${xwayland}/bin/Xwayland"
"-Dinstalled_tests=false" # TODO: enable these
"-Dwayland_eglstream=true"
"-Degl_device=true"
];
propagatedBuildInputs = [
@ -52,7 +55,7 @@ stdenv.mkDerivation rec {
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
];

View file

@ -0,0 +1,73 @@
{ 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 ];
};
}

View file

@ -1,16 +1,18 @@
{ 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"

View file

@ -11030,6 +11030,8 @@ in
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 { };