Skip to content

Commit

Permalink
Merge pull request #90603 from primeos/chromium-backport
Browse files Browse the repository at this point in the history
[20.03] chromium: 83.0.4103.97 -> 83.0.4103.106 + VA-API (backport)
  • Loading branch information
primeos authored Jun 17, 2020
2 parents 243f698 + 0d8250a commit 8056c50
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 21 deletions.
2 changes: 1 addition & 1 deletion pkgs/applications/networking/browsers/chromium/browser.nix
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ mkChromiumDerivation (base: rec {
the web. It has a minimalist user interface and provides the vast majority
of source code for Google Chrome (which has some additional features).
'';
homepage = https://www.chromium.org/;
homepage = "https://www.chromium.org/";
maintainers = with maintainers; [ bendlas thefloweringash primeos ];
# Overview of the maintainer roles:
# nixos-unstable:
Expand Down
17 changes: 11 additions & 6 deletions pkgs/applications/networking/browsers/chromium/common.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,13 @@
, libdrm ? null, wayland ? null, mesa_drivers ? null, libxkbcommon ? null # useOzone

# package customization
, useVaapi ? false
, useOzone ? false
, useVaapi ? !(useOzone || stdenv.isAarch64) # Built if supported, but disabled in the wrapper
# VA-API TODOs:
# - Ozone: M81 fails to build due to "ozone_platform_gbm = false"
# - Possible solutions: Write a patch to fix the build (wrong gn dependencies)
# or build with minigbm
# - AArch64: Causes serious regressions (https://github.com/NixOS/nixpkgs/pull/85253#issuecomment-614405879)
, gnomeSupport ? false, gnome ? null
, gnomeKeyringSupport ? false, libgnome-keyring3 ? null
, proprietaryCodecs ? true
Expand Down Expand Up @@ -129,10 +134,10 @@ let
libXScrnSaver libXcursor libXtst libGLU libGL
pciutils protobuf speechd libXdamage at-spi2-core
jre
] ++ optional gnomeKeyringSupport libgnome-keyring3
] ++ optional useVaapi libva
++ optional gnomeKeyringSupport libgnome-keyring3
++ optionals gnomeSupport [ gnome.GConf libgcrypt ]
++ optionals cupsSupport [ libgcrypt cups ]
++ optional useVaapi libva
++ optional pulseSupport libpulseaudio
++ optionals useOzone [ libdrm wayland mesa_drivers libxkbcommon ];

Expand All @@ -151,9 +156,9 @@ let
#
# ++ optionals (channel == "dev") [ ( githubPatch "<patch>" "0000000000000000000000000000000000000000000000000000000000000000" ) ]
# ++ optional (versionRange "68" "72") ( githubPatch "<patch>" "0000000000000000000000000000000000000000000000000000000000000000" )
] ++ optionals (useVaapi) [
# source: https://aur.archlinux.org/cgit/aur.git/tree/vaapi-fix.patch?h=chromium-vaapi
./patches/vaapi-fix.patch
] ++ optionals (useVaapi) [ # Improvements for the VA-API build:
./patches/enable-vdpau-support-for-nvidia.patch # https://aur.archlinux.org/cgit/aur.git/tree/vdpau-support.patch?h=chromium-vaapi
./patches/enable-video-acceleration-on-linux.patch # Can be controlled at runtime (i.e. without rebuilding Chromium)
];

postPatch = ''
Expand Down
19 changes: 14 additions & 5 deletions pkgs/applications/networking/browsers/chromium/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
, lib

# package customization
# Note: enable* flags should not require full rebuilds (i.e. only affect the wrapper)
, channel ? "stable"
, gnomeSupport ? false, gnome ? null
, gnomeKeyringSupport ? false
, proprietaryCodecs ? true
, enablePepperFlash ? false
, enableWideVine ? false
, useVaapi ? false # test video on radeon, before enabling this
, useVaapi ? false # Deprecated, use enableVaapi instead!
, enableVaapi ? false # Disabled by default due to unofficial support and issues on radeon
, useOzone ? false
, cupsSupport ? true
, pulseSupport ? config.pulseaudio or stdenv.isLinux
Expand All @@ -31,7 +33,7 @@ let
upstream-info = (callPackage ./update.nix {}).getChannel channel;

