diff options
-rw-r--r-- | .SRCINFO | 55 | ||||
-rw-r--r-- | PKGBUILD | 280 | ||||
-rw-r--r-- | PNGImageDecoder.patch | 11 | ||||
-rw-r--r-- | chromium-52.0.2743.116-unset-madv_free.patch | 15 | ||||
-rw-r--r-- | chromium-gn-bootstrap-r2.patch | 13 | ||||
-rw-r--r-- | chromium-launcher-3.tar.gz | bin | 2884 -> 0 bytes | |||
-rw-r--r-- | chromium-system-ffmpeg-r4.patch | 48 | ||||
-rw-r--r-- | chromium_vaapi-intel.patch | 155 | ||||
-rw-r--r-- | chromium_vaapi-other.patch | 76 | ||||
-rw-r--r-- | chromium_vaapi.patch | 793 | ||||
-rw-r--r-- | vaapi_patch_r0.patch | 616 |
11 files changed, 819 insertions, 1243 deletions
@@ -1,8 +1,8 @@ pkgbase = chromium-vaapi - pkgdesc = Chromium compiled with support for VA-API, allowing GPU accelerated decode of H.264 and other video formats supported by your GPU. - pkgver = 53.0.2785.143 + pkgdesc = Chromium compiled with support for VA-API, allowing GPU accelerated decode of H.264 and other video formats supported by your GPU + pkgver = 58.0.3029.110 pkgrel = 1 - url = http://www.chromium.org/ + url = https://www.chromium.org/Home install = chromium.install arch = i686 arch = x86_64 @@ -12,56 +12,53 @@ pkgbase = chromium-vaapi makedepends = yasm makedepends = mesa makedepends = ninja - makedepends = lib32-gcc-libs - makedepends = lib32-zlib + makedepends = nodejs + makedepends = git depends = gtk2 depends = nss depends = alsa-lib depends = xdg-utils - depends = bzip2 - depends = libevent depends = libxss depends = libexif depends = libgcrypt depends = ttf-font depends = systemd depends = dbus - depends = flac - depends = snappy - depends = speech-dispatcher - depends = pciutils depends = libpulse - depends = harfbuzz - depends = libsecret - depends = libvpx depends = perl depends = perl-file-basedir + depends = pciutils depends = desktop-file-utils depends = hicolor-icon-theme - optdepends = libva-intel-driver: Needed to support VA-API for Intel graphics cards - optdepends = mesa-vdpau: needed for ATI graphics cards to enable VDPAU - optdepends = nvidia-utils: needed for NVIDIA graphics cards to enable VDPAU - optdepends = libva-vdpau-driver: needed by NVIDIA/ATI graphics cards to expose VA-API using a VDPAU backend + depends = flac + depends = minizip + depends = libxml2 + depends = libpng + depends = harfbuzz-icu + depends = libxslt + depends = re2 + depends = libwebp + depends = libjpeg + depends = snappy + optdepends = kdialog: needed for file dialogs in KDE + optdepends = gnome-keyring: for storing passwords in GNOME keyring optdepends = kwallet: for storing passwords in KWallet provides = chromium conflicts = chromium - options = !strip - source = https://commondatastorage.googleapis.com/chromium-browser-official/chromium-53.0.2785.143.tar.xz + source = https://commondatastorage.googleapis.com/chromium-browser-official/chromium-58.0.3029.110.tar.xz source = chromium-launcher-3.tar.gz::https://github.com/foutrelis/chromium-launcher/archive/v3.tar.gz source = chromium.desktop + source = chromium-system-ffmpeg-r4.patch + source = chromium-gn-bootstrap-r2.patch source = chromium-widevine.patch - source = chromium-52.0.2743.116-unset-madv_free.patch - source = chromium_vaapi.patch - source = chromium_vaapi-intel.patch - source = chromium_vaapi-other.patch - sha256sums = c52a58b79bfb27bb87e4a0a6ff213001485fbc747657b290f75d39ddce07dcc3 + source = vaapi_patch_r0.patch + sha256sums = f24cef3dd2acf9dd5ccdeeca47fea42d1c1ddff32b7375dc9e0cd35a4e8d78ff sha256sums = 8b01fb4efe58146279858a754d90b49e5a38c9a0b36a1f84cbb7d12f92b84c28 sha256sums = 028a748a5c275de9b8f776f97909f999a8583a4b77fd1cd600b4fc5c0c3e91e9 + sha256sums = e3c474dbf3822a0be50695683bd8a2c9dfc82d41c1524a20b4581883c0c88986 + sha256sums = 64d743c78183c302c42d1f289863e34c74832fca57443833e46a0a3157e2b5de sha256sums = d6fdcb922e5a7fbe15759d39ccc8ea4225821c44d98054ce0f23f9d1f00c9808 - sha256sums = 3b3aa9e28f29e6f539ed1c7832e79463b13128863a02e9c6fecd16c30d61c227 - sha256sums = 4700a2d75c5cec59ff4d78c284d20df591c07321565bb25e4bbbd5c671a5d22e - sha256sums = c479910bc405666f8c8c7760e983abc20ab65764ca1d889040bcba34e8b5b4b9 - sha256sums = b0965313c6bd653ffda8dae6a6d9f2863488159b49a24a29b1303068321243c6 + sha256sums = fef17ee6b80b9c60e4579ec4afec72fedb6ab1807ecc5903ab6aa2ccbb9fc8b0 pkgname = chromium-vaapi @@ -1,6 +1,7 @@ -# Maintainer: Samantha McVey samantham@posteo.net +# Maintainer: Kien Dang Tran loganeast257@gmail.com +# Ex-Maintainer: Samantha McVey samantham@posteo.net # Based off the official Chromium package, but with a patch to enable VA-API -# +# The VA-API patch is taken from the chromium-dev package source # Official Arch Linux Chromium package Maintainers and Contributors: # # Maintainer: Evangelos Foutras <evangelos@foutrelis.com> @@ -8,47 +9,58 @@ # Contributor: Jan "heftig" Steffens <jan.steffens@gmail.com> # Contributor: Daniel J Griffiths <ghost1227@archlinux.us> # + +declare -rgA _system_libs=( + #[ffmpeg]=ffmpeg # https://bugs.archlinux.org/task/53796 + [flac]=flac + [harfbuzz-ng]=harfbuzz-icu + #[icu]=icu # Enable again when upstream supports ICU 59 + [libjpeg]=libjpeg + [libpng]=libpng + #[libvpx]=libvpx # https://bugs.gentoo.org/show_bug.cgi?id=611394 + [libwebp]=libwebp + [libxml]=libxml2 + [libxslt]=libxslt + [re2]=re2 + [snappy]=snappy + [yasm]= + [zlib]=minizip +) + pkgname=chromium-vaapi -pkgver=53.0.2785.143 +pkgver=58.0.3029.110 pkgrel=1 _launcher_ver=3 -pkgdesc="Chromium compiled with support for VA-API, allowing GPU accelerated decode of H.264 and other video formats supported by -your GPU." +pkgdesc="Chromium compiled with support for VA-API, allowing GPU accelerated decode of H.264 and other video formats supported by your GPU" arch=('i686' 'x86_64') -url="http://www.chromium.org/" +url="https://www.chromium.org/Home" license=('BSD') -depends=('gtk2' 'nss' 'alsa-lib' 'xdg-utils' 'bzip2' 'libevent' 'libxss' - 'libexif' 'libgcrypt' 'ttf-font' 'systemd' 'dbus' 'flac' 'snappy' - 'speech-dispatcher' 'pciutils' 'libpulse' 'harfbuzz' 'libsecret' - 'libvpx' 'perl' 'perl-file-basedir' 'desktop-file-utils' - 'hicolor-icon-theme') +depends=('gtk2' 'nss' 'alsa-lib' 'xdg-utils' 'libxss' 'libexif' 'libgcrypt' + 'ttf-font' 'systemd' 'dbus' 'libpulse' 'perl' 'perl-file-basedir' + 'pciutils' 'desktop-file-utils' 'hicolor-icon-theme') +depends+=(${_system_libs[@]}) provides=('chromium') conflicts=('chromium') -makedepends=('python2' 'gperf' 'yasm' 'mesa' 'ninja') -makedepends_x86_64=('lib32-gcc-libs' 'lib32-zlib') -optdepends=('libva-intel-driver: Needed to support VA-API for Intel graphics cards' - 'mesa-vdpau: needed for ATI graphics cards to enable VDPAU' - 'nvidia-utils: needed for NVIDIA graphics cards to enable VDPAU' - 'libva-vdpau-driver: needed by NVIDIA/ATI graphics cards to expose VA-API using a VDPAU backend' +makedepends=('python2' 'gperf' 'yasm' 'mesa' 'ninja' 'nodejs' 'git') +optdepends=('kdialog: needed for file dialogs in KDE' + 'gnome-keyring: for storing passwords in GNOME keyring' 'kwallet: for storing passwords in KWallet') -options=('!strip') install=chromium.install source=(https://commondatastorage.googleapis.com/chromium-browser-official/chromium-$pkgver.tar.xz chromium-launcher-$_launcher_ver.tar.gz::https://github.com/foutrelis/chromium-launcher/archive/v$_launcher_ver.tar.gz chromium.desktop + chromium-system-ffmpeg-r4.patch + chromium-gn-bootstrap-r2.patch chromium-widevine.patch - chromium-52.0.2743.116-unset-madv_free.patch - chromium_vaapi.patch - chromium_vaapi-intel.patch - chromium_vaapi-other.patch) -sha256sums=('c52a58b79bfb27bb87e4a0a6ff213001485fbc747657b290f75d39ddce07dcc3' + vaapi_patch_r0.patch) +sha256sums=('f24cef3dd2acf9dd5ccdeeca47fea42d1c1ddff32b7375dc9e0cd35a4e8d78ff' '8b01fb4efe58146279858a754d90b49e5a38c9a0b36a1f84cbb7d12f92b84c28' '028a748a5c275de9b8f776f97909f999a8583a4b77fd1cd600b4fc5c0c3e91e9' + 'e3c474dbf3822a0be50695683bd8a2c9dfc82d41c1524a20b4581883c0c88986' + '64d743c78183c302c42d1f289863e34c74832fca57443833e46a0a3157e2b5de' 'd6fdcb922e5a7fbe15759d39ccc8ea4225821c44d98054ce0f23f9d1f00c9808' - '3b3aa9e28f29e6f539ed1c7832e79463b13128863a02e9c6fecd16c30d61c227' - '4700a2d75c5cec59ff4d78c284d20df591c07321565bb25e4bbbd5c671a5d22e' - 'c479910bc405666f8c8c7760e983abc20ab65764ca1d889040bcba34e8b5b4b9' - 'b0965313c6bd653ffda8dae6a6d9f2863488159b49a24a29b1303068321243c6') + 'fef17ee6b80b9c60e4579ec4afec72fedb6ab1807ecc5903ab6aa2ccbb9fc8b0') + # Google API keys (see http://www.chromium.org/developers/how-tos/api-keys) # Note: These are for Arch Linux use ONLY. For your own distribution, please # get your own set of keys. Feel free to contact foutrelis@archlinux.org for @@ -57,178 +69,122 @@ _google_api_key=AIzaSyDwr302FpOSkGRpLlUpPThNTDPbXcIn_FM _google_default_client_id=413772536636.apps.googleusercontent.com _google_default_client_secret=0ZChLK6AxeA3Isu96MkwqDR4 -# We can't build (P)NaCL on i686 because the toolchain is x86_64 only and the -# instructions on how to build the toolchain from source don't work that well -# (at least not from within the Chromium 39 source tree). -# https://sites.google.com/a/chromium.org/dev/nativeclient/pnacl/building-pnacl-components-for-distribution-packagers -_build_nacl=1 -if [[ $CARCH == i686 ]]; then - _build_nacl=0 -fi - prepare() { cd "$srcdir/chromium-$pkgver" - # https://groups.google.com/a/chromium.org/d/topic/chromium-packagers/9JX1N2nf4PU/discussion - touch chrome/test/data/webui/i18n_process_css_test.html - # Enable support for the Widevine CDM plugin # libwidevinecdm.so is not included, but can be copied over from Chrome # (Version string doesn't seem to matter so let's go with "Pinkie Pie") sed "s/@WIDEVINE_VERSION@/Pinkie Pie/" ../chromium-widevine.patch | patch -Np1 - # Patch to enable VA-API - printf "Applying chromium_vaapi.patch\n" - patch -p1 -i "$srcdir"/chromium_vaapi.patch - - if [ $pkgname == "chromium-vaapi" ]; then - printf "Applying chromium_vaapi-intel.patch\n" - patch -p1 -i "$srcdir"/chromium_vaapi-intel.patch - else - printf "Applying chromium_vaapi-other.patch\n" - patch -p1 -i "$srcdir"/chromium_vaapi-other.patch - fi - # Commentception – use bundled ICU due to build failures (50.0.2661.75) - # See https://crbug.com/584920 and https://crbug.com/592268 - # --- - ## Remove bundled ICU; its header files appear to get picked up instead of - ## the system ones, leading to errors during the final link stage. - ## https://groups.google.com/a/chromium.org/d/topic/chromium-packagers/BNGvJc08B6Q - #find third_party/icu -type f \! -regex '.*\.\(gyp\|gypi\|isolate\)' -delete - - # Disable MADV_FREE (if set by glibc) - # https://bugzilla.redhat.com/show_bug.cgi?id=1361157 - patch -p1 -i "$srcdir"/chromium-52.0.2743.116-unset-madv_free.patch - + # Fixes from Gentoo + #patch -Np1 -i ../chromium-system-ffmpeg-r4.patch + patch -Np1 -i ../chromium-gn-bootstrap-r2.patch # Use Python 2 find . -name '*.py' -exec sed -i -r 's|/usr/bin/python$|&2|g' {} + + # There are still a lot of relative calls which need a workaround mkdir -p "$srcdir/python2-path" ln -sf /usr/bin/python2 "$srcdir/python2-path/python" - # Download the PNaCL toolchain on x86_64; i686 toolchain is no longer provided - if (( $_build_nacl )); then - python2 build/download_nacl_toolchains.py \ - --packages nacl_x86_newlib,pnacl_newlib,pnacl_translator \ - sync --extract - fi + mkdir -p third_party/node/linux/node-linux-x64/bin + ln -s /usr/bin/node third_party/node/linux/node-linux-x64/bin/ + + # VA-API patch + patch -p1 -i "${srcdir}/vaapi_patch_r0.patch" + # Fix paths. + sed -e 's|i386-linux-gnu/||g' \ + -e 's|x86_64-linux-gnu/||g' \ + -e 's|/usr/lib/va/drivers|/usr/lib/dri|g' \ + -e 's|/usr/lib64/va/drivers|/usr/lib/dri|g' \ + -i content/common/sandbox_linux/bpf_gpu_policy_linux.cc + + # Remove bundled libraries for which we will use the system copies; this + # *should* do what the remove_bundled_libraries.py script does, with the + # added benefit of not having to list all the remaining libraries + local _lib + for _lib in ${!_system_libs[@]} ${_system_libs[libjpeg]+libjpeg_turbo}; do + find -type f -path "*third_party/$_lib/*" \ + \! -path "*third_party/$_lib/chromium/*" \ + \! -path "*third_party/$_lib/google/*" \ + \! -path "*base/third_party/icu/*" \ + \! -regex '.*\.\(gn\|gni\|isolate\|py\)' \ + -delete + done + + python2 build/linux/unbundle/replace_gn_files.py \ + --system-libraries "${!_system_libs[@]}" + + python2 third_party/libaddressinput/chromium/tools/update-strings.py } build() { - cd "$srcdir/chromium-launcher-$_launcher_ver" - - make PREFIX=/usr + make -C "$srcdir/chromium-launcher-$_launcher_ver" PREFIX=/usr cd "$srcdir/chromium-$pkgver" export PATH="$srcdir/python2-path:$PATH" - - # CFLAGS are passed through release_extra_cflags below - export -n CFLAGS CXXFLAGS - - # Work around bug in v8 in which GCC 6 optimizes away null pointer checks - # https://bugs.chromium.org/p/v8/issues/detail?id=3782 - # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69234 - CFLAGS+=' -fno-delete-null-pointer-checks' - - local _chromium_conf=( - -Dgoogle_api_key=$_google_api_key - -Dgoogle_default_client_id=$_google_default_client_id - -Dgoogle_default_client_secret=$_google_default_client_secret - -Dwerror= - -Dclang=0 - -Dpython_ver=2.7 - -Dlinux_link_gsettings=1 - -Dlinux_link_libpci=1 - -Dlinux_link_libspeechd=1 - -Dlinux_link_pulseaudio=1 - -Dlinux_strip_binary=1 - -Dlinux_use_bundled_binutils=0 - -Dlinux_use_bundled_gold=0 - -Dlinux_use_gold_flags=0 - -Dicu_use_data_file_flag=1 - -Dlogging_like_official_build=1 - -Dtracing_like_official_build=1 - -Dfieldtrial_testing_like_official_build=1 - -Drelease_extra_cflags="$CFLAGS" - -Dlibspeechd_h_prefix=speech-dispatcher/ - -Dffmpeg_branding=Chrome - -Dproprietary_codecs=1 - -Duse_gnome_keyring=0 - -Duse_system_bzip2=1 - -Duse_system_flac=1 - -Duse_system_ffmpeg=0 - -Duse_system_harfbuzz=1 - -Duse_system_icu=0 - -Duse_system_libevent=1 - -Duse_system_libjpeg=1 - -Duse_system_libpng=1 - -Duse_system_libvpx=1 - -Duse_system_libxml=0 - -Duse_system_snappy=1 - -Duse_system_xdg_utils=1 - -Duse_system_yasm=1 - -Duse_system_zlib=0 - -Dusb_ids_path=/usr/share/hwdata/usb.ids - -Duse_mojo=0 - -Duse_gconf=0 - -Duse_sysroot=0 - -Denable_hangout_services_extension=1 - -Denable_widevine=1 - -Ddisable_fatal_linker_warnings=1 - -Ddisable_glibc=1) - - if (( ! $_build_nacl )); then - _chromium_conf+=( - -Ddisable_nacl=1 - -Ddisable_pnacl=1 - ) - fi - - build/linux/unbundle/replace_gyp_files.py "${_chromium_conf[@]}" - build/gyp_chromium --depth=. "${_chromium_conf[@]}" - - ninja -C out/Release chrome chrome_sandbox chromedriver + export TMPDIR="$srcdir/temp" + mkdir -p "$TMPDIR" + + local _flags=( + 'is_clang=false' + 'clang_use_chrome_plugins=false' + 'is_debug=false' + 'fatal_linker_warnings=false' + 'treat_warnings_as_errors=false' + 'fieldtrial_testing_like_official_build=true' + 'remove_webcore_debug_symbols=true' + 'ffmpeg_branding="Chrome"' + 'proprietary_codecs=true' + 'link_pulseaudio=true' + 'linux_use_bundled_binutils=false' + 'use_gconf=false' + 'use_gnome_keyring=false' + 'use_gold=false' + 'use_sysroot=false' + 'enable_hangout_services_extension=true' + 'enable_widevine=true' + 'enable_nacl=false' + "google_api_key=\"${_google_api_key}\"" + "google_default_client_id=\"${_google_default_client_id}\"" + "google_default_client_secret=\"${_google_default_client_secret}\"" + ) + + python2 tools/gn/bootstrap/bootstrap.py --gn-gen-args "${_flags[*]}" + out/Release/gn gen out/Release --args="${_flags[*]}" \ + --script-executable=/usr/bin/python2 + + ninja -C out/Release chrome chrome_sandbox chromedriver widevinecdmadapter } package() { cd "$srcdir/chromium-launcher-$_launcher_ver" - make PREFIX=/usr DESTDIR="$pkgdir" install-strip + make PREFIX=/usr DESTDIR="$pkgdir" install install -Dm644 LICENSE \ "$pkgdir/usr/share/licenses/chromium/LICENSE.launcher" - cd "$srcdir/chromium-$pkgver" + cd "$srcdir/$chromium-$pkgver" install -D out/Release/chrome "$pkgdir/usr/lib/chromium/chromium" + install -Dm644 out/Release/chrome.1 "$pkgdir/usr/share/man/man1/chromium.1" + install -Dm644 "$srcdir/chromium.desktop" \ + "$pkgdir/usr/share/applications/chromium.desktop" install -Dm4755 out/Release/chrome_sandbox \ "$pkgdir/usr/lib/chromium/chrome-sandbox" - install -D out/Release/chromedriver "$pkgdir/usr/lib/chromium/chromedriver" - - cp out/Release/{*.pak,*.bin,libwidevinecdmadapter.so} \ + cp -a \ + out/Release/{chrome_{100,200}_percent,resources}.pak \ + out/Release/{*.bin,chromedriver,libwidevinecdmadapter.so} \ + out/Release/locales \ + out/Release/icudtl.dat \ "$pkgdir/usr/lib/chromium/" - # Manually strip binaries so that 'nacl_irt_*.nexe' is left intact - strip $STRIP_BINARIES "$pkgdir/usr/lib/chromium/"{chromium,chrome-sandbox} \ - "$pkgdir/usr/lib/chromium/chromedriver" - strip $STRIP_SHARED "$pkgdir/usr/lib/chromium/libwidevinecdmadapter.so" - - if (( $_build_nacl )); then - cp out/Release/nacl_helper{,_bootstrap} out/Release/nacl_irt_*.nexe \ - "$pkgdir/usr/lib/chromium/" - strip $STRIP_BINARIES "$pkgdir/usr/lib/chromium/"nacl_helper{,_bootstrap} - fi - - cp -a out/Release/locales "$pkgdir/usr/lib/chromium/" - - install -Dm644 out/Release/chrome.1 "$pkgdir/usr/share/man/man1/chromium.1" - - install -Dm644 "$srcdir/chromium.desktop" \ - "$pkgdir/usr/share/applications/chromium.desktop" + ln -s /usr/lib/chromium/chromedriver "$pkgdir/usr/bin/chromedriver" for size in 22 24 48 64 128 256; do install -Dm644 "chrome/app/theme/chromium/product_logo_$size.png" \ @@ -240,11 +196,7 @@ package() { "$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/chromium.png" done - ln -s /usr/lib/chromium/chromedriver "$pkgdir/usr/bin/chromedriver" - install -Dm644 LICENSE "$pkgdir/usr/share/licenses/chromium/LICENSE" - - install -Dm644 out/Release/icudtl.dat "${pkgdir}/usr/lib/chromium/icudtl.dat" } # vim:set ts=2 sw=2 et: diff --git a/PNGImageDecoder.patch b/PNGImageDecoder.patch deleted file mode 100644 index 986e66223792..000000000000 --- a/PNGImageDecoder.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.cppg 2016-05-01 15:22:46.103607522 +0800 -+++ b/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.cpp 2016-05-01 15:25:14.459753876 +0800 -@@ -234,7 +234,7 @@ - #endif - png_uint_32 profileLength = 0; - if (png_get_iCCP(png, info, &profileName, &compressionType, &profile, &profileLength)) { -- setColorProfileAndTransform(profile, profileLength, imageHasAlpha, false /* useSRGB */); -+ setColorProfileAndTransform((const char*)profile, profileLength, imageHasAlpha, false /* useSRGB */); - } - } - #endif // PNG_iCCP_SUPPORTED diff --git a/chromium-52.0.2743.116-unset-madv_free.patch b/chromium-52.0.2743.116-unset-madv_free.patch deleted file mode 100644 index 2867c7967770..000000000000 --- a/chromium-52.0.2743.116-unset-madv_free.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff -up chromium-52.0.2743.116/third_party/WebKit/Source/wtf/allocator/PageAllocator.cpp.madv_free chromium-52.0.2743.116/third_party/WebKit/Source/wtf/allocator/PageAllocator.cpp ---- chromium-52.0.2743.116/third_party/WebKit/Source/wtf/allocator/PageAllocator.cpp.madv_free 2016-08-15 13:07:29.279655676 -0400 -+++ chromium-52.0.2743.116/third_party/WebKit/Source/wtf/allocator/PageAllocator.cpp 2016-08-15 13:08:38.447317416 -0400 -@@ -41,6 +41,11 @@ - #include <errno.h> - #include <sys/mman.h> - -+#if OS(LINUX) && defined(MADV_FREE) -+// Added in Linux 4.5, but it breaks the sandbox. -+#undef MADV_FREE -+#endif -+ - #ifndef MADV_FREE - #define MADV_FREE MADV_DONTNEED - #endif diff --git a/chromium-gn-bootstrap-r2.patch b/chromium-gn-bootstrap-r2.patch new file mode 100644 index 000000000000..76287e1a56ec --- /dev/null +++ b/chromium-gn-bootstrap-r2.patch @@ -0,0 +1,13 @@ +Index: tools/gn/bootstrap/bootstrap.py +diff --git a/tools/gn/bootstrap/bootstrap.py b/tools/gn/bootstrap/bootstrap.py +index 38cfb117d29c3895291379f00d8dc8c8b0727474..679170e610f8292bcbeb76508fd247d322a69c79 100755 +--- a/tools/gn/bootstrap/bootstrap.py ++++ b/tools/gn/bootstrap/bootstrap.py +@@ -385,6 +385,7 @@ def write_gn_ninja(path, root_gen_dir, options): + 'base/base_switches.cc', + 'base/build_time.cc', + 'base/callback_internal.cc', ++ 'base/callback_helpers.cc', + 'base/command_line.cc', + 'base/debug/activity_tracker.cc', + 'base/debug/alias.cc', diff --git a/chromium-launcher-3.tar.gz b/chromium-launcher-3.tar.gz Binary files differdeleted file mode 100644 index 4e78ef996592..000000000000 --- a/chromium-launcher-3.tar.gz +++ /dev/null diff --git a/chromium-system-ffmpeg-r4.patch b/chromium-system-ffmpeg-r4.patch new file mode 100644 index 000000000000..3abfc163e8a2 --- /dev/null +++ b/chromium-system-ffmpeg-r4.patch @@ -0,0 +1,48 @@ +--- a/media/ffmpeg/ffmpeg_common.h.orig 2016-09-09 13:16:07.757294768 +0000 ++++ b/media/ffmpeg/ffmpeg_common.h 2016-09-09 13:16:41.705989273 +0000 +@@ -22,10 +22,6 @@ + + // Include FFmpeg header files. + extern "C" { +-// Disable deprecated features which result in spammy compile warnings. This +-// list of defines must mirror those in the 'defines' section of FFmpeg's +-// BUILD.gn file or the headers below will generate different structures! +-#define FF_API_CONVERGENCE_DURATION 0 + // Upstream libavcodec/utils.c still uses the deprecated + // av_dup_packet(), causing deprecation warnings. + // The normal fix for such things is to disable the feature as below, +@@ -35,7 +35,6 @@ + MSVC_PUSH_DISABLE_WARNING(4244); + #include <libavcodec/avcodec.h> + #include <libavformat/avformat.h> +-#include <libavformat/internal.h> + #include <libavformat/avio.h> + #include <libavutil/avutil.h> + #include <libavutil/imgutils.h> +--- a/media/filters/ffmpeg_demuxer.cc.orig 2016-09-09 14:21:40.185828912 +0000 ++++ b/media/filters/ffmpeg_demuxer.cc 2016-09-09 14:21:52.894089352 +0000 +@@ -1185,24 +1185,6 @@ + // If no estimate is found, the stream entry will be kInfiniteDuration. + std::vector<base::TimeDelta> start_time_estimates(format_context->nb_streams, + kInfiniteDuration); +- const AVFormatInternal* internal = format_context->internal; +- if (internal && internal->packet_buffer && +- format_context->start_time != static_cast<int64_t>(AV_NOPTS_VALUE)) { +- struct AVPacketList* packet_buffer = internal->packet_buffer; +- while (packet_buffer != internal->packet_buffer_end) { +- DCHECK_LT(static_cast<size_t>(packet_buffer->pkt.stream_index), +- start_time_estimates.size()); +- const AVStream* stream = +- format_context->streams[packet_buffer->pkt.stream_index]; +- if (packet_buffer->pkt.pts != static_cast<int64_t>(AV_NOPTS_VALUE)) { +- const base::TimeDelta packet_pts = +- ConvertFromTimeBase(stream->time_base, packet_buffer->pkt.pts); +- if (packet_pts < start_time_estimates[stream->index]) +- start_time_estimates[stream->index] = packet_pts; +- } +- packet_buffer = packet_buffer->next; +- } +- } + + std::unique_ptr<MediaTracks> media_tracks(new MediaTracks()); + diff --git a/chromium_vaapi-intel.patch b/chromium_vaapi-intel.patch deleted file mode 100644 index c734c1adf43a..000000000000 --- a/chromium_vaapi-intel.patch +++ /dev/null @@ -1,155 +0,0 @@ -Patch for Intel GPU's, but doesn't seem to work on NVIDIA/ATI cards -Thanks to Saikrishna Arcot (saiarcot895) -Originally from https://raw.githubusercontent.com/saiarcot895/chromium-ubuntu-build/master/debian/patches/enable_vaapi_on_linux.diff - -The patch for bpf_gpu_policy_linux.cc initially came from -https://codereview.chromium.org/15955009/diff/92001/content/common/sandbox_linux/bpf_gpu_policy_linux.cc. - - -diff -aur chromium-53.0.2785.89.orig/content/common/sandbox_linux/bpf_gpu_policy_linux.cc chromium-53.0.2785.89/content/common/sandbox_linux/bpf_gpu_policy_linux.cc ---- chromium-53.0.2785.89.orig/content/common/sandbox_linux/bpf_gpu_policy_linux.cc 2016-08-31 15:03:31.000000000 -0700 -+++ chromium-53.0.2785.89/content/common/sandbox_linux/bpf_gpu_policy_linux.cc 2016-09-02 01:35:26.224998192 -0700 -@@ -23,6 +23,12 @@ - #include "base/macros.h" - #include "base/memory/ptr_util.h" - #include "build/build_config.h" -+ -+#if !defined(__arm__) -+// Auto-generated for dlopen libva libraries -+#include "content/common/va_stubs.h" -+#endif -+ - #include "content/common/sandbox_linux/sandbox_bpf_base_policy_linux.h" - #include "content/common/sandbox_linux/sandbox_seccomp_bpf_linux.h" - #include "content/common/set_process_title.h" -@@ -34,6 +40,14 @@ - #include "sandbox/linux/syscall_broker/broker_process.h" - #include "sandbox/linux/system_headers/linux_syscalls.h" - -+#if !defined(__arm__) -+#include "third_party/libva/va/va.h" -+#include "third_party/libva/va/va_x11.h" -+#if defined(USE_OZONE) -+#include "third_party/libva/va/wayland/va_wayland.h" -+#endif -+#endif -+ - using sandbox::arch_seccomp_data; - using sandbox::bpf_dsl::Allow; - using sandbox::bpf_dsl::ResultExpr; -@@ -42,6 +56,16 @@ - using sandbox::syscall_broker::BrokerProcess; - using sandbox::SyscallSets; - -+#if !defined(__arm__) -+using content_common::kModuleVa; -+using content_common::kModuleVa_x11; -+#if defined(USE_OZONE) -+using content_common::kModuleVa_drm; -+#endif -+using content_common::InitializeStubs; -+using content_common::StubPathMap; -+#endif -+ - namespace content { - - namespace { -@@ -96,7 +120,7 @@ - - bool IsAcceleratedVaapiVideoEncodeEnabled() { - bool accelerated_encode_enabled = false; --#if defined(OS_CHROMEOS) -+#if defined(OS_CHROMEOS) || defined(OS_LINUX) - const base::CommandLine& command_line = - *base::CommandLine::ForCurrentProcess(); - accelerated_encode_enabled = -@@ -297,32 +321,72 @@ - GpuBrokerProcessPolicy::Create, - std::vector<BrokerFilePermission>()); // No extra files in whitelist. - -+#if !defined(__arm__) - if (IsArchitectureX86_64() || IsArchitectureI386()) { - // Accelerated video dlopen()'s some shared objects - // inside the sandbox, so preload them now. - if (IsAcceleratedVaapiVideoEncodeEnabled() || - IsAcceleratedVideoDecodeEnabled()) { -- const char* I965DrvVideoPath = NULL; -- const char* I965HybridDrvVideoPath = NULL; -- -- if (IsArchitectureX86_64()) { -- I965DrvVideoPath = "/usr/lib64/va/drivers/i965_drv_video.so"; -- I965HybridDrvVideoPath = "/usr/lib64/va/drivers/hybrid_drv_video.so"; -- } else if (IsArchitectureI386()) { -- I965DrvVideoPath = "/usr/lib/va/drivers/i965_drv_video.so"; -+ VLOG(1) << "Attempting to enable hardware video acceleration."; -+ StubPathMap paths; -+ paths[kModuleVa].push_back("libva.so.1"); -+ paths[kModuleVa_x11].push_back("libva-x11.so.1"); -+#if defined(USE_OZONE) -+ paths[kModuleVa_drm].push_back("libva-drm.so.1"); -+#endif -+ if (!InitializeStubs(paths)) { -+ LOG(WARNING) << "Failed to initialize stubs"; -+ return true; - } - -- dlopen(I965DrvVideoPath, RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE); -- if (I965HybridDrvVideoPath) -- dlopen(I965HybridDrvVideoPath, RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE); -- dlopen("libva.so.1", RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE); -+ // libva drivers won't get loaded even above two libraries get dlopened. -+ // Thus, libva calls will fail after post sandbox stage. -+ // -+ // To get the va driver loaded before sandboxing, upstream simply dlopen -+ // the hard-coded va driver path because ChromeOS is the only platform -+ // that Google want to support libva. -+ // -+ // While generic linux distros ship va driver as anywhere they want. -+ // Fortunately, the va driver will be loadded when vaInitialize() get -+ // called. -+ // So the following code is to call vaInitialize() before sandboxing. -+ -+ VADisplay va_display = NULL; - #if defined(USE_OZONE) -- dlopen("libva-drm.so.1", RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE); --#elif defined(USE_X11) -- dlopen("libva-x11.so.1", RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE); -+ struct wl_display* wayland_display = wl_display_connect(NULL); -+ if (wayland_display) { -+ va_display = vaGetDisplayWl(wayland_display); -+ if (!vaDisplayIsValid(va_display)) { -+ LOG(WARNING) << "Failed to call vaGetDisplayWl()"; -+ va_display = NULL; -+ } -+ } else { -+ LOG(WARNING) << "Failed to find Wayland display"; -+ } -+#endif -+ -+ if (!va_display) { -+ Display* x_display = XOpenDisplay(NULL); -+ if (!x_display) { -+ LOG(WARNING) << "Failed to find X-Display"; -+ return true; -+ } -+ va_display = vaGetDisplay(x_display); -+ if (!vaDisplayIsValid(va_display)) { -+ LOG(WARNING) << "Failed to call vaGetDisplay()"; -+ return true; -+ } -+ } -+ -+ int major_version, minor_version; -+ if (vaInitialize(va_display, &major_version, &minor_version) -+ != VA_STATUS_SUCCESS) { -+ LOG(WARNING) << "Failed to call vaInitialize()"; -+ return true; -+ } -+ } // end of IsAcceleratedVaapiVideoEncodeEnabled() || IsAcceleratedVideoDecodeEnabled() -+ } // end of IsArchitectureX86_64() || IsArchitectureI386() - #endif -- } -- } - - return true; - } diff --git a/chromium_vaapi-other.patch b/chromium_vaapi-other.patch deleted file mode 100644 index 3b1ff23e7350..000000000000 --- a/chromium_vaapi-other.patch +++ /dev/null @@ -1,76 +0,0 @@ -Patch by me, Samantha McVey <samantham@posteo.net> -Attempt to load these VA-API drivers before sandbox. - -diff -aur chromium-53.0.2785.101/content/common/sandbox_linux/bpf_gpu_policy_linux.cc chromium-53.0.2785.101.new/content/common/sandbox_linux/bpf_gpu_policy_linux.cc ---- chromium-53.0.2785.101/content/common/sandbox_linux/bpf_gpu_policy_linux.cc 2016-09-07 18:02:39.000000000 -0700 -+++ chromium-53.0.2785.101.new/content/common/sandbox_linux/bpf_gpu_policy_linux.cc 2016-09-17 20:29:48.271901245 -0700 -@@ -96,7 +96,7 @@ - - bool IsAcceleratedVaapiVideoEncodeEnabled() { - bool accelerated_encode_enabled = false; --#if defined(OS_CHROMEOS) -+#if defined(OS_CHROMEOS) || defined(OS_LINUX) - const base::CommandLine& command_line = - *base::CommandLine::ForCurrentProcess(); - accelerated_encode_enabled = -@@ -302,19 +302,50 @@ - // inside the sandbox, so preload them now. - if (IsAcceleratedVaapiVideoEncodeEnabled() || - IsAcceleratedVideoDecodeEnabled()) { -- const char* I965DrvVideoPath = NULL; -- const char* I965HybridDrvVideoPath = NULL; -+ const char* I965_Drv_Video_Path = NULL; -+ const char* I965_Hybrid_Drv_Video_Path = NULL; -+ const char* NVIDIA_Drv_Video_Path = NULL; -+ const char* LIB_VA_Path = NULL; -+ const char* LIB_VA_X11_Path = NULL; -+ const char* R600_Drv_Video_Path = NULL; -+ const char* RADEONSI_Drv_Video_Path = NULL; -+ const char* VDPAU_Drv_Video_Path = NULL; -+ const char* NOUVEAU_Drv_Video_Path = NULL; -+ -+ if (IsArchitectureX86_64() || IsArchitectureI386() ) { -+ I965_Drv_Video_Path = "/usr/lib/dri/i965_drv_video.so"; -+ I965_Hybrid_Drv_Video_Path = "/usr/lib/dri/hybrid_drv_video.so"; -+ NVIDIA_Drv_Video_Path = "/usr/lib/dri/nvidia_drv_video.so"; -+ R600_Drv_Video_Path = "/usr/lib/dri/r600_drv_video.so"; -+ VDPAU_Drv_Video_Path = "/usr/lib/dri/vdpau_drv_video.so"; -+ RADEONSI_Drv_Video_Path = "/usr/lib/dri/radeonsi_drv_video.so"; -+ NOUVEAU_Drv_Video_Path = "/usr/lib/dri/nouveau_drv_video.so"; - -- if (IsArchitectureX86_64()) { -- I965DrvVideoPath = "/usr/lib64/va/drivers/i965_drv_video.so"; -- I965HybridDrvVideoPath = "/usr/lib64/va/drivers/hybrid_drv_video.so"; -- } else if (IsArchitectureI386()) { -- I965DrvVideoPath = "/usr/lib/va/drivers/i965_drv_video.so"; -+ LIB_VA_Path = "/usr/lib/libva.so.1"; -+ LIB_VA_X11_Path = "/usr/lib/libva-x11.so.1"; -+ } -+ if ( access(I965_Drv_Video_Path , X_OK|R_OK ) != -1 ) { -+ dlopen(I965_Drv_Video_Path, RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE); -+ } -+ if ( access(I965_Hybrid_Drv_Video_Path , X_OK|R_OK ) != -1 ) { -+ dlopen(I965_Hybrid_Drv_Video_Path, RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE); -+ } -+ if ( access(VDPAU_Drv_Video_Path , X_OK|R_OK ) != -1 ) { -+ dlopen(VDPAU_Drv_Video_Path, RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE); -+ } -+ if ( access(NVIDIA_Drv_Video_Path , X_OK|R_OK ) != -1 ) { -+ dlopen(NVIDIA_Drv_Video_Path, RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE); -+ } -+ if ( access(R600_Drv_Video_Path , X_OK|R_OK ) != -1 ) { -+ dlopen(R600_Drv_Video_Path, RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE); -+ } -+ if ( access(RADEONSI_Drv_Video_Path , X_OK|R_OK ) != -1 ) { -+ dlopen(RADEONSI_Drv_Video_Path, RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE); -+ } -+ if ( access(NOUVEAU_Drv_Video_Path , X_OK|R_OK ) != -1 ) { -+ dlopen(NOUVEAU_Drv_Video_Path, RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE); - } - -- dlopen(I965DrvVideoPath, RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE); -- if (I965HybridDrvVideoPath) -- dlopen(I965HybridDrvVideoPath, RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE); - dlopen("libva.so.1", RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE); - #if defined(USE_OZONE) - dlopen("libva-drm.so.1", RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE); diff --git a/chromium_vaapi.patch b/chromium_vaapi.patch deleted file mode 100644 index e13037851055..000000000000 --- a/chromium_vaapi.patch +++ /dev/null @@ -1,793 +0,0 @@ -Originally from https://raw.githubusercontent.com/saiarcot895/chromium-ubuntu-build/master/debian/patches/enable_vaapi_on_linux.diff -Thanks to Saikrishna Arcot (saiarcot895) - -Refactored for Chromium 53 by Samantha McVey (samcv) samantham@posteo.net - -diff -aur chromium-53.0.2785.89.orig/chrome/browser/about_flags.cc chromium-53.0.2785.89/chrome/browser/about_flags.cc ---- chromium-53.0.2785.89.orig/chrome/browser/about_flags.cc 2016-08-31 15:03:27.000000000 -0700 -+++ chromium-53.0.2785.89/chrome/browser/about_flags.cc 2016-09-02 01:35:26.221664850 -0700 -@@ -931,7 +931,7 @@ - "disable-accelerated-video-decode", - IDS_FLAGS_ACCELERATED_VIDEO_DECODE_NAME, - IDS_FLAGS_ACCELERATED_VIDEO_DECODE_DESCRIPTION, -- kOsMac | kOsWin | kOsCrOS, -+ kOsAll, - SINGLE_DISABLE_VALUE_TYPE(switches::kDisableAcceleratedVideoDecode), - }, - #if defined(USE_ASH) -diff -aur chromium-53.0.2785.89.orig/content/common/BUILD.gn chromium-53.0.2785.89/content/common/BUILD.gn ---- chromium-53.0.2785.89.orig/content/common/BUILD.gn 2016-08-31 15:03:31.000000000 -0700 -+++ chromium-53.0.2785.89/content/common/BUILD.gn 2016-09-02 01:35:26.224998192 -0700 -@@ -12,6 +12,49 @@ - import("//build/config/mac/mac_sdk.gni") - } - -+if ((is_desktop_linux || is_chromeos) && current_cpu != "arm") { -+ action("libva_generate_stubs") { -+ extra_header = "../../media/gpu/va_stub_header.fragment" -+ -+ script = "../../tools/generate_stubs/generate_stubs.py" -+ sources = [ -+ "../../media/gpu/va.sigs", -+ ] -+ inputs = [ -+ extra_header, -+ ] -+ sources += [ "../../media/gpu/va_x11.sigs" ] -+ if (use_ozone) { -+ sources += [ -+ "../../media/gpu/va_drm.sigs", -+ "va_wayland.sigs", -+ ] -+ } -+ stubs_filename_root = "va_stubs" -+ -+ outputs = [ -+ "$target_gen_dir/$stubs_filename_root.cc", -+ "$target_gen_dir/$stubs_filename_root.h", -+ ] -+ args = [ -+ "-i", -+ rebase_path("$target_gen_dir", root_build_dir), -+ "-o", -+ rebase_path("$target_gen_dir", root_build_dir), -+ "-t", -+ "posix_stubs", -+ "-e", -+ rebase_path(extra_header, root_build_dir), -+ "-s", -+ stubs_filename_root, -+ "-p", -+ "content/common", -+ ] -+ -+ args += rebase_path(sources, root_build_dir) -+ } -+} -+ - source_set("common") { - # Targets external to content should always link to the public API. - # In addition, targets outside of the content component (shell and tests) -@@ -183,6 +226,15 @@ - - if (use_seccomp_bpf) { - defines += [ "USE_SECCOMP_BPF" ] -+ if (current_cpu != "arm" && is_desktop_linux) { -+ sources += get_target_outputs(":libva_generate_stubs") -+ deps += [ ":libva_generate_stubs" ] -+ configs += [ "//third_party/libva:libva_config" ] -+ if (use_ozone) { -+ configs += [ "//build/config/linux:x11" ] -+ deps += [ "//third_party/wayland:wayland_client" ] -+ } -+ } - } else { - if (is_linux) { - sources -= [ -diff -aur chromium-53.0.2785.89.orig/content/content_common.gypi chromium-53.0.2785.89/content/content_common.gypi ---- chromium-53.0.2785.89.orig/content/content_common.gypi 2016-08-31 15:03:31.000000000 -0700 -+++ chromium-53.0.2785.89/content/content_common.gypi 2016-09-02 01:35:26.224998192 -0700 -@@ -642,6 +642,52 @@ - ], - }, { - 'defines': ['USE_SECCOMP_BPF'], -+ 'dependencies': [ -+ '../build/linux/system.gyp:x11', -+ ], -+ 'variables': { -+ 'sig_files': [ -+ '../media/gpu/va.sigs', -+ '../media/gpu/va_x11.sigs', -+ ], -+ 'generate_stubs_script': '../tools/generate_stubs/generate_stubs.py', -+ 'extra_header': '../media/gpu/va_stub_header.fragment', -+ 'outfile_type': 'posix_stubs', -+ 'stubs_filename_root': 'va_stubs', -+ 'project_path': 'content/common', -+ 'intermediate_dir': '<(INTERMEDIATE_DIR)', -+ 'output_root': '<(SHARED_INTERMEDIATE_DIR)/va', -+ }, -+ 'actions': [ -+ { -+ 'action_name': 'libva_generate_stubs', -+ 'inputs': [ -+ '<(generate_stubs_script)', -+ '<(extra_header)', -+ '<@(sig_files)', -+ ], -+ 'outputs': [ -+ '<(intermediate_dir)/<(stubs_filename_root).cc', -+ '<(output_root)/<(project_path)/<(stubs_filename_root).h', -+ ], -+ 'action': ['python', -+ '<(generate_stubs_script)', -+ '-i', '<(intermediate_dir)', -+ '-o', '<(output_root)/<(project_path)', -+ '-t', '<(outfile_type)', -+ '-e', '<(extra_header)', -+ '-s', '<(stubs_filename_root)', -+ '-p', '<(project_path)', -+ '<@(_inputs)', -+ ], -+ 'process_outputs_as_sources': 1, -+ 'message': 'Generating libva stubs for dynamic loading', -+ }, -+ ], -+ 'include_dirs': [ -+ '<(DEPTH)/third_party/libva', -+ '<(output_root)', -+ ], - }], - ['use_ozone==1', { - 'dependencies': [ -diff -aur chromium-53.0.2785.89.orig/content/content_gpu.gypi chromium-53.0.2785.89/content/content_gpu.gypi ---- chromium-53.0.2785.89.orig/content/content_gpu.gypi 2016-08-31 15:03:31.000000000 -0700 -+++ chromium-53.0.2785.89/content/content_gpu.gypi 2016-09-02 01:35:26.224998192 -0700 -@@ -49,7 +49,7 @@ - ], - }, - }], -- ['target_arch!="arm" and chromeos == 1', { -+ ['target_arch!="arm" and (chromeos == 1 or desktop_linux == 1)', { - 'include_dirs': [ - '<(DEPTH)/third_party/libva', - ], -diff -aur chromium-53.0.2785.89.orig/content/gpu/BUILD.gn chromium-53.0.2785.89/content/gpu/BUILD.gn ---- chromium-53.0.2785.89.orig/content/gpu/BUILD.gn 2016-08-31 15:03:31.000000000 -0700 -+++ chromium-53.0.2785.89/content/gpu/BUILD.gn 2016-09-02 01:35:26.224998192 -0700 -@@ -86,7 +86,7 @@ - ] - } - -- if (is_chromeos && current_cpu != "arm") { -+ if ((is_desktop_linux || is_chromeos) && current_cpu != "arm") { - configs += [ "//third_party/libva:libva_config" ] - } - -diff -aur chromium-53.0.2785.89.orig/content/gpu/gpu_main.cc chromium-53.0.2785.89/content/gpu/gpu_main.cc ---- chromium-53.0.2785.89.orig/content/gpu/gpu_main.cc 2016-08-31 15:03:31.000000000 -0700 -+++ chromium-53.0.2785.89/content/gpu/gpu_main.cc 2016-09-02 01:35:26.224998192 -0700 -@@ -75,7 +75,7 @@ - #include "content/common/sandbox_mac.h" - #endif - --#if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) -+#if (defined(OS_LINUX) || defined(OS_CHROMEOS)) && defined(ARCH_CPU_X86_FAMILY) - #include "media/gpu/vaapi_wrapper.h" - #endif - -@@ -253,7 +253,7 @@ - GetGpuInfoFromCommandLine(gpu_info, command_line); - gpu_info.in_process_gpu = false; - --#if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) -+#if (defined(OS_LINUX) || defined(OS_CHROMEOS)) && defined(ARCH_CPU_X86_FAMILY) - media::VaapiWrapper::PreSandboxInitialization(); - #endif - -diff -aur chromium-53.0.2785.89.orig/content/public/common/content_switches.cc chromium-53.0.2785.89/content/public/common/content_switches.cc ---- chromium-53.0.2785.89.orig/content/public/common/content_switches.cc 2016-08-31 15:03:31.000000000 -0700 -+++ chromium-53.0.2785.89/content/public/common/content_switches.cc 2016-09-02 01:35:26.224998192 -0700 -@@ -973,7 +973,9 @@ - #if defined(OS_CHROMEOS) - // Disables panel fitting (used for mirror mode). - const char kDisablePanelFitting[] = "disable-panel-fitting"; -+#endif - -+#if defined(OS_CHROMEOS) || defined(OS_LINUX) - // Disables VA-API accelerated video encode. - const char kDisableVaapiAcceleratedVideoEncode[] = - "disable-vaapi-accelerated-video-encode"; -diff -aur chromium-53.0.2785.89.orig/content/public/common/content_switches.h chromium-53.0.2785.89/content/public/common/content_switches.h ---- chromium-53.0.2785.89.orig/content/public/common/content_switches.h 2016-08-31 15:03:31.000000000 -0700 -+++ chromium-53.0.2785.89/content/public/common/content_switches.h 2016-09-02 01:35:26.224998192 -0700 -@@ -284,6 +284,8 @@ - - #if defined(OS_CHROMEOS) - CONTENT_EXPORT extern const char kDisablePanelFitting[]; -+#endif -+#if defined(OS_CHROMEOS) || defined(OS_LINUX) - CONTENT_EXPORT extern const char kDisableVaapiAcceleratedVideoEncode[]; - #endif - -diff -aur chromium-53.0.2785.89.orig/gpu/command_buffer/service/gpu_preferences.h chromium-53.0.2785.89/gpu/command_buffer/service/gpu_preferences.h ---- chromium-53.0.2785.89.orig/gpu/command_buffer/service/gpu_preferences.h 2016-08-31 15:03:32.000000000 -0700 -+++ chromium-53.0.2785.89/gpu/command_buffer/service/gpu_preferences.h 2016-09-02 01:35:26.221664850 -0700 -@@ -37,7 +37,7 @@ - // Disables hardware acceleration of video decode, where available. - bool disable_accelerated_video_decode = false; - --#if defined(OS_CHROMEOS) -+#if defined(OS_CHROMEOS) || defined(OS_LINUX) - // Disables VA-API accelerated video encode. - bool disable_vaapi_accelerated_video_encode = false; - #endif -diff -aur chromium-53.0.2785.89.orig/gpu/config/software_rendering_list_json.cc chromium-53.0.2785.89/gpu/config/software_rendering_list_json.cc ---- chromium-53.0.2785.89.orig/gpu/config/software_rendering_list_json.cc 2016-08-31 15:03:32.000000000 -0700 -+++ chromium-53.0.2785.89/gpu/config/software_rendering_list_json.cc 2016-09-02 01:35:26.224998192 -0700 -@@ -431,17 +431,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], -diff -aur chromium-53.0.2785.89.orig/media/BUILD.gn chromium-53.0.2785.89/media/BUILD.gn ---- chromium-53.0.2785.89.orig/media/BUILD.gn 2016-08-31 15:03:32.000000000 -0700 -+++ chromium-53.0.2785.89/media/BUILD.gn 2016-09-02 01:35:26.224998192 -0700 -@@ -353,7 +353,7 @@ - allow_circular_includes_from = [ "//media/base/android" ] - } - -- if (current_cpu != "arm" && is_chromeos) { -+ if (current_cpu != "arm" && (is_chromeos || is_desktop_linux)) { - sources += [ - "filters/h264_bitstream_buffer.cc", - "filters/h264_bitstream_buffer.h", -@@ -650,7 +650,7 @@ - } - } - -- if (current_cpu != "arm" && is_chromeos) { -+ if (current_cpu != "arm" && (is_chromeos || is_desktop_linux)) { - sources += [ "filters/h264_bitstream_buffer_unittest.cc" ] - } - -diff -aur chromium-53.0.2785.89.orig/media/gpu/BUILD.gn chromium-53.0.2785.89/media/gpu/BUILD.gn ---- chromium-53.0.2785.89.orig/media/gpu/BUILD.gn 2016-08-31 15:03:32.000000000 -0700 -+++ chromium-53.0.2785.89/media/gpu/BUILD.gn 2016-09-02 01:35:26.224998192 -0700 -@@ -12,7 +12,7 @@ - import("//build/config/mac/mac_sdk.gni") - } - --if (is_chromeos && current_cpu != "arm") { -+if ((is_chromeos || is_linux) && current_cpu != "arm") { - action("libva_generate_stubs") { - extra_header = "va_stub_header.fragment" - -@@ -54,7 +54,7 @@ - } - } - --if (is_chromeos && use_v4lplugin) { -+if ((is_chromeos || is_linux) && use_v4lplugin) { - action("libv4l2_generate_stubs") { - extra_header = "v4l2_stub_header.fragment" - -diff -aur chromium-53.0.2785.89.orig/media/gpu/gpu_video_decode_accelerator_factory_impl.cc chromium-53.0.2785.89/media/gpu/gpu_video_decode_accelerator_factory_impl.cc ---- chromium-53.0.2785.89.orig/media/gpu/gpu_video_decode_accelerator_factory_impl.cc 2016-08-31 15:03:32.000000000 -0700 -+++ chromium-53.0.2785.89/media/gpu/gpu_video_decode_accelerator_factory_impl.cc 2016-09-02 01:35:26.224998192 -0700 -@@ -14,7 +14,7 @@ - #include "media/gpu/dxva_video_decode_accelerator_win.h" - #elif defined(OS_MACOSX) - #include "media/gpu/vt_video_decode_accelerator_mac.h" --#elif defined(OS_CHROMEOS) -+#elif defined(OS_CHROMEOS) || defined(OS_LINUX) - #if defined(USE_V4L2_CODEC) - #include "media/gpu/v4l2_device.h" - #include "media/gpu/v4l2_slice_video_decode_accelerator.h" -@@ -79,7 +79,7 @@ - #if defined(OS_WIN) - capabilities.supported_profiles = - DXVAVideoDecodeAccelerator::GetSupportedProfiles(); --#elif defined(OS_CHROMEOS) -+#elif defined(OS_CHROMEOS) || defined(OS_LINUX) - VideoDecodeAccelerator::SupportedProfiles vda_profiles; - #if defined(USE_V4L2_CODEC) - vda_profiles = V4L2VideoDecodeAccelerator::GetSupportedProfiles(); -@@ -127,11 +127,11 @@ - #if defined(OS_WIN) - &GpuVideoDecodeAcceleratorFactoryImpl::CreateDXVAVDA, - #endif --#if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC) -+#if (defined(OS_CHROMEOS) || defined(OS_LINUX)) && defined(USE_V4L2_CODEC) - &GpuVideoDecodeAcceleratorFactoryImpl::CreateV4L2VDA, - &GpuVideoDecodeAcceleratorFactoryImpl::CreateV4L2SVDA, - #endif --#if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) -+#if (defined(OS_CHROMEOS) || defined(OS_LINUX)) && defined(ARCH_CPU_X86_FAMILY) - &GpuVideoDecodeAcceleratorFactoryImpl::CreateVaapiVDA, - #endif - #if defined(OS_MACOSX) -@@ -169,7 +169,7 @@ - } - #endif - --#if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC) -+#if (defined(OS_CHROMEOS) || defined(OS_LINUX)) && defined(USE_V4L2_CODEC) - std::unique_ptr<VideoDecodeAccelerator> - GpuVideoDecodeAcceleratorFactoryImpl::CreateV4L2VDA( - const gpu::GpuDriverBugWorkarounds& workarounds, -@@ -199,11 +199,12 @@ - } - #endif - --#if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) -+#if (defined(OS_CHROMEOS) || defined(OS_LINUX)) && defined(ARCH_CPU_X86_FAMILY) - std::unique_ptr<VideoDecodeAccelerator> - GpuVideoDecodeAcceleratorFactoryImpl::CreateVaapiVDA( - const gpu::GpuDriverBugWorkarounds& workarounds, - const gpu::GpuPreferences& gpu_preferences) const { -+ VLOG(1) << "Creating new VAAPI video decode accelerator."; - std::unique_ptr<VideoDecodeAccelerator> decoder; - decoder.reset(new VaapiVideoDecodeAccelerator(make_context_current_cb_, - bind_image_cb_)); -diff -aur chromium-53.0.2785.89.orig/media/gpu/gpu_video_decode_accelerator_factory_impl.h chromium-53.0.2785.89/media/gpu/gpu_video_decode_accelerator_factory_impl.h ---- chromium-53.0.2785.89.orig/media/gpu/gpu_video_decode_accelerator_factory_impl.h 2016-08-31 15:03:32.000000000 -0700 -+++ chromium-53.0.2785.89/media/gpu/gpu_video_decode_accelerator_factory_impl.h 2016-09-02 01:35:26.224998192 -0700 -@@ -93,7 +93,7 @@ - const gpu::GpuDriverBugWorkarounds& workarounds, - const gpu::GpuPreferences& gpu_preferences) const; - #endif --#if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC) -+#if (defined(OS_CHROMEOS) || defined(OS_LINUX)) && defined(USE_V4L2_CODEC) - std::unique_ptr<VideoDecodeAccelerator> CreateV4L2VDA( - const gpu::GpuDriverBugWorkarounds& workarounds, - const gpu::GpuPreferences& gpu_preferences) const; -@@ -101,8 +101,8 @@ - const gpu::GpuDriverBugWorkarounds& workarounds, - const gpu::GpuPreferences& gpu_preferences) const; - #endif --#if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) -- std::unique_ptr<VideoDecodeAccelerator> CreateVaapiVDA( -+#if (defined(OS_CHROMEOS) || defined(OS_LINUX)) && defined(ARCH_CPU_X86_FAMILY) -+ std::unique_ptr<VideoDecodeAccelerator> CreateVaapiVDA( - const gpu::GpuDriverBugWorkarounds& workarounds, - const gpu::GpuPreferences& gpu_preferences) const; - #endif -diff -aur chromium-53.0.2785.89.orig/media/gpu/ipc/service/BUILD.gn chromium-53.0.2785.89/media/gpu/ipc/service/BUILD.gn ---- chromium-53.0.2785.89.orig/media/gpu/ipc/service/BUILD.gn 2016-08-31 15:03:32.000000000 -0700 -+++ chromium-53.0.2785.89/media/gpu/ipc/service/BUILD.gn 2016-09-02 01:35:26.224998192 -0700 -@@ -38,7 +38,7 @@ - "//third_party/mesa:mesa_headers", - ] - -- if (is_chromeos && current_cpu != "arm") { -+ if ((is_desktop_linux || is_chromeos) && current_cpu != "arm") { - configs += [ "//third_party/libva:libva_config" ] - } - -diff -aur chromium-53.0.2785.89.orig/media/gpu/ipc/service/gpu_jpeg_decode_accelerator.cc chromium-53.0.2785.89/media/gpu/ipc/service/gpu_jpeg_decode_accelerator.cc ---- chromium-53.0.2785.89.orig/media/gpu/ipc/service/gpu_jpeg_decode_accelerator.cc 2016-08-31 15:03:32.000000000 -0700 -+++ chromium-53.0.2785.89/media/gpu/ipc/service/gpu_jpeg_decode_accelerator.cc 2016-09-02 01:35:26.228331534 -0700 -@@ -25,7 +25,7 @@ - #include "media/gpu/ipc/common/media_messages.h" - #include "ui/gfx/geometry/size.h" - --#if defined(OS_CHROMEOS) -+#if defined(OS_CHROMEOS) || defined(OS_LINUX) - #if defined(ARCH_CPU_X86_FAMILY) - #include "media/gpu/vaapi_jpeg_decode_accelerator.h" - #endif -@@ -381,7 +381,7 @@ - std::unique_ptr<JpegDecodeAccelerator> GpuJpegDecodeAccelerator::CreateV4L2JDA( - const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner) { - std::unique_ptr<JpegDecodeAccelerator> decoder; --#if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC) -+#if (defined(OS_CHROMEOS) || defined(OS_LINUX)) && defined(USE_V4L2_CODEC) - scoped_refptr<V4L2Device> device = - V4L2Device::Create(V4L2Device::kJpegDecoder); - if (device) -@@ -394,7 +394,7 @@ - std::unique_ptr<JpegDecodeAccelerator> GpuJpegDecodeAccelerator::CreateVaapiJDA( - const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner) { - std::unique_ptr<JpegDecodeAccelerator> decoder; --#if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) -+#if (defined(OS_CHROMEOS) || defined(OS_LINUX)) && defined(ARCH_CPU_X86_FAMILY) - decoder.reset(new VaapiJpegDecodeAccelerator(io_task_runner)); - #endif - return decoder; -diff -aur chromium-53.0.2785.89.orig/media/gpu/ipc/service/gpu_video_decode_accelerator.cc chromium-53.0.2785.89/media/gpu/ipc/service/gpu_video_decode_accelerator.cc ---- chromium-53.0.2785.89.orig/media/gpu/ipc/service/gpu_video_decode_accelerator.cc 2016-08-31 15:03:32.000000000 -0700 -+++ chromium-53.0.2785.89/media/gpu/ipc/service/gpu_video_decode_accelerator.cc 2016-09-02 01:35:26.221664850 -0700 -@@ -58,7 +58,7 @@ - return true; - } - --#if (defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY)) || defined(OS_MACOSX) -+#if ((defined(OS_CHROMEOS) || defined(OS_LINUX)) && defined(ARCH_CPU_X86_FAMILY)) || defined(OS_MACOSX) - static bool BindImage(const base::WeakPtr<gpu::GpuCommandBufferStub>& stub, - uint32_t client_texture_id, - uint32_t texture_target, -@@ -171,7 +171,7 @@ - get_gl_context_cb_ = base::Bind(&GetGLContext, stub_->AsWeakPtr()); - make_context_current_cb_ = - base::Bind(&MakeDecoderContextCurrent, stub_->AsWeakPtr()); --#if (defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY)) || defined(OS_MACOSX) -+#if ((defined(OS_CHROMEOS) || defined(OS_LINUX)) && defined(ARCH_CPU_X86_FAMILY)) || defined(OS_MACOSX) - bind_image_cb_ = base::Bind(&BindImage, stub_->AsWeakPtr()); - #endif - get_gles2_decoder_cb_ = base::Bind(&GetGLES2Decoder, stub_->AsWeakPtr()); -diff -aur chromium-53.0.2785.89.orig/media/gpu/ipc/service/gpu_video_encode_accelerator.cc chromium-53.0.2785.89/media/gpu/ipc/service/gpu_video_encode_accelerator.cc ---- chromium-53.0.2785.89.orig/media/gpu/ipc/service/gpu_video_encode_accelerator.cc 2016-08-31 15:03:32.000000000 -0700 -+++ chromium-53.0.2785.89/media/gpu/ipc/service/gpu_video_encode_accelerator.cc 2016-09-02 01:35:26.221664850 -0700 -@@ -24,7 +24,7 @@ - #include "media/gpu/gpu_video_accelerator_util.h" - #include "media/gpu/ipc/common/media_messages.h" - --#if defined(OS_CHROMEOS) -+#if defined(OS_CHROMEOS) || defined(OS_LINUX) - #if defined(USE_V4L2_CODEC) - #include "media/gpu/v4l2_video_encode_accelerator.h" - #endif -@@ -194,10 +194,10 @@ - GpuVideoEncodeAccelerator::CreateVEAFps( - const gpu::GpuPreferences& gpu_preferences) { - std::vector<GpuVideoEncodeAccelerator::CreateVEAFp> create_vea_fps; --#if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC) -+#if (defined(OS_CHROMEOS) || defined(OS_LINUX)) && defined(USE_V4L2_CODEC) - create_vea_fps.push_back(&GpuVideoEncodeAccelerator::CreateV4L2VEA); - #endif --#if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) -+#if (defined(OS_CHROMEOS) || defined(OS_LINUX)) && defined(ARCH_CPU_X86_FAMILY) - if (!gpu_preferences.disable_vaapi_accelerated_video_encode) - create_vea_fps.push_back(&GpuVideoEncodeAccelerator::CreateVaapiVEA); - #endif -@@ -211,7 +211,7 @@ - return create_vea_fps; - } - --#if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC) -+#if (defined(OS_CHROMEOS) || defined(OS_LINUX)) && defined(USE_V4L2_CODEC) - // static - std::unique_ptr<VideoEncodeAccelerator> - GpuVideoEncodeAccelerator::CreateV4L2VEA() { -@@ -223,7 +223,7 @@ - } - #endif - --#if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) -+#if (defined(OS_CHROMEOS) || defined(OS_LINUX)) && defined(ARCH_CPU_X86_FAMILY) - // static - std::unique_ptr<VideoEncodeAccelerator> - GpuVideoEncodeAccelerator::CreateVaapiVEA() { -diff -aur chromium-53.0.2785.89.orig/media/gpu/ipc/service/gpu_video_encode_accelerator.h chromium-53.0.2785.89/media/gpu/ipc/service/gpu_video_encode_accelerator.h ---- chromium-53.0.2785.89.orig/media/gpu/ipc/service/gpu_video_encode_accelerator.h 2016-08-31 15:03:32.000000000 -0700 -+++ chromium-53.0.2785.89/media/gpu/ipc/service/gpu_video_encode_accelerator.h 2016-09-02 01:35:26.228331534 -0700 -@@ -80,10 +80,10 @@ - // platform. - static std::vector<CreateVEAFp> CreateVEAFps( - const gpu::GpuPreferences& gpu_preferences); --#if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC) -+#if (defined(OS_CHROMEOS) || defined(OS_LINUX)) && defined(USE_V4L2_CODEC) - static std::unique_ptr<VideoEncodeAccelerator> CreateV4L2VEA(); - #endif --#if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) -+#if (defined(OS_CHROMEOS) || defined(OS_LINUX)) && defined(ARCH_CPU_X86_FAMILY) - static std::unique_ptr<VideoEncodeAccelerator> CreateVaapiVEA(); - #endif - #if defined(OS_ANDROID) && defined(ENABLE_WEBRTC) -diff -aur chromium-53.0.2785.89.orig/media/gpu/jpeg_decode_accelerator_unittest.cc chromium-53.0.2785.89/media/gpu/jpeg_decode_accelerator_unittest.cc ---- chromium-53.0.2785.89.orig/media/gpu/jpeg_decode_accelerator_unittest.cc 2016-08-31 15:03:32.000000000 -0700 -+++ chromium-53.0.2785.89/media/gpu/jpeg_decode_accelerator_unittest.cc 2016-09-02 01:35:26.221664850 -0700 -@@ -31,7 +31,7 @@ - #include "third_party/libyuv/include/libyuv.h" - #include "ui/gfx/codec/jpeg_codec.h" - --#if defined(OS_CHROMEOS) -+#if defined(OS_CHROMEOS) || defined(OS_LINUX) - #if defined(USE_V4L2_CODEC) - #include "media/gpu/v4l2_device.h" - #include "media/gpu/v4l2_jpeg_decode_accelerator.h" -@@ -133,10 +133,10 @@ - JpegClient::~JpegClient() {} - - void JpegClient::CreateJpegDecoder() { --#if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) -+#if (defined(OS_CHROMEOS) || defined(OS_LINUX)) && defined(ARCH_CPU_X86_FAMILY) - decoder_.reset( - new VaapiJpegDecodeAccelerator(base::ThreadTaskRunnerHandle::Get())); --#elif defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC) -+#elif (defined(OS_CHROMEOS) || defined(OS_LINUX)) && defined(USE_V4L2_CODEC) - scoped_refptr<V4L2Device> device = - V4L2Device::Create(V4L2Device::kJpegDecoder); - if (!device.get()) { -@@ -564,7 +564,7 @@ - continue; - LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; - } --#if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) -+#if (defined(OS_CHROMEOS) || defined(OS_LINUX)) && defined(ARCH_CPU_X86_FAMILY) - media::VaapiWrapper::PreSandboxInitialization(); - #endif - -diff -aur chromium-53.0.2785.89.orig/media/gpu/vaapi_video_decode_accelerator.cc chromium-53.0.2785.89/media/gpu/vaapi_video_decode_accelerator.cc ---- chromium-53.0.2785.89.orig/media/gpu/vaapi_video_decode_accelerator.cc 2016-08-31 15:03:32.000000000 -0700 -+++ chromium-53.0.2785.89/media/gpu/vaapi_video_decode_accelerator.cc 2016-09-02 01:35:26.224998192 -0700 -@@ -354,17 +354,17 @@ - - base::AutoLock auto_lock(lock_); - DCHECK_EQ(state_, kUninitialized); -- DVLOG(2) << "Initializing VAVDA, profile: " << profile; -+ VLOG(1) << "Initializing VAVDA, profile: " << profile; - - #if defined(USE_X11) - if (gl::GetGLImplementation() != gl::kGLImplementationDesktopGL) { -- DVLOG(1) << "HW video decode acceleration not available without " -+ VLOG(1) << "HW video decode acceleration not available without " - "DesktopGL (GLX)."; - return false; - } - #elif defined(USE_OZONE) - if (gl::GetGLImplementation() != gl::kGLImplementationEGLGLES2) { -- DVLOG(1) << "HW video decode acceleration not available without " -+ VLOG(1) << "HW video decode acceleration not available without " - << "EGLGLES2."; - return false; - } -@@ -374,7 +374,7 @@ - VaapiWrapper::kDecode, profile, base::Bind(&ReportToUMA, VAAPI_ERROR)); - - if (!vaapi_wrapper_.get()) { -- DVLOG(1) << "Failed initializing VAAPI for profile " << profile; -+ VLOG(1) << "Failed initializing VAAPI for profile " << profile; - return false; - } - -@@ -389,7 +389,7 @@ - vp9_accelerator_.reset(new VaapiVP9Accelerator(this, vaapi_wrapper_.get())); - decoder_.reset(new VP9Decoder(vp9_accelerator_.get())); - } else { -- DLOG(ERROR) << "Unsupported profile " << profile; -+ VLOG(1) << "Unsupported profile " << profile; - return false; - } - -diff -aur chromium-53.0.2785.89.orig/media/gpu/vaapi_wrapper.cc chromium-53.0.2785.89/media/gpu/vaapi_wrapper.cc ---- chromium-53.0.2785.89.orig/media/gpu/vaapi_wrapper.cc 2016-08-31 15:03:32.000000000 -0700 -+++ chromium-53.0.2785.89/media/gpu/vaapi_wrapper.cc 2016-09-02 01:35:26.224998192 -0700 -@@ -194,7 +194,7 @@ - VAProfile va_profile, - const base::Closure& report_error_to_uma_cb) { - if (!profile_infos_.Get().IsProfileSupported(mode, va_profile)) { -- DVLOG(1) << "Unsupported va_profile: " << va_profile; -+ VLOG(1) << "Unsupported va_profile: " << va_profile; - return nullptr; - } - -@@ -347,15 +347,17 @@ - bool VaapiWrapper::VaInitialize(const base::Closure& report_error_to_uma_cb) { - static bool vaapi_functions_initialized = PostSandboxInitialization(); - if (!vaapi_functions_initialized) { -- bool running_on_chromeos = false; --#if defined(OS_CHROMEOS) -+ bool error_level_logging = false; -+#if defined(OS_LINUX) -+ error_level_logging = true; -+#elif defined(OS_CHROMEOS) - // When chrome runs on linux with chromeos=1, do not log error message - // without VAAPI libraries. -- running_on_chromeos = base::SysInfo::IsRunningOnChromeOS(); -+ error_level_logging = base::SysInfo::IsRunningOnChromeOS(); - #endif - static const char kErrorMsg[] = "Failed to initialize VAAPI libs"; -- if (running_on_chromeos) -- LOG(ERROR) << kErrorMsg; -+ if (error_level_logging) -+ VLOG(1) << kErrorMsg; - else - DVLOG(1) << kErrorMsg; - return false; -@@ -421,7 +423,7 @@ - - if (std::find(supported_entrypoints.begin(), supported_entrypoints.end(), - entrypoint) == supported_entrypoints.end()) { -- DVLOG(1) << "Unsupported entrypoint"; -+ VLOG(1) << "Unsupported entrypoint"; - return false; - } - return true; -@@ -445,8 +447,8 @@ - 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 -- << " for attribute type " << required_attribs[i].type; -+ VLOG(1) << "Unsupported value " << required_attribs[i].value -+ << " for attribute type " << required_attribs[i].type; - return false; - } - } -diff -aur chromium-53.0.2785.89.orig/media/gpu/va_stub_header.fragment chromium-53.0.2785.89/media/gpu/va_stub_header.fragment ---- chromium-53.0.2785.89.orig/media/gpu/va_stub_header.fragment 2016-08-31 15:03:32.000000000 -0700 -+++ chromium-53.0.2785.89/media/gpu/va_stub_header.fragment 2016-09-02 01:35:26.224998192 -0700 -@@ -5,8 +5,9 @@ - - #include "third_party/libva/va/drm/va_drm.h" - #include "third_party/libva/va/va.h" --#if defined(USE_X11) - #include "third_party/libva/va/va_x11.h" -+#if defined(USE_OZONE) -+#include "third_party/libva/va/wayland/va_wayland.h" - #endif - - } -diff -aur chromium-53.0.2785.89.orig/media/gpu/video_decode_accelerator_unittest.cc chromium-53.0.2785.89/media/gpu/video_decode_accelerator_unittest.cc ---- chromium-53.0.2785.89.orig/media/gpu/video_decode_accelerator_unittest.cc 2016-08-31 15:03:32.000000000 -0700 -+++ chromium-53.0.2785.89/media/gpu/video_decode_accelerator_unittest.cc 2016-09-02 01:35:26.221664850 -0700 -@@ -65,7 +65,7 @@ - #if defined(OS_WIN) - #include "base/win/windows_version.h" - #include "media/gpu/dxva_video_decode_accelerator_win.h" --#elif defined(OS_CHROMEOS) -+#elif defined(OS_CHROMEOS) || defined(OS_LINUX) - #if defined(USE_V4L2_CODEC) - #include "media/gpu/v4l2_device.h" - #include "media/gpu/v4l2_slice_video_decode_accelerator.h" -@@ -1778,7 +1778,7 @@ - ui::OzonePlatform::InitializeForUI(); - #endif - --#if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) -+#if (defined(OS_CHROMEOS) || defined(OS_LINUX)) && defined(ARCH_CPU_X86_FAMILY) - media::VaapiWrapper::PreSandboxInitialization(); - #endif - -diff -aur chromium-53.0.2785.89.orig/media/gpu/video_encode_accelerator_unittest.cc chromium-53.0.2785.89/media/gpu/video_encode_accelerator_unittest.cc ---- chromium-53.0.2785.89.orig/media/gpu/video_encode_accelerator_unittest.cc 2016-08-31 15:03:32.000000000 -0700 -+++ chromium-53.0.2785.89/media/gpu/video_encode_accelerator_unittest.cc 2016-09-02 01:35:26.228331534 -0700 -@@ -49,7 +49,7 @@ - #include "media/video/video_encode_accelerator.h" - #include "testing/gtest/include/gtest/gtest.h" - --#if defined(OS_CHROMEOS) -+#if defined(OS_CHROMEOS) || defined(OS_LINUX) - #if defined(ARCH_CPU_ARMEL) || (defined(USE_OZONE) && defined(USE_V4L2_CODEC)) - #include "media/gpu/v4l2_video_encode_accelerator.h" - #endif -@@ -1063,8 +1063,8 @@ - - std::unique_ptr<VideoEncodeAccelerator> VEAClient::CreateV4L2VEA() { - std::unique_ptr<VideoEncodeAccelerator> encoder; --#if defined(OS_CHROMEOS) && (defined(ARCH_CPU_ARMEL) || \ -- (defined(USE_OZONE) && defined(USE_V4L2_CODEC))) -+#if (defined(OS_CHROMEOS) || defined(OS_LINUX)) && (defined(ARCH_CPU_ARMEL) || \ -+ (defined(USE_OZONE) && defined(USE_V4L2_CODEC))) - scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kEncoder); - if (device) - encoder.reset(new V4L2VideoEncodeAccelerator(device)); -@@ -1074,7 +1074,7 @@ - - std::unique_ptr<VideoEncodeAccelerator> VEAClient::CreateVaapiVEA() { - std::unique_ptr<VideoEncodeAccelerator> encoder; --#if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) -+#if (defined(OS_CHROMEOS) || defined(OS_LINUX)) && defined(ARCH_CPU_X86_FAMILY) - encoder.reset(new VaapiVideoEncodeAccelerator()); - #endif - return encoder; -@@ -1804,7 +1804,7 @@ - LOG(FATAL) << "--measure_latency requires --run_at_fps enabled to work."; - } - --#if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) -+#if (defined(OS_CHROMEOS) || defined(OS_LINUX)) && defined(ARCH_CPU_X86_FAMILY) - media::VaapiWrapper::PreSandboxInitialization(); - #endif - -diff -aur chromium-53.0.2785.89.orig/media/media_gpu.gypi chromium-53.0.2785.89/media/media_gpu.gypi ---- chromium-53.0.2785.89.orig/media/media_gpu.gypi 2016-08-31 15:03:32.000000000 -0700 -+++ chromium-53.0.2785.89/media/media_gpu.gypi 2016-09-02 01:35:26.221664850 -0700 -@@ -125,7 +125,7 @@ - 'gpu/android_video_encode_accelerator.h', - ], - }], -- ['use_v4lplugin==1 and chromeos==1', { -+ ['use_v4lplugin==1 and (chromeos==1 or desktop_linux==1)', { - 'direct_dependent_settings': { - 'defines': [ - 'USE_LIBV4L2' -@@ -174,7 +174,7 @@ - }, - ], - }], -- ['chromeos==1', { -+ ['chromeos==1 or desktop_linux==1', { - 'sources': [ - 'gpu/accelerated_video_decoder.h', - 'gpu/h264_decoder.cc', -@@ -191,7 +191,7 @@ - 'gpu/vp9_picture.h', - ], - }], -- ['chromeos==1 and use_v4l2_codec==1', { -+ ['(chromeos==1 or desktop_linux==1) and use_v4l2_codec==1', { - 'direct_dependent_settings': { - 'defines': [ - 'USE_V4L2_CODEC' -@@ -230,7 +230,7 @@ - 'gpu/tegra_v4l2_device.h', - ], - }], -- ['target_arch != "arm" and chromeos == 1', { -+ ['target_arch != "arm" and (chromeos == 1 or desktop_linux==1)', { - 'dependencies': [ - '../media/media.gyp:media', - '../third_party/libyuv/libyuv.gyp:libyuv', -diff -aur chromium-53.0.2785.89.orig/media/media.gyp chromium-53.0.2785.89/media/media.gyp ---- chromium-53.0.2785.89.orig/media/media.gyp 2016-08-31 15:03:32.000000000 -0700 -+++ chromium-53.0.2785.89/media/media.gyp 2016-09-02 01:35:26.221664850 -0700 -@@ -749,7 +749,7 @@ - ], - }], - # For VaapiVideoEncodeAccelerator. -- ['target_arch != "arm" and chromeos == 1', { -+ ['target_arch != "arm" and (chromeos == 1 or desktop_linux == 1)', { - 'sources': [ - 'filters/h264_bitstream_buffer.cc', - 'filters/h264_bitstream_buffer.h', -@@ -1310,7 +1310,7 @@ - }] - ], - }], -- ['target_arch != "arm" and chromeos == 1 and use_x11 == 1', { -+ ['target_arch != "arm" and (chromeos == 1 or desktop_linux == 1) and use_x11 == 1', { - 'sources': [ - 'filters/h264_bitstream_buffer_unittest.cc', - ], -@@ -2089,7 +2089,7 @@ - }, - ], - }], -- ['chromeos==1', { -+ ['chromeos==1 or desktop_linux==1', { - 'targets': [ - { - 'target_name': 'jpeg_decode_accelerator_unittest', -@@ -2116,7 +2116,7 @@ - } - ] - }], -- ['chromeos==1 or OS=="mac"', { -+ ['chromeos==1 or desktop_linux==1 or OS=="mac"', { - 'targets': [ - { - 'target_name': 'video_encode_accelerator_unittest', -@@ -2162,7 +2162,7 @@ - } - ] - }], -- ['chromeos==1 or OS=="win" or OS=="android"', { -+ ['chromeos==1 or desktop_linux==1 or OS=="win" or OS=="android"', { - 'targets': [ - { - # GN: //media/gpu:video_decode_accelerator_unittest -@@ -2255,7 +2255,7 @@ - ], - }], - -- ['chromeos==1 and target_arch != "arm"', { -+ ['(chromeos==1 or desktop_linux==1) and target_arch != "arm"', { - 'targets': [ - { - 'target_name': 'vaapi_jpeg_decoder_unittest', diff --git a/vaapi_patch_r0.patch b/vaapi_patch_r0.patch new file mode 100644 index 000000000000..4b4b003a192b --- /dev/null +++ b/vaapi_patch_r0.patch @@ -0,0 +1,616 @@ +--- a/chrome/browser/about_flags.cc ++++ b/chrome/browser/about_flags.cc +@@ -1044,7 +1044,7 @@ const FeatureEntry kFeatureEntries[] = { + "disable-accelerated-video-decode", + IDS_FLAGS_ACCELERATED_VIDEO_DECODE_NAME, + IDS_FLAGS_ACCELERATED_VIDEO_DECODE_DESCRIPTION, +- kOsMac | kOsWin | kOsCrOS | kOsAndroid, ++ kOsAll, + SINGLE_DISABLE_VALUE_TYPE(switches::kDisableAcceleratedVideoDecode), + }, + #if defined(USE_ASH) +--- a/content/common/BUILD.gn ++++ b/content/common/BUILD.gn +@@ -13,6 +13,49 @@ if (is_mac) { + import("//build/config/mac/mac_sdk.gni") + } + ++if ((is_desktop_linux || is_chromeos) && current_cpu != "arm") { ++ action("libva_generate_stubs") { ++ extra_header = "../../media/gpu/va_stub_header.fragment" ++ ++ script = "../../tools/generate_stubs/generate_stubs.py" ++ sources = [ ++ "../../media/gpu/va.sigs", ++ ] ++ inputs = [ ++ extra_header, ++ ] ++ sources += [ "../../media/gpu/va_x11.sigs" ] ++ if (use_ozone) { ++ sources += [ ++ "../../media/gpu/va_drm.sigs", ++ "va_wayland.sigs", ++ ] ++ } ++ stubs_filename_root = "va_stubs" ++ ++ outputs = [ ++ "$target_gen_dir/$stubs_filename_root.cc", ++ "$target_gen_dir/$stubs_filename_root.h", ++ ] ++ args = [ ++ "-i", ++ rebase_path("$target_gen_dir", root_build_dir), ++ "-o", ++ rebase_path("$target_gen_dir", root_build_dir), ++ "-t", ++ "posix_stubs", ++ "-e", ++ rebase_path(extra_header, root_build_dir), ++ "-s", ++ stubs_filename_root, ++ "-p", ++ "content/common", ++ ] ++ ++ args += rebase_path(sources, root_build_dir) ++ } ++} ++ + source_set("common") { + # Targets external to content should always link to the public API. + # In addition, targets outside of the content component (shell and tests) +@@ -525,6 +568,16 @@ source_set("common") { + "sandbox_linux/android/sandbox_bpf_base_policy_android.h", + ] + } ++ } else { ++ if (current_cpu != "arm" && is_desktop_linux) { ++ sources += get_target_outputs(":libva_generate_stubs") ++ deps += [ ":libva_generate_stubs" ] ++ configs += [ "//third_party/libva:libva_config" ] ++ if (use_ozone) { ++ configs += [ "//build/config/linux:x11" ] ++ deps += [ "//third_party/wayland:wayland_client" ] ++ } ++ } + } + + if (is_mac) { +--- a/content/common/sandbox_linux/bpf_gpu_policy_linux.cc ++++ b/content/common/sandbox_linux/bpf_gpu_policy_linux.cc +@@ -25,6 +25,12 @@ + #include "base/memory/ptr_util.h" + #include "base/strings/stringprintf.h" + #include "build/build_config.h" ++ ++#if !defined(__arm__) ++// Auto-generated for dlopen libva libraries ++#include "content/common/va_stubs.h" ++#endif ++ + #include "content/common/sandbox_linux/sandbox_bpf_base_policy_linux.h" + #include "content/common/sandbox_linux/sandbox_seccomp_bpf_linux.h" + #include "content/common/set_process_title.h" +@@ -36,6 +42,28 @@ + #include "sandbox/linux/syscall_broker/broker_process.h" + #include "sandbox/linux/system_headers/linux_syscalls.h" + ++#if !defined(__arm__) ++#include "third_party/libva/va/va.h" ++#include "third_party/libva/va/va_backend.h" ++#if defined(USE_X11) ++#include "third_party/libva/va/va_x11.h" ++#include "ui/gfx/x/x11_types.h" ++#elif defined(USE_OZONE) ++#include "base/files/file.h" ++#include "third_party/libva/va/drm/va_drm.h" ++#include "third_party/libva/va/va_drmcommon.h" ++#endif ++#endif ++ ++#define DRIVER_EXTENSION "_drv_video.so" ++#if defined(__x86_64__) ++#define VA_DRIVERS_PATH "/usr/lib/x86_64-linux-gnu/dri" ++#elif defined(__i386__) ++#define VA_DRIVERS_PATH "/usr/lib/i386-linux-gnu/dri" ++#elif defined(__aarch64__) ++#define VA_DRIVERS_PATH "/usr/lib/aarch64-linux-gnu/dri" ++#endif ++ + using sandbox::arch_seccomp_data; + using sandbox::bpf_dsl::Allow; + using sandbox::bpf_dsl::ResultExpr; +@@ -44,6 +72,17 @@ using sandbox::syscall_broker::BrokerFilePermission; + using sandbox::syscall_broker::BrokerProcess; + using sandbox::SyscallSets; + ++#if !defined(__arm__) ++using content_common::kModuleVa; ++#if defined(USE_X11) ++using content_common::kModuleVa_x11; ++#elif defined(USE_OZONE) ++using content_common::kModuleVa_drm; ++#endif ++using content_common::InitializeStubs; ++using content_common::StubPathMap; ++#endif ++ + namespace content { + + namespace { +@@ -98,7 +137,7 @@ inline bool UseLibV4L2() { + + bool IsAcceleratedVaapiVideoEncodeEnabled() { + bool accelerated_encode_enabled = false; +-#if defined(OS_CHROMEOS) ++#if defined(OS_CHROMEOS) || defined(OS_LINUX) + const base::CommandLine& command_line = + *base::CommandLine::ForCurrentProcess(); + accelerated_encode_enabled = +@@ -290,6 +329,36 @@ ResultExpr GpuProcessPolicy::EvaluateSyscall(int sysno) const { + } + } + ++#if !defined(__arm__) ++static VADisplay VaapiGetVADisplay() { ++ StubPathMap paths; ++ VADisplay va_display; ++ paths[kModuleVa].push_back("libva.so.1"); ++#if defined(USE_OZONE) ++ paths[kModuleVa_drm].push_back("libva-drm.so.1"); ++#elif defined (USE_X11) ++ paths[kModuleVa_x11].push_back("libva-x11.so.1"); ++#endif ++ if (!InitializeStubs(paths)) { ++ return NULL; ++ } ++#if defined(USE_OZONE) ++ const char kDriRenderNode0Path[] = "/dev/dri/renderD128"; ++ base::File drm_file = base::File( ++ base::FilePath::FromUTF8Unsafe(kDriRenderNode0Path), ++ base::File::FLAG_OPEN | base::File::FLAG_READ | base::File::FLAG_WRITE); ++ va_display = vaGetDisplayDRM(drm_file.GetPlatformFile()); ++#elif defined(USE_X11) ++ va_display = vaGetDisplay(gfx::GetXDisplay()); ++#endif ++ if (!vaDisplayIsValid(va_display)) { ++ LOG(WARNING) << "Unable to get display."; ++ return NULL; ++ } ++ return va_display; ++} ++#endif ++ + bool GpuProcessPolicy::PreSandboxHook() { + // Warm up resources needed by the policy we're about to enable and + // eventually start a broker process. +@@ -303,32 +372,75 @@ bool GpuProcessPolicy::PreSandboxHook() { + GpuBrokerProcessPolicy::Create, + std::vector<BrokerFilePermission>()); // No extra files in whitelist. + ++#if !defined(__arm__) + if (IsArchitectureX86_64() || IsArchitectureI386()) { + // Accelerated video dlopen()'s some shared objects + // inside the sandbox, so preload them now. + if (IsAcceleratedVaapiVideoEncodeEnabled() || + IsAcceleratedVideoDecodeEnabled()) { +- const char* I965DrvVideoPath = NULL; +- const char* I965HybridDrvVideoPath = NULL; +- +- if (IsArchitectureX86_64()) { +- I965DrvVideoPath = "/usr/lib64/va/drivers/i965_drv_video.so"; +- I965HybridDrvVideoPath = "/usr/lib64/va/drivers/hybrid_drv_video.so"; +- } else if (IsArchitectureI386()) { +- I965DrvVideoPath = "/usr/lib/va/drivers/i965_drv_video.so"; +- } +- +- dlopen(I965DrvVideoPath, RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE); +- if (I965HybridDrvVideoPath) +- dlopen(I965HybridDrvVideoPath, RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE); +- dlopen("libva.so.1", RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE); ++ // Init a VA Context, get driver name (and path), close context and preload ++#if defined(USE_OZONE) || defined(USE_X11) ++ VADisplay va_display = VaapiGetVADisplay(); ++ if (va_display) { ++ char *va_search_path = getenv("LIBVA_DRIVERS_PATH"); ++ char *va_driver_name = getenv("LIBVA_DRIVER_NAME"); ++ char *saveptr, *driver_dir; ++ if (!va_driver_name) { ++ VADisplayContextP pDisplayContext = ++ static_cast<VADisplayContextP>(va_display); ++ pDisplayContext->vaGetDriverName(pDisplayContext, &va_driver_name); ++ } ++ ++ if (!va_driver_name) { ++ return true; ++ } ++ ++ if (!va_search_path) { ++ va_search_path = strdup(VA_DRIVERS_PATH); ++ } ++ ++ driver_dir = strtok_r(va_search_path, ":", &saveptr); ++ while (driver_dir) { ++ std::string driver_path = base::StringPrintf("%s/%s%s", driver_dir, ++ va_driver_name, DRIVER_EXTENSION); ++ ++ // attempt to dlopen() the va driver ++ LOG(INFO) << "Looking for " << driver_path << "..."; ++ if (access(driver_path.c_str(), R_OK) != -1) { ++ LOG(WARNING) << "Attempting to pre-load " << va_driver_name << " VA driver..."; ++ if (dlopen(driver_path.c_str(), RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE)) { ++ LOG(WARNING) << "VA driver \"" << driver_path << "\" opened!"; ++ ++ if (strcmp(va_driver_name, "nvidia") == 0) { ++ LOG(WARNING) << "Pre-loading NVIDIA VDPAU driver libraries..."; ++ if (dlopen("libvdpau_nvidia.so", RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE)) { ++ LOG(WARNING) << "Loaded libvdpau_nvidia.so"; ++ } ++ ++ if (dlopen("libvdpau.so", RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE)) { ++ LOG(WARNING) << "Loaded libvdpau.so"; ++ } ++ } ++ LOG(WARNING) << "Loading libva libraries..."; ++ dlopen("libva.so.1", RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE); + #if defined(USE_OZONE) +- dlopen("libva-drm.so.1", RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE); ++ dlopen("libva-drm.so.1", RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE); + #elif defined(USE_X11) +- dlopen("libva-x11.so.1", RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE); ++ dlopen("libva-x11.so.1", RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE); ++#endif ++ break; ++ } ++ LOG(ERROR) << "VA driver failed to open!"; ++ } ++ ++ driver_dir = strtok_r(NULL, ":", &saveptr); ++ } ++ free(va_search_path); ++ } + #endif + } + } ++#endif + + return true; + } +--- /dev/null ++++ b/content/common/va_wayland.sigs +@@ -0,0 +1,8 @@ ++// Copyright 2014 The Chromium Authors. All rights reserved. ++// Use of this source code is governed by a BSD-style license that can be ++// found in the LICENSE file. ++ ++//------------------------------------------------ ++// Functions from libva-wayland used in chromium code. ++//------------------------------------------------ ++VADisplay vaGetDisplayWl(struct wl_display *display); +--- a/content/gpu/BUILD.gn ++++ b/content/gpu/BUILD.gn +@@ -92,7 +92,7 @@ target(link_target_type, "gpu_sources") { + ] + } + +- if (is_chromeos && current_cpu != "arm") { ++ if ((is_desktop_linux || is_chromeos) && current_cpu != "arm") { + configs += [ "//third_party/libva:libva_config" ] + } + +--- a/content/gpu/gpu_main.cc ++++ b/content/gpu/gpu_main.cc +@@ -85,7 +85,7 @@ + #include "ui/ozone/public/ozone_platform.h" + #endif + +-#if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) ++#if (defined(OS_LINUX) || defined(OS_CHROMEOS)) && defined(ARCH_CPU_X86_FAMILY) + #include "media/gpu/vaapi_wrapper.h" + #endif + +@@ -141,7 +141,7 @@ class ContentSandboxHelper : public gpu::GpuSandboxHelper { + (void)base::RandUint64(); + } + +-#if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) ++#if (defined(OS_LINUX) || defined(OS_CHROMEOS)) && defined(ARCH_CPU_X86_FAMILY) + media::VaapiWrapper::PreSandboxInitialization(); + #endif + #if defined(OS_WIN) +--- a/content/public/common/content_switches.cc ++++ b/content/public/common/content_switches.cc +@@ -1000,7 +1000,9 @@ const char kDisableAudioSupportForDesktopShare[] = + #if defined(OS_CHROMEOS) + // Disables panel fitting (used for mirror mode). + const char kDisablePanelFitting[] = "disable-panel-fitting"; ++#endif + ++#if defined(OS_CHROMEOS) || defined(OS_LINUX) + // Disables VA-API accelerated video encode. + const char kDisableVaapiAcceleratedVideoEncode[] = + "disable-vaapi-accelerated-video-encode"; +--- a/content/public/common/content_switches.h ++++ b/content/public/common/content_switches.h +@@ -291,6 +291,8 @@ CONTENT_EXPORT extern const char kEnableOSKOverscroll[]; + + #if defined(OS_CHROMEOS) + CONTENT_EXPORT extern const char kDisablePanelFitting[]; ++#endif ++#if defined(OS_CHROMEOS) || defined(OS_LINUX) + CONTENT_EXPORT extern const char kDisableVaapiAcceleratedVideoEncode[]; + #endif + +--- a/gpu/config/software_rendering_list_json.cc ++++ b/gpu/config/software_rendering_list_json.cc +@@ -395,17 +395,6 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( + ] + }, + { +- "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], +--- a/media/BUILD.gn ++++ b/media/BUILD.gn +@@ -396,7 +396,7 @@ component("media") { + allow_circular_includes_from = [ "//media/base/android" ] + } + +- if (current_cpu != "arm" && is_chromeos) { ++ if (current_cpu != "arm" && (is_chromeos || is_desktop_linux)) { + sources += [ + "filters/h264_bitstream_buffer.cc", + "filters/h264_bitstream_buffer.h", +@@ -667,7 +667,7 @@ source_set("unit_tests") { + } + } + +- if (current_cpu != "arm" && is_chromeos) { ++ if (current_cpu != "arm" && (is_chromeos || is_desktop_linux)) { + sources += [ "filters/h264_bitstream_buffer_unittest.cc" ] + } + +--- a/media/gpu/BUILD.gn ++++ b/media/gpu/BUILD.gn +@@ -18,7 +18,7 @@ if (is_mac) { + import("//build/config/mac/mac_sdk.gni") + } + +-if (is_chromeos && current_cpu != "arm") { ++if ((is_desktop_linux || is_chromeos) && current_cpu != "arm") { + action("libva_generate_stubs") { + extra_header = "va_stub_header.fragment" + +@@ -212,7 +212,7 @@ component("gpu") { + } + } + +- if (is_chromeos || is_win) { ++ if (is_linux || is_win) { + sources += [ + "accelerated_video_decoder.h", + "h264_decoder.cc", +@@ -221,7 +221,7 @@ component("gpu") { + "h264_dpb.h", + ] + } +- if (is_chromeos) { ++ if (is_linux) { + sources += [ + "vp8_decoder.cc", + "vp8_decoder.h", +@@ -259,7 +259,7 @@ component("gpu") { + "GLESv2", + ] + } +- if (current_cpu == "arm") { ++ if (current_cpu == "arm" && is_chromeos) { + sources += [ + "tegra_v4l2_device.cc", + "tegra_v4l2_device.h", +--- a/media/gpu/gpu_video_decode_accelerator_factory.cc ++++ b/media/gpu/gpu_video_decode_accelerator_factory.cc +@@ -16,7 +16,7 @@ + #include "media/gpu/dxva_video_decode_accelerator_win.h" + #elif defined(OS_MACOSX) + #include "media/gpu/vt_video_decode_accelerator_mac.h" +-#elif defined(OS_CHROMEOS) ++#elif defined(OS_CHROMEOS) || defined(OS_LINUX) + #if defined(USE_V4L2_CODEC) + #include "media/gpu/v4l2_device.h" + #include "media/gpu/v4l2_slice_video_decode_accelerator.h" +@@ -82,7 +82,7 @@ GpuVideoDecodeAcceleratorFactory::GetDecoderCapabilities( + #if defined(OS_WIN) + capabilities.supported_profiles = + DXVAVideoDecodeAccelerator::GetSupportedProfiles(gpu_preferences); +-#elif defined(OS_CHROMEOS) ++#elif defined(OS_CHROMEOS) || defined(OS_LINUX) + VideoDecodeAccelerator::SupportedProfiles vda_profiles; + #if defined(USE_V4L2_CODEC) + vda_profiles = V4L2VideoDecodeAccelerator::GetSupportedProfiles(); +@@ -135,7 +135,7 @@ GpuVideoDecodeAcceleratorFactory::CreateVDA( + &GpuVideoDecodeAcceleratorFactory::CreateV4L2VDA, + &GpuVideoDecodeAcceleratorFactory::CreateV4L2SVDA, + #endif +-#if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) ++#if (defined(OS_LINUX) || defined(OS_CHROMEOS)) && defined(ARCH_CPU_X86_FAMILY) + &GpuVideoDecodeAcceleratorFactory::CreateVaapiVDA, + #endif + #if defined(OS_MACOSX) +@@ -218,11 +218,12 @@ GpuVideoDecodeAcceleratorFactory::CreateV4L2SVDA( + } + #endif + +-#if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) ++#if (defined(OS_LINUX) || defined(OS_CHROMEOS)) && defined(ARCH_CPU_X86_FAMILY) + std::unique_ptr<VideoDecodeAccelerator> + GpuVideoDecodeAcceleratorFactory::CreateVaapiVDA( + const gpu::GpuDriverBugWorkarounds& workarounds, + const gpu::GpuPreferences& gpu_preferences) const { ++ VLOG(1) << "Creating new VAAPI video decode accelerator."; + std::unique_ptr<VideoDecodeAccelerator> decoder; + decoder.reset(new VaapiVideoDecodeAccelerator(make_context_current_cb_, + bind_image_cb_)); +--- a/media/gpu/gpu_video_decode_accelerator_factory.h ++++ b/media/gpu/gpu_video_decode_accelerator_factory.h +@@ -101,7 +101,7 @@ class MEDIA_GPU_EXPORT GpuVideoDecodeAcceleratorFactory { + const gpu::GpuDriverBugWorkarounds& workarounds, + const gpu::GpuPreferences& gpu_preferences) const; + #endif +-#if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) ++#if (defined(OS_LINUX) || defined(OS_CHROMEOS)) && defined(ARCH_CPU_X86_FAMILY) + std::unique_ptr<VideoDecodeAccelerator> CreateVaapiVDA( + const gpu::GpuDriverBugWorkarounds& workarounds, + const gpu::GpuPreferences& gpu_preferences) const; +--- a/media/gpu/ipc/service/BUILD.gn ++++ b/media/gpu/ipc/service/BUILD.gn +@@ -47,7 +47,7 @@ target(link_target_type, "service") { + + configs += [ "//media/gpu:gpu_config" ] + +- if (is_chromeos && current_cpu != "arm") { ++ if ((is_desktop_linux || is_chromeos) && current_cpu != "arm") { + configs += [ "//third_party/libva:libva_config" ] + } + +--- a/media/gpu/ipc/service/gpu_video_decode_accelerator.cc ++++ b/media/gpu/ipc/service/gpu_video_decode_accelerator.cc +@@ -58,7 +58,7 @@ static bool MakeDecoderContextCurrent( + return true; + } + +-#if (defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY)) || \ ++#if ((defined(OS_LINUX) || defined(OS_CHROMEOS)) && defined(ARCH_CPU_X86_FAMILY)) || \ + defined(OS_MACOSX) || defined(OS_WIN) + static bool BindImage(const base::WeakPtr<gpu::GpuCommandBufferStub>& stub, + uint32_t client_texture_id, +@@ -172,7 +172,7 @@ GpuVideoDecodeAccelerator::GpuVideoDecodeAccelerator( + get_gl_context_cb_ = base::Bind(&GetGLContext, stub_->AsWeakPtr()); + make_context_current_cb_ = + base::Bind(&MakeDecoderContextCurrent, stub_->AsWeakPtr()); +-#if (defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY)) || \ ++#if ((defined(OS_LINUX) || defined(OS_CHROMEOS)) && defined(ARCH_CPU_X86_FAMILY)) || \ + defined(OS_MACOSX) || defined(OS_WIN) + bind_image_cb_ = base::Bind(&BindImage, stub_->AsWeakPtr()); + #endif +--- a/media/gpu/va_stub_header.fragment ++++ b/media/gpu/va_stub_header.fragment +@@ -5,8 +5,9 @@ extern "C" { + + #include "third_party/libva/va/drm/va_drm.h" + #include "third_party/libva/va/va.h" +-#if defined(USE_X11) + #include "third_party/libva/va/va_x11.h" ++#if defined(USE_OZONE) ++#include "third_party/libva/va/wayland/va_wayland.h" + #endif + + } +--- a/media/gpu/vaapi_video_decode_accelerator.cc ++++ b/media/gpu/vaapi_video_decode_accelerator.cc +@@ -358,17 +358,17 @@ bool VaapiVideoDecodeAccelerator::Initialize(const Config& config, + + base::AutoLock auto_lock(lock_); + DCHECK_EQ(state_, kUninitialized); +- DVLOG(2) << "Initializing VAVDA, profile: " << GetProfileName(profile); ++ VLOG(1) << "Initializing VAVDA, profile: " << GetProfileName(profile); + + #if defined(USE_X11) + if (gl::GetGLImplementation() != gl::kGLImplementationDesktopGL) { +- DVLOG(1) << "HW video decode acceleration not available without " ++ VLOG(1) << "HW video decode acceleration not available without " + "DesktopGL (GLX)."; + return false; + } + #elif defined(USE_OZONE) + if (gl::GetGLImplementation() != gl::kGLImplementationEGLGLES2) { +- DVLOG(1) << "HW video decode acceleration not available without " ++ VLOG(1) << "HW video decode acceleration not available without " + << "EGLGLES2."; + return false; + } +@@ -378,7 +378,7 @@ bool VaapiVideoDecodeAccelerator::Initialize(const Config& config, + VaapiWrapper::kDecode, profile, base::Bind(&ReportToUMA, VAAPI_ERROR)); + + if (!vaapi_wrapper_.get()) { +- DVLOG(1) << "Failed initializing VAAPI for profile " ++ VLOG(1) << "Failed initializing VAAPI for profile " + << GetProfileName(profile); + return false; + } +@@ -394,7 +394,7 @@ bool VaapiVideoDecodeAccelerator::Initialize(const Config& config, + vp9_accelerator_.reset(new VaapiVP9Accelerator(this, vaapi_wrapper_.get())); + decoder_.reset(new VP9Decoder(vp9_accelerator_.get())); + } else { +- DLOG(ERROR) << "Unsupported profile " << GetProfileName(profile); ++ VLOG(1) << "Unsupported profile " << GetProfileName(profile); + return false; + } + +--- a/media/gpu/vaapi_wrapper.cc ++++ b/media/gpu/vaapi_wrapper.cc +@@ -188,7 +188,7 @@ scoped_refptr<VaapiWrapper> VaapiWrapper::Create( + VAProfile va_profile, + const base::Closure& report_error_to_uma_cb) { + if (!GetProfileInfos()->IsProfileSupported(mode, va_profile)) { +- DVLOG(1) << "Unsupported va_profile: " << va_profile; ++ VLOG(1) << "Unsupported va_profile: " << va_profile; + return nullptr; + } + +@@ -340,15 +340,17 @@ VaapiWrapper::GetSupportedProfileInfosForCodecModeInternal(CodecMode mode) { + bool VaapiWrapper::VaInitialize(const base::Closure& report_error_to_uma_cb) { + static bool vaapi_functions_initialized = PostSandboxInitialization(); + if (!vaapi_functions_initialized) { +- bool running_on_chromeos = false; +-#if defined(OS_CHROMEOS) ++ bool error_level_logging = false; ++#if defined(OS_LINUX) ++ error_level_logging = true; ++#elif defined(OS_CHROMEOS) + // When chrome runs on linux with chromeos=1, do not log error message + // without VAAPI libraries. +- running_on_chromeos = base::SysInfo::IsRunningOnChromeOS(); ++ error_level_logging = base::SysInfo::IsRunningOnChromeOS(); + #endif + static const char kErrorMsg[] = "Failed to initialize VAAPI libs"; +- if (running_on_chromeos) +- LOG(ERROR) << kErrorMsg; ++ if (error_level_logging) ++ VLOG(1) << kErrorMsg; + else + DVLOG(1) << kErrorMsg; + return false; +@@ -407,7 +409,7 @@ bool VaapiWrapper::IsEntrypointSupported_Locked(VAProfile va_profile, + + if (std::find(supported_entrypoints.begin(), supported_entrypoints.end(), + entrypoint) == supported_entrypoints.end()) { +- DVLOG(1) << "Unsupported entrypoint"; ++ VLOG(1) << "Unsupported entrypoint"; + return false; + } + return true; +@@ -431,8 +433,8 @@ bool VaapiWrapper::AreAttribsSupported_Locked( + 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 +- << " for attribute type " << required_attribs[i].type; ++ VLOG(1) << "Unsupported value " << required_attribs[i].value ++ << " for attribute type " << required_attribs[i].type; + return false; + } + } |