From c1e77269cf7975386c52b5bd9f54808ffd318d4f Mon Sep 17 00:00:00 2001 From: Michael Weiss Date: Sat, 29 Feb 2020 15:26:17 +0100 Subject: [PATCH] neatvnc: Disable the CPU acceleration by default For Nixpkgs it seems best to disable the usage of CPU extensions by default as older CPUs don't support them which will result in a crash at runtime (SIGILL: Illegal instruction) [0]. The performance on my old test system was more than enough anyway (usually ~10% CPU usage due to wayvnc). [0]: https://github.com/any1/neatvnc/issues/21 --- pkgs/development/libraries/neatvnc/default.nix | 3 +++ .../neatvnc/disable-cpu-acceleration.patch | 17 +++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 pkgs/development/libraries/neatvnc/disable-cpu-acceleration.patch diff --git a/pkgs/development/libraries/neatvnc/default.nix b/pkgs/development/libraries/neatvnc/default.nix index 8dbcf92feed8..127f25a50bea 100644 --- a/pkgs/development/libraries/neatvnc/default.nix +++ b/pkgs/development/libraries/neatvnc/default.nix @@ -1,6 +1,7 @@ { stdenv, fetchFromGitHub, meson, pkg-config, ninja , pixman, libuv, gnutls, libdrm # libjpeg_turbo: Optional, for tight encoding (disabled because experimental) +, enableCpuAcceleration ? false # Whether to use CPU extensions (e.g. AVX) }: stdenv.mkDerivation rec { @@ -17,6 +18,8 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ meson pkg-config ninja ]; buildInputs = [ pixman libuv gnutls libdrm ]; + patches = stdenv.lib.optional (!enableCpuAcceleration) ./disable-cpu-acceleration.patch; + meta = with stdenv.lib; { description = "A VNC server library"; longDescription = '' diff --git a/pkgs/development/libraries/neatvnc/disable-cpu-acceleration.patch b/pkgs/development/libraries/neatvnc/disable-cpu-acceleration.patch new file mode 100644 index 000000000000..97b77c02df48 --- /dev/null +++ b/pkgs/development/libraries/neatvnc/disable-cpu-acceleration.patch @@ -0,0 +1,17 @@ +diff --git a/meson.build b/meson.build +index 31dd8b8..8761087 100644 +--- a/meson.build ++++ b/meson.build +@@ -21,12 +21,6 @@ endif + + cpu = host_machine.cpu_family() + +-if cpu == 'x86_64' +- c_args += '-mavx' +-elif cpu == 'arm' +- c_args += '-mfpu=neon' +-endif +- + add_project_arguments(c_args, language: 'c') + + cc = meson.get_compiler('c')