mkChromiumDerivation = callPackage ./common.nix ({
inherit gnome gnomeSupport gnomeKeyringSupport proprietaryCodecs cupsSupport pulseSupport useVaapi useOzone;
inherit gnome gnomeSupport gnomeKeyringSupport proprietaryCodecs cupsSupport pulseSupport useOzone;
# TODO: Remove after we can update gn for the stable channel (backward incompatible changes):
gnChromium = gn.overrideAttrs (oldAttrs: {
version = "2020-03-23";
Expand Down Expand Up @@ -132,6 +134,14 @@ let
cp -a ${widevineCdm}/WidevineCdm $out/libexec/chromium/
''
else browser;

optionalVaapiFlags = if useVaapi # TODO: Remove after 20.09:
then throw ''
Chromium's useVaapi was replaced by enableVaapi and you don't need to pass
"--ignore-gpu-blacklist" anymore (also no rebuilds are required anymore).
'' else lib.optionalString
(!enableVaapi)
"--add-flags --disable-accelerated-video-decode --add-flags --disable-accelerated-video-encode";
in stdenv.mkDerivation {
name = "chromium${suffix}-${version}";
inherit version;
Expand All @@ -151,15 +161,14 @@ in stdenv.mkDerivation {
buildCommand = let
browserBinary = "${chromiumWV}/libexec/chromium/chromium";
getWrapperFlags = plugin: "$(< \"${plugin}/nix-support/wrapper-flags\")";
libPath = stdenv.lib.makeLibraryPath ([]
++ stdenv.lib.optional useVaapi libva
);
libPath = stdenv.lib.makeLibraryPath [ libva ];

in with stdenv.lib; ''
mkdir -p "$out/bin"
eval makeWrapper "${browserBinary}" "$out/bin/chromium" \
--add-flags ${escapeShellArg (escapeShellArg commandLineArgs)} \
${optionalVaapiFlags} \
${concatMapStringsSep " " getWrapperFlags chromium.plugins.enabled}
ed -v -s "$out/bin/chromium" << EOF
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
From b2144fd28e09cd52e7a88a62a9d9b54cf9922f9f Mon Sep 17 00:00:00 2001
From: Michael Weiss <[email protected]>
Date: Tue, 14 Apr 2020 14:16:10 +0200
Subject: [PATCH] Enable accelerated video decode on Linux

This will enable accelerated video decode on Linux by default (i.e.
without "--ignore-gpu-blacklist"), but on NixOS we'll provide
"--disable-accelerated-video-decode" and
"--disable-accelerated-video-encode" by default to avoid regressions
(e.g. VA-API doesn't work properly for some radeon drivers).

Video acceleration can then be enabled via:
chromium.override { enableVaapi = true; }
without rebuilding Chromium.
---
gpu/config/software_rendering_list.json | 16 ----------------
1 file changed, 16 deletions(-)

diff --git a/gpu/config/software_rendering_list.json b/gpu/config/software_rendering_list.json
index 22712bdbf38f..a06dd19a50e4 100644
--- a/gpu/config/software_rendering_list.json
+++ b/gpu/config/software_rendering_list.json
@@ -336,22 +336,6 @@
]
},
{
- "id": 48,
- "description": "Accelerated video decode is unavailable on Linux",
- "cr_bugs": [137247, 1032907],
- "os": {
- "type": "linux"
- },
- "exceptions": [
- {
- "machine_model_name": ["Chromecast"]
- }
- ],
- "features": [
- "accelerated_video_decode"
- ]
- },
- {
"id": 50,
"description": "Disable VMware software renderer on older Mesa",
"cr_bugs": [145531, 332596, 571899, 629434],
--
2.11.0

18 changes: 9 additions & 9 deletions pkgs/applications/networking/browsers/chromium/upstream-info.nix
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# This file is autogenerated from update.sh in the same directory.
{
beta = {
sha256 = "1di0fhhv6lljc2b50i0i8qx5y5xswgxz1bimpda790sb3b1xsdzx";
sha256bin64 = "1f5qwx4476l4fvbw9w2i22i080bahlf83dzzpnbny7hk831g7msw";
version = "84.0.4147.38";
sha256 = "0wsqxq8xxcafmjxsjkagysrcbr6qryiyqn6m3ysp256aam7z3d88";
sha256bin64 = "03jff1sdv05hbn37cw0ij0r4rils0q11lnnhxg52igg633jzwyc1";
version = "84.0.4147.45";
};
dev = {
sha256 = "07h3i4ab7yj05ndrqchzf3f9wr809qb3dj2gfc1653mkjmba8h07";
sha256bin64 = "10jdq5mr7qby0m26l5lbsqcbh9bhjdpmpbkkcvv9wm2259rwjxr5";
version = "85.0.4164.2";
sha256 = "16rmzyzjmxmhmr5yqbzqbwf5sq94iqcwlm04fkafiwcycd17nyhs";
sha256bin64 = "0wjmc1wdmwiq9d1f5gk4c9jkj1p116kaz9nb0hvhjf01iv07xl2m";
version = "85.0.4168.2";
};
stable = {
sha256 = "10vg0fmwlkzpnixhhhcwccxshqdfq7rh0ribij7wgkw42bv0bi0j";
sha256bin64 = "09vz7ygixs7lwlsvbby3dmc2gz0vpjwalzdh6l6apc4dngyr095k";
version = "83.0.4103.97";
sha256 = "0bvy17ymlih87n4ymnzvyn0m34ghmr1yasvy7gxv02qbw6i57lfg";
sha256bin64 = "00hjr5y0cczs6h2pxrigpmjiv24456948v32q7mr7x5ysr5kxpn6";
version = "83.0.4103.106";
};
}

0 comments on commit 8056c50

Please sign in to comment.