summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO18
-rw-r--r--PKGBUILD118
-rw-r--r--chromium-ffmpeg-clang.patch21
-rw-r--r--enable-vaapi.patch398
4 files changed, 503 insertions, 52 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 16175bef83ce..f2203d7b2c14 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,8 +1,8 @@
# Generated by mksrcinfo v8
-# Wed Mar 27 14:34:30 UTC 2019
+# Sat Apr 6 15:59:39 UTC 2019
pkgbase = chromium-dev
pkgdesc = The open-source project behind Google Chrome (Dev Channel)
- pkgver = 74.0.3729.28
+ pkgver = 75.0.3753.4
pkgrel = 1
url = http://www.chromium.org
install = chromium-dev.install
@@ -43,20 +43,24 @@ pkgbase = chromium-dev
optdepends = libva-vdpau-driver-chromium: HW video acceleration for NVIDIA users
optdepends = libva-mesa-driver: HW video acceleration for Nouveau, R600 and RadeonSI users
optdepends = libva-intel-driver: HW video acceleration for Intel G45 and HD users
- source = https://commondatastorage.googleapis.com/chromium-browser-official/chromium-74.0.3729.28.tar.xz
+ source = https://commondatastorage.googleapis.com/chromium-browser-official/chromium-75.0.3753.4.tar.xz
source = git+https://github.com/foutrelis/chromium-launcher.git
source = chromium-dev.svg
- source = enable-vaapi.patch::https://raw.githubusercontent.com/saiarcot895/chromium-ubuntu-build/5c12891c099807bda7fa39ad0b62ef5ee4bc789c/debian/patches/enable_vaapi_on_linux_2.diff
+ source = enable-vaapi.patch
source = chromium-ffmpeg-clang.patch
source = chromium-widevine-r4.patch::https://git.archlinux.org/svntogit/packages.git/plain/trunk/chromium-widevine.patch?h=packages/chromium
source = chromium-skia-harmony.patch::https://git.archlinux.org/svntogit/packages.git/plain/trunk/chromium-skia-harmony.patch?h=packages/chromium
- sha256sums = 44b10a92638db9958ee9c75741784b72584529f59132711c32f3395d1ea5e8f7
+ source = nullptr.patch.base64::https://chromium-review.googlesource.com/changes/chromium%2Fsrc~1552864/revisions/2/patch?download
+ source = libcpp.patch.base64::https://chromium-review.googlesource.com/changes/chromium%2Fsrc~1546066/revisions/4/patch?download
+ sha256sums = 58d7db786e8504de52ba5113461f9015d743d906ff6dad743b90f4f5443e2994
sha256sums = SKIP
sha256sums = dd2b5c4191e468972b5ea8ddb4fa2e2fa3c2c94c79fc06645d0efc0e63ce7ee1
- sha256sums = SKIP
- sha256sums = 16741344288d200fadf74546855e00aa204122e744b4811a36155efd5537bd95
+ sha256sums = 4b785aeee1cab89bf410de063b7769ef4eb99130888ece60a38a584019747b9f
+ sha256sums = 0d386161052bf8bd3f6c68bdaf766042c75e84db8c3aa356f2e2f8b83511f29f
sha256sums = d081f2ef8793544685aad35dea75a7e6264a2cb987ff3541e6377f4a3650a28b
sha256sums = 5887f78b55c4ecbbcba5930f3f0bb7bc0117c2a41c2f761805fcf7f46f1ca2b3
+ sha256sums = 9a8fc71db40d2749819906041fc0eead2b9326521be898cc150b967b936fcbd3
+ sha256sums = 84a34c48df06ea3cc52bb9ad8e056e68e83a0068c9fce420c3e704091c7203fa
pkgname = chromium-dev
options = !strip
diff --git a/PKGBUILD b/PKGBUILD
index 2c00df2d113d..e7212f52ce7d 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -15,7 +15,7 @@ _use_wayland=0 # Build Wayland NOTE: extremely experimental and don't
## -- Package and components information -- ##
##############################################
pkgname=chromium-dev
-pkgver=74.0.3729.28
+pkgver=75.0.3753.4
pkgrel=1
pkgdesc="The open-source project behind Google Chrome (Dev Channel)"
arch=('x86_64')
@@ -72,30 +72,36 @@ optdepends=(
'libva-mesa-driver: HW video acceleration for Nouveau, R600 and RadeonSI users'
'libva-intel-driver: HW video acceleration for Intel G45 and HD users'
)
-source=( #"https://gsdview.appspot.com/chromium-browser-official/chromium-${pkgver}.tar.xz"
+source=(
+ #"https://gsdview.appspot.com/chromium-browser-official/chromium-${pkgver}.tar.xz"
"https://commondatastorage.googleapis.com/chromium-browser-official/chromium-${pkgver}.tar.xz"
'git+https://github.com/foutrelis/chromium-launcher.git'
'chromium-dev.svg'
# Patch form Gentoo.
- # Misc Patches.
- 'enable-vaapi.patch::https://raw.githubusercontent.com/saiarcot895/chromium-ubuntu-build/5c12891c099807bda7fa39ad0b62ef5ee4bc789c/debian/patches/enable_vaapi_on_linux_2.diff' # Use Saikrishna Arcot patch again
+ # Misc Patches.
+ 'enable-vaapi.patch' # Use Saikrishna Arcot patch again :https://raw.githubusercontent.com/saiarcot895/chromium-ubuntu-build/4d40b58013b518373b2544d486d3de40796edd36/debian/patches/enable_vaapi_on_linux_2.diff'
'chromium-ffmpeg-clang.patch'
# Patch from crbug (chromium bugtracker) or Arch chromium package.
'chromium-widevine-r4.patch::https://git.archlinux.org/svntogit/packages.git/plain/trunk/chromium-widevine.patch?h=packages/chromium'
'chromium-skia-harmony.patch::https://git.archlinux.org/svntogit/packages.git/plain/trunk/chromium-skia-harmony.patch?h=packages/chromium'
+ 'nullptr.patch.base64::https://chromium-review.googlesource.com/changes/chromium%2Fsrc~1552864/revisions/2/patch?download'
+ 'libcpp.patch.base64::https://chromium-review.googlesource.com/changes/chromium%2Fsrc~1546066/revisions/4/patch?download'
)
-sha256sums=( #"$(curl -sL https://gsdview.appspot.com/chromium-browser-official/chromium-${pkgver}.tar.xz.hashes | grep sha256 | cut -d ' ' -f3)"
+sha256sums=(
+ #"$(curl -sL https://gsdview.appspot.com/chromium-browser-official/chromium-${pkgver}.tar.xz.hashes | grep sha256 | cut -d ' ' -f3)"
"$(curl -sL https://commondatastorage.googleapis.com/chromium-browser-official/chromium-${pkgver}.tar.xz.hashes | grep sha256 | cut -d ' ' -f3)"
'SKIP'
'dd2b5c4191e468972b5ea8ddb4fa2e2fa3c2c94c79fc06645d0efc0e63ce7ee1'
# Patch form Gentoo
# Misc Patches
- 'SKIP'
- '16741344288d200fadf74546855e00aa204122e744b4811a36155efd5537bd95'
+ '4b785aeee1cab89bf410de063b7769ef4eb99130888ece60a38a584019747b9f'
+ '0d386161052bf8bd3f6c68bdaf766042c75e84db8c3aa356f2e2f8b83511f29f'
# Patch from crbug (chromium bugtracker) or Arch chromium package
'd081f2ef8793544685aad35dea75a7e6264a2cb987ff3541e6377f4a3650a28b'
'5887f78b55c4ecbbcba5930f3f0bb7bc0117c2a41c2f761805fcf7f46f1ca2b3'
+ '9a8fc71db40d2749819906041fc0eead2b9326521be898cc150b967b936fcbd3'
+ '84a34c48df06ea3cc52bb9ad8e056e68e83a0068c9fce420c3e704091c7203fa'
)
install=chromium-dev.install
@@ -148,6 +154,7 @@ _keeplibs=(
'third_party/angle/third_party/vulkan-tools'
'third_party/angle/third_party/vulkan-validation-layers'
'third_party/apple_apsl'
+ 'third_party/axe-core'
'third_party/blink'
'third_party/boringssl'
'third_party/boringssl/src/third_party/fiat'
@@ -174,10 +181,10 @@ _keeplibs=(
'third_party/cros_system_api'
'third_party/dav1d'
'third_party/devscripts'
+ 'third_party/dawn'
'third_party/dom_distiller_js'
'third_party/emoji-segmenter'
'third_party/ffmpeg'
- 'third_party/fips181'
'third_party/flatbuffers'
'third_party/flot'
'third_party/glslang'
@@ -253,6 +260,7 @@ _keeplibs=(
'third_party/SPIRV-Tools'
'third_party/sqlite'
'third_party/swiftshader'
+ 'third_party/swiftshader/third_party/llvm-7.0'
'third_party/swiftshader/third_party/llvm-subzero'
'third_party/swiftshader/third_party/subzero'
'third_party/tcmalloc'
@@ -327,6 +335,7 @@ _flags=(
'enable_mse_mpeg2ts_stream_parser=true'
'closure_compile=false'
'clang_use_chrome_plugins=true'
+ 'use_gold=false'
)
if [ "${_wayland}" = "1" ]; then
@@ -393,21 +402,52 @@ _clang_path="${BUILDDIR}${_builddir}/src/chromium-${pkgver}/third_party/llvm-bui
export CC="${_clang_path}clang"
export CXX="${_clang_path}clang++"
-export AR=ar
+export AR="${_clang_path}llvm-ar"
export NM=nm
+export RANLIB=/usr/bin/true
+_lld="ld.lld"
+
################################################
prepare() {
cd "${srcdir}/chromium-${pkgver}"
- # Use chromium-dev as branch name.
+ # Force script incompatible with Python 3 to use /usr/bin/python2.
+ sed -i '1s|python$|&2|' \
+ -i build/download_nacl_toolchains.py \
+ -i build/linux/unbundle/remove_bundled_libraries.py \
+ -i build/linux/unbundle/replace_gn_files.py \
+ -i tools/clang/scripts/update.py \
+ -i third_party/dom_distiller_js/protoc_plugins/json_values_converter.py \
+ -i third_party/dom_distiller_js/protoc_plugins/json_values_converter_tests.py \
+ -i third_party/ffmpeg/chromium/scripts/build_ffmpeg.py \
+ -i third_party/ffmpeg/chromium/scripts/generate_gn.py
+ export PNACLPYTHON=/usr/bin/python2
+
+ # Remove most bundled libraries. Some are still needed.
+ msg2 "Removing unnecessary components to save disk space."
+ build/linux/unbundle/remove_bundled_libraries.py ${_keeplibs[@]} --do-remove
+
+ msg2 "Changing bundle libraries to system ones."
+ build/linux/unbundle/replace_gn_files.py --system-libraries ${_use_system[@]}
+
+ msg2 "Setup NaCl/PNaCl SDK: Download and install toolchains"
+ build/download_nacl_toolchains.py --packages nacl_x86_newlib,pnacl_newlib,pnacl_translator sync --extract
+
+ msg2 "Download external build components from google"
+ tools/clang/scripts/update.py
+
+ # Use chromium-dev as brand name.
+ sed -e 's|=Chromium|&-dev|g' \
+ -i chrome/app/theme/chromium/BRANDING
sed -e '0,/output_name = "chrome"/s/= "chrome"/= "chromium-dev"/' \
-e 's|root_out_dir/chrome"|root_out_dir/chromium-dev"|g' \
-i chrome/BUILD.gn
sed -e 's|"chromium-browser"|"chromium-dev"|g' \
- -e 's|"Chromium|&-dev|g' \
-i media/audio/pulse/pulse_util.cc
+ sed -e 's|"Chromium|&-dev|g' \
+ -i chrome/common/chrome_constants.cc
sed -e 's|chromium-browser|chromium-dev|g' \
-i chrome/browser/shell_integration_linux.cc \
-i chrome/browser/ui/libgtkui/gtk_util.cc
@@ -417,7 +457,10 @@ prepare() {
-e 's|/usr/share/chromium|&-dev|' \
-i chrome/common/chrome_paths.cc
sed -e 's|/etc/chromium|&-dev|' \
+ -e "s|'app_name': 'Chromium|&-dev|g" \
-i components/policy/tools/template_writers/writer_configuration.py
+
+ # Fix(?) the name of the sandbox.
sed -e 's|chrome-sandbox|chrome_sandbox|g'\
-i sandbox/linux/suid/client/setuid_sandbox_host.cc
@@ -428,7 +471,6 @@ prepare() {
# Pats to chromium dev's about why always they forget add/remove missing build rules.
# Not this time (?).
-
# Allow building against system libraries in official builds.
sed 's|OFFICIAL_BUILD|GOOGLE_CHROME_BUILD|' \
-i tools/generate_shim_headers/generate_shim_headers.py
@@ -440,24 +482,18 @@ prepare() {
-i third_party/blink/renderer/core/xml/parser/xml_document_parser.cc \
-i third_party/libxml/chromium/libxml_utils.cc
- # Force script incompatible with Python 3 to use /usr/bin/python2.
- sed -i '1s|python$|&2|' \
- -i build/download_nacl_toolchains.py \
- -i build/linux/unbundle/remove_bundled_libraries.py \
- -i build/linux/unbundle/replace_gn_files.py \
- -i tools/clang/scripts/update.py \
- -i third_party/dom_distiller_js/protoc_plugins/json_values_converter.py \
- -i third_party/dom_distiller_js/protoc_plugins/json_values_converter_tests.py \
- -i third_party/ffmpeg/chromium/scripts/build_ffmpeg.py \
- -i third_party/ffmpeg/chromium/scripts/generate_gn.py
- export PNACLPYTHON=/usr/bin/python2
-
# Enable VAAPI.
patch -p1 -i "${srcdir}/enable-vaapi.patch"
sed 's|/dri/|/|g' -i media/gpu/vaapi/vaapi_wrapper.cc
# Patch from crbug (chromium bugtracker) or Arch chromium package.
+ # https://crbug.org/819294.
+ base64 --decode "${srcdir}/nullptr.patch.base64" | patch -p1 -i -
+
+ # https://crbug.org/947527.
+ base64 --decode "${srcdir}/libcpp.patch.base64" | patch -p1 -i -
+
# https://crbug.com/skia/6663#c10.
patch -p0 -i "${srcdir}/chromium-skia-harmony.patch"
@@ -468,30 +504,24 @@ prepare() {
mkdir -p third_party/node/linux/node-linux-x64/bin/
ln -sf /usr/bin/node third_party/node/linux/node-linux-x64/bin/node
- # Setup bundled ffmpeg.
- # Setup the ffmpeg correct compiler if use bundled clang.
- cat "${srcdir}/chromium-ffmpeg-clang.patch" | sed "s|__CLANG_PATH__|${_clang_path}|g" | patch -p1 -i -
-
- # use system opus in bundled ffmpeg.
- sed -e "s|I' + os.path.join(CHROMIUM_ROOT_DIR,|I' + os.path.join\(|g" \
- -e 's|third_party/opus/src/include|/usr/include/opus|g' \
- -i third_party/ffmpeg/chromium/scripts/build_ffmpeg.py
-
- # Remove most bundled libraries. Some are still needed.
- msg2 "Removing unnecessary components to save space."
- build/linux/unbundle/remove_bundled_libraries.py ${_keeplibs[@]} --do-remove
-
- msg2 "Changing bundle libraries to system ones."
- build/linux/unbundle/replace_gn_files.py --system-libraries ${_use_system[@]}
-
# Use the file at run time instead of effectively compiling it in.
sed 's|//third_party/usb_ids/usb.ids|/usr/share/hwdata/usb.ids|g' -i device/usb/BUILD.gn
- msg2 "Setup NaCl/PNaCl SDK: Download and install toolchains"
- build/download_nacl_toolchains.py --packages nacl_x86_newlib,pnacl_newlib,pnacl_translator sync --extract
+ # Setup the linker in chromium.
+ sed "s|fuse-ld=lld|fuse-ld=${_clang_path}${_lld}|g" -i build/config/compiler/BUILD.gn
- msg2 "Download external build components from google"
- tools/clang/scripts/update.py --without-android --without-fuchsia
+ # Setup bundled ffmpeg.
+ # Setup the linker in ffmpeg.
+ cat "${srcdir}/chromium-ffmpeg-clang.patch" | sed -e "s|__CLANG_PATH__|${_clang_path}|g" -e "s|__LLD__|${_lld}|g" | patch -p1 -i -
+ # Disable lto.
+ # This avoid messages like:
+ # bfd plugin: LLVM gold plugin has failed to create LTO module: Unknown attribute kind (60) (Producer: 'LLVM9.0.0svn' Reader: 'LLVM 8.0.0')
+ # when you have installed clang in the system.
+ sed 's|--enable-lto|--disable-lto|g' \
+ -i third_party/ffmpeg/chromium/scripts/build_ffmpeg.py
+ # Use system opus.
+ rm -fr third_party/opus/src/include
+ ln -sf /usr/include/opus/ third_party/opus/src/include
}
build() {
diff --git a/chromium-ffmpeg-clang.patch b/chromium-ffmpeg-clang.patch
index 4caf3ecf54b3..1a9d15fd0f3d 100644
--- a/chromium-ffmpeg-clang.patch
+++ b/chromium-ffmpeg-clang.patch
@@ -1,6 +1,15 @@
--- a/third_party/ffmpeg/chromium/scripts/build_ffmpeg.py
+++ b/third_party/ffmpeg/chromium/scripts/build_ffmpeg.py
-@@ -640,9 +640,9 @@
+@@ -425,7 +425,7 @@ def BuildFFmpeg(target_os, target_arch, host_os, host_arch, parallel_jobs,
+ os.path.join('libavutil', GetDsoName(target_os, 'avutil', 56)),
+ ]
+ PrintAndCheckCall(
+- ['make', '-j%d' % parallel_jobs] + libraries, cwd=config_dir)
++ ['make', 'V=1', '-j%d' % parallel_jobs] + libraries, cwd=config_dir)
+ for lib in libraries:
+ shutil.copy(
+ os.path.join(config_dir, lib), os.path.join(config_dir, 'out'))
+@@ -782,9 +782,10 @@ def ConfigureAndBuild(target_arch, target_os, host_os, host_arch, parallel_jobs,
if 'win' not in target_os:
configure_flags['Common'].extend([
'--enable-pic',
@@ -10,6 +19,16 @@
+ '--cc=__CLANG_PATH__clang',
+ '--cxx=__CLANG_PATH__clang++',
+ '--ld=__CLANG_PATH__clang',
++ '--ar=__CLANG_PATH__llvm-ar',
])
# Clang Linux will use the first 'ld' it finds on the path, which will
+@@ -792,7 +792,7 @@ def ConfigureAndBuild(target_arch, target_os, host_os, host_arch, parallel_jobs,
+ # ld.lld, to ensure that things like cross-compilation and LTO work.
+ # This does not work for arm64, ia32 and is always used on mac.
+ if target_arch not in ['arm64', 'ia32', 'mipsel'] and target_os != 'mac':
+- configure_flags['Common'].append('--extra-ldflags=-fuse-ld=lld')
++ configure_flags['Common'].append('--extra-ldflags=-fuse-ld=__CLANG_PATH____LLD__')
+
+ # Should be run on Mac, unless we're cross-compiling on Linux.
+ if target_os == 'mac':
diff --git a/enable-vaapi.patch b/enable-vaapi.patch
new file mode 100644
index 000000000000..d73bbb4fd77a
--- /dev/null
+++ b/enable-vaapi.patch
@@ -0,0 +1,398 @@
+From 53b93dfe87fd10cced5d2a2a63072dfc7a2af6e4 Mon Sep 17 00:00:00 2001
+From: Daniel Charles <daniel.charles@intel.com>
+Date: Fri, 28 Jul 2017 16:31:47 -0700
+Subject: [PATCH] Enable VAVDA, VAVEA and VAJDA on linux with VAAPI only
+
+This patch contains all the changes necessary to use VA-API along with
+vaapi-driver to run all media use cases supported with hardware acceleration.
+
+It is intended to remain as experimental accessible from chrome://flags on linux.
+It requires libva/intel-vaapi-driver to be installed on the system path where
+chrome is executed. Other drivers could be tested if available. Flags are
+kept independent for linux, where this feature has to be enabled before
+actually using it. This should not change how other OSes use the flags
+already, the new flags will show at the buttom on the section of unavailable
+experiments
+
+The changes cover a range of compiler pre-processor flags to enable the stack.
+It moves the presandbox operations to the vaapi_wrapper class as the hook function
+is available there. vaInit will open driver on the correct installed folder.
+
+chrome flags consolidtation into only two flags for linux. Mjpeg and accelerated
+video are used. The other flags are kept for ChromeOS and other OSes.
+
+Developer testing was made on skylake hardware, ChromeOS and Ubuntu.
+
+BUG=NONE
+TEST="subjective testing with VAVDA,VAVEA and VAJDA, autotest for encoder"
+TEST="and decoder hardware accelerated"
+TEST="have libva/intel-vaapi-driver installed and not installed in the system"
+TEST="repeat on different hardware families"
+R=posciak@chromium.org
+R=kcwu@chromium.org
+
+Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
+Change-Id: Ifbbf5c9e5221a8b5733fc6d4d0cf984a1f103171
+Signed-off-by: Daniel Charles <daniel.charles@intel.com>
+---
+
+Index: dev/chrome/browser/about_flags.cc
+===================================================================
+--- dev.orig/chrome/browser/about_flags.cc
++++ dev/chrome/browser/about_flags.cc
+@@ -1443,7 +1443,7 @@ const FeatureEntry kFeatureEntries[] = {
+ "disable-accelerated-video-decode",
+ flag_descriptions::kAcceleratedVideoDecodeName,
+ flag_descriptions::kAcceleratedVideoDecodeDescription,
+- kOsMac | kOsWin | kOsCrOS | kOsAndroid,
++ kOsAll,
+ SINGLE_DISABLE_VALUE_TYPE(switches::kDisableAcceleratedVideoDecode),
+ },
+ #if defined(OS_WIN)
+@@ -2000,10 +2000,10 @@ const FeatureEntry kFeatureEntries[] = {
+ FEATURE_VALUE_TYPE(service_manager::features::kXRSandbox)},
+ #endif // ENABLE_ISOLATED_XR_SERVICE
+ #endif // ENABLE_VR
+-#if defined(OS_CHROMEOS)
++#if defined(OS_LINUX) && !defined(OS_ANDROID)
+ {"disable-accelerated-mjpeg-decode",
+ flag_descriptions::kAcceleratedMjpegDecodeName,
+- flag_descriptions::kAcceleratedMjpegDecodeDescription, kOsCrOS,
++ flag_descriptions::kAcceleratedMjpegDecodeDescription, kOsCrOS | kOsLinux,
+ SINGLE_DISABLE_VALUE_TYPE(switches::kDisableAcceleratedMjpegDecode)},
+ #endif // OS_CHROMEOS
+ {"v8-cache-options", flag_descriptions::kV8CacheOptionsName,
+Index: dev/chrome/browser/flag_descriptions.cc
+===================================================================
+--- dev.orig/chrome/browser/flag_descriptions.cc
++++ dev/chrome/browser/flag_descriptions.cc
+@@ -2972,9 +2972,7 @@ const char kMacViewsTaskManagerDescripti
+
+ #endif
+
+-// Chrome OS -------------------------------------------------------------------
+-
+-#if defined(OS_CHROMEOS)
++#if defined(OS_LINUX) && !defined(OS_ANDROID)
+
+ const char kAcceleratedMjpegDecodeName[] =
+ "Hardware-accelerated mjpeg decode for captured frame";
+@@ -2982,6 +2980,12 @@ const char kAcceleratedMjpegDecodeDescri
+ "Enable hardware-accelerated mjpeg decode for captured frame where "
+ "available.";
+
++#endif
++
++// Chrome OS -------------------------------------------------------------------
++
++#if defined(OS_CHROMEOS)
++
+ const char kAppServiceAshName[] = "App Service Ash";
+ const char kAppServiceAshDescription[] =
+ "Use the App Service to provide data to the Ash UI, such as the shelf and "
+Index: dev/chrome/browser/flag_descriptions.h
+===================================================================
+--- dev.orig/chrome/browser/flag_descriptions.h
++++ dev/chrome/browser/flag_descriptions.h
+@@ -1755,13 +1755,17 @@ extern const char kPermissionPromptPersi
+
+ #endif // defined(OS_MACOSX)
+
+-// Chrome OS ------------------------------------------------------------------
+-
+-#if defined(OS_CHROMEOS)
++#if defined(OS_LINUX) && !defined(OS_ANDROID)
+
+ extern const char kAcceleratedMjpegDecodeName[];
+ extern const char kAcceleratedMjpegDecodeDescription[];
+
++#endif
++
++// Chrome OS ------------------------------------------------------------------
++
++#if defined(OS_CHROMEOS)
++
+ extern const char kAppServiceAshName[];
+ extern const char kAppServiceAshDescription[];
+
+Index: dev/content/gpu/BUILD.gn
+===================================================================
+--- dev.orig/content/gpu/BUILD.gn
++++ dev/content/gpu/BUILD.gn
+@@ -6,6 +6,7 @@ import("//build/config/jumbo.gni")
+ import("//build/config/ui.gni")
+ import("//gpu/vulkan/features.gni")
+ import("//media/media_options.gni")
++import("//media/gpu/args.gni")
+ import("//ui/ozone/ozone.gni")
+
+ # See //content/BUILD.gn for how this works.
+@@ -136,4 +137,8 @@ target(link_target_type, "gpu_sources")
+ (!is_chromecast || is_cast_desktop_build)) {
+ configs += [ "//build/config/linux/dri" ]
+ }
++
++ if (is_desktop_linux && use_vaapi) {
++ public_configs = [ "//build/config/linux/libva" ]
++ }
+ }
+Index: dev/gpu/config/software_rendering_list.json
+===================================================================
+--- dev.orig/gpu/config/software_rendering_list.json
++++ dev/gpu/config/software_rendering_list.json
+@@ -370,17 +370,6 @@
+ ]
+ },
+ {
+- "id": 48,
+- "description": "Accelerated video decode is unavailable on Linux",
+- "cr_bugs": [137247],
+- "os": {
+- "type": "linux"
+- },
+- "features": [
+- "accelerated_video_decode"
+- ]
+- },
+- {
+ "id": 50,
+ "description": "Disable VMware software renderer on older Mesa",
+ "cr_bugs": [145531, 332596, 571899, 629434],
+Index: dev/media/base/media_switches.cc
+===================================================================
+--- dev.orig/media/base/media_switches.cc
++++ dev/media/base/media_switches.cc
+@@ -506,7 +506,7 @@ bool IsVideoCaptureAcceleratedJpegDecodi
+ switches::kUseFakeJpegDecodeAccelerator)) {
+ return true;
+ }
+-#if defined(OS_CHROMEOS)
++#if defined(OS_LINUX) && !defined(OS_ANDROID)
+ return true;
+ #endif
+ return false;
+Index: dev/media/filters/BUILD.gn
+===================================================================
+--- dev.orig/media/filters/BUILD.gn
++++ dev/media/filters/BUILD.gn
+@@ -5,6 +5,7 @@
+ import("//build/config/jumbo.gni")
+ import("//media/media_options.gni")
+ import("//third_party/libaom/options.gni")
++import("//media/gpu/args.gni")
+
+ jumbo_source_set("filters") {
+ # Do not expand the visibility here without double-checking with OWNERS, this
+@@ -212,7 +213,7 @@ jumbo_source_set("filters") {
+ deps += [ "//media/base/android" ]
+ }
+
+- if (current_cpu != "arm" && is_linux) {
++ if (use_vaapi) {
+ sources += [
+ "h264_bitstream_buffer.cc",
+ "h264_bitstream_buffer.h",
+Index: dev/media/gpu/BUILD.gn
+===================================================================
+--- dev.orig/media/gpu/BUILD.gn
++++ dev/media/gpu/BUILD.gn
+@@ -577,6 +577,7 @@ if (is_chromeos || is_linux) {
+ if (use_ozone) {
+ deps += [ "//ui/ozone" ]
+ }
++ public_configs = [ "//build/config/linux/libva" ]
+ }
+ }
+
+Index: dev/media/gpu/gpu_video_decode_accelerator_factory.cc
+===================================================================
+--- dev.orig/media/gpu/gpu_video_decode_accelerator_factory.cc
++++ dev/media/gpu/gpu_video_decode_accelerator_factory.cc
+@@ -183,6 +183,8 @@ GpuVideoDecodeAcceleratorFactory::Create
+ vda = (this->*create_vda_function)(workarounds, gpu_preferences, media_log);
+ if (vda && vda->Initialize(config, client))
+ return vda;
++ else
++ LOG(ERROR) << "Initialization of one or more VDAs failed.";
+ }
+
+ return nullptr;
+@@ -241,6 +243,7 @@ GpuVideoDecodeAcceleratorFactory::Create
+ const gpu::GpuDriverBugWorkarounds& workarounds,
+ const gpu::GpuPreferences& gpu_preferences,
+ MediaLog* media_log) const {
++ LOG(WARNING) << "Initializing VAAPI VDA.";
+ std::unique_ptr<VideoDecodeAccelerator> decoder;
+ decoder.reset(new VaapiVideoDecodeAccelerator(make_context_current_cb_,
+ bind_image_cb_));
+Index: dev/media/gpu/ipc/service/gpu_video_decode_accelerator.cc
+===================================================================
+--- dev.orig/media/gpu/ipc/service/gpu_video_decode_accelerator.cc
++++ dev/media/gpu/ipc/service/gpu_video_decode_accelerator.cc
+@@ -381,6 +381,7 @@ bool GpuVideoDecodeAccelerator::Initiali
+ LOG(ERROR) << "Failed creating the VDA factory";
+ return false;
+ }
++ LOG(WARNING) << "Created the VDA factory";
+
+ const gpu::GpuDriverBugWorkarounds& gpu_workarounds =
+ stub_->channel()->gpu_channel_manager()->gpu_driver_bug_workarounds();
+@@ -394,6 +395,7 @@ bool GpuVideoDecodeAccelerator::Initiali
+ << (config.is_encrypted() ? " with encryption" : "");
+ return false;
+ }
++ LOG(WARNING) << "Created VDA";
+
+ // Attempt to set up performing decoding tasks on IO thread, if supported by
+ // the VDA.
+Index: dev/media/gpu/vaapi/vaapi_video_decode_accelerator.cc
+===================================================================
+--- dev.orig/media/gpu/vaapi/vaapi_video_decode_accelerator.cc
++++ dev/media/gpu/vaapi/vaapi_video_decode_accelerator.cc
+@@ -74,6 +74,7 @@ void CloseGpuMemoryBufferHandle(const gf
+ }
+ #endif
+
++#if defined(OS_ANDROID) || defined(OS_CHROMEOS)
+ // Returns true if the CPU is an Intel Kaby/Gemini/Sky Lake or later.
+ // Cpu platform id's are referenced from the following file in kernel source
+ // arch/x86/include/asm/intel-family.h
+@@ -103,6 +104,7 @@ bool IsSkyLakeOrLater() {
+ cpuid.model() >= kFirstSkyLakeModelId;
+ return is_sky_lake_or_later;
+ }
++#endif
+
+ } // namespace
+
+@@ -652,6 +654,10 @@ void VaapiVideoDecodeAccelerator::Assign
+ const unsigned int va_format = GetVaFormatForVideoCodecProfile(profile_);
+ std::vector<VASurfaceID> va_surface_ids;
+
++ // Nvidia doesn't support VAProfileNone, so don't try to create a temporary
++ // copy buffer there. It's not needed anyways for hardware video decoding
++ // to work.
++#if defined(OS_ANDROID) || defined(OS_CHROMEOS)
+ // If we aren't in BufferAllocationMode::kNone, we have to allocate a
+ // |vpp_vaapi_wrapper_| for VaapiPicture to DownloadFromSurface() the VA's
+ // internal decoded frame.
+@@ -665,6 +671,7 @@ void VaapiVideoDecodeAccelerator::Assign
+ NotifyError(PLATFORM_FAILURE);
+ }
+ }
++#endif
+
+ for (size_t i = 0; i < buffers.size(); ++i) {
+ DCHECK(requested_pic_size_ == buffers[i].size());
+@@ -673,9 +680,13 @@ void VaapiVideoDecodeAccelerator::Assign
+ // only used as a copy destination. Therefore, the VaapiWrapper used and
+ // owned by |picture| is |vpp_vaapi_wrapper_|.
+ std::unique_ptr<VaapiPicture> picture = vaapi_picture_factory_->Create(
++#if defined(OS_LINUX) && !defined(OS_ANDROID) && !defined(OS_CHROMEOS)
++ vaapi_wrapper_,
++#else
+ (buffer_allocation_mode_ == BufferAllocationMode::kNone)
+ ? vaapi_wrapper_
+ : vpp_vaapi_wrapper_,
++#endif
+ make_context_current_cb_, bind_image_cb_, buffers[i]);
+ RETURN_AND_NOTIFY_ON_FAILURE(picture, "Failed creating a VaapiPicture",
+ PLATFORM_FAILURE, );
+@@ -1091,6 +1102,9 @@ VaapiVideoDecodeAccelerator::GetSupporte
+
+ VaapiVideoDecodeAccelerator::BufferAllocationMode
+ VaapiVideoDecodeAccelerator::DecideBufferAllocationMode() const {
++#if defined(OS_LINUX) && !defined(OS_ANDROID) && !defined(OS_CHROMEOS)
++ return BufferAllocationMode::kNormal;
++#else
+ // TODO(crbug.com/912295): Enable a better BufferAllocationMode for IMPORT
+ // |output_mode_| as well.
+ if (output_mode_ == VideoDecodeAccelerator::Config::OutputMode::IMPORT)
+@@ -1123,6 +1137,7 @@ VaapiVideoDecodeAccelerator::DecideBuffe
+ return BufferAllocationMode::kReduced;
+
+ return BufferAllocationMode::kSuperReduced;
++#endif
+ }
+
+ bool VaapiVideoDecodeAccelerator::IsBufferAllocationModeReducedOrSuperReduced()
+Index: dev/media/gpu/vaapi/vaapi_wrapper.cc
+===================================================================
+--- dev.orig/media/gpu/vaapi/vaapi_wrapper.cc
++++ dev/media/gpu/vaapi/vaapi_wrapper.cc
+@@ -252,6 +252,11 @@ void VADisplayState::PreSandboxInitializ
+ base::File::FLAG_OPEN | base::File::FLAG_READ | base::File::FLAG_WRITE);
+ if (drm_file.IsValid())
+ VADisplayState::Get()->SetDrmFd(drm_file.GetPlatformFile());
++
++ const char kNvidiaPath[] = "/dev/dri/nvidiactl";
++ base::File nvidia_file = base::File(
++ base::FilePath::FromUTF8Unsafe(kNvidiaPath),
++ base::File::FLAG_OPEN | base::File::FLAG_READ | base::File::FLAG_WRITE);
+ }
+
+ VADisplayState::VADisplayState()
+@@ -279,9 +284,6 @@ bool VADisplayState::Initialize() {
+ }
+
+ bool VADisplayState::InitializeOnce() {
+- static_assert(VA_MAJOR_VERSION >= 1 && VA_MINOR_VERSION >= 1,
+- "Requires VA-API >= 1.1.0");
+-
+ switch (gl::GetGLImplementation()) {
+ case gl::kGLImplementationEGLGLES2:
+ va_display_ = vaGetDisplayDRM(drm_fd_.get());
+@@ -289,10 +291,10 @@ bool VADisplayState::InitializeOnce() {
+ case gl::kGLImplementationDesktopGL:
+ #if defined(USE_X11)
+ va_display_ = vaGetDisplay(gfx::GetXDisplay());
+-#else
+- LOG(WARNING) << "VAAPI video acceleration not available without "
+- "DesktopGL (GLX).";
++ if (vaDisplayIsValid(va_display_))
++ break;
+ #endif // USE_X11
++ va_display_ = vaGetDisplayDRM(drm_fd_.get());
+ break;
+ // Cannot infer platform from GL, try all available displays
+ case gl::kGLImplementationNone:
+@@ -325,8 +327,19 @@ bool VADisplayState::InitializeOnce() {
+ int major_version, minor_version;
+ VAStatus va_res = vaInitialize(va_display_, &major_version, &minor_version);
+ if (va_res != VA_STATUS_SUCCESS) {
+- LOG(ERROR) << "vaInitialize failed: " << vaErrorStr(va_res);
+- return false;
++ LOG(ERROR) << "vaInitialize failed (ignore if using Wayland desktop environment): " << vaErrorStr(va_res);
++ va_display_ = vaGetDisplayDRM(drm_fd_.get());
++ if (!vaDisplayIsValid(va_display_)) {
++ LOG(ERROR) << "Could not get a valid DRM VA display";
++ return false;
++ }
++ va_res = vaInitialize(va_display_, &major_version, &minor_version);
++ if (va_res != VA_STATUS_SUCCESS) {
++ LOG(ERROR) << "vaInitialize failed using DRM: " << vaErrorStr(va_res);
++ return false;
++ } else {
++ LOG(WARNING) << "vaInitialize succeeded for DRM";
++ }
+ }
+
+ va_initialized_ = true;
+@@ -334,7 +347,7 @@ bool VADisplayState::InitializeOnce() {
+ va_vendor_string_ = vaQueryVendorString(va_display_);
+ DLOG_IF(WARNING, va_vendor_string_.empty())
+ << "Vendor string empty or error reading.";
+- DVLOG(1) << "VAAPI version: " << major_version << "." << minor_version << " "
++ VLOG(1) << "VAAPI version: " << major_version << "." << minor_version << " "
+ << va_vendor_string_;
+
+ // The VAAPI version is determined from what is loaded on the system by
+@@ -638,7 +651,7 @@ bool VASupportedProfiles::AreAttribsSupp
+ if (attribs[i].type != required_attribs[i].type ||
+ (attribs[i].value & required_attribs[i].value) !=
+ required_attribs[i].value) {
+- DVLOG(1) << "Unsupported value " << required_attribs[i].value
++ VLOG(1) << "Unsupported value " << required_attribs[i].value
+ << " for attribute type " << required_attribs[i].type;
+ return false;
+ }