From 171287a30eeb0cb92290dad094ffd3bc41f9e9c6 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Wed, 2 Jan 2019 15:55:53 +0100 Subject: community/chromium: build with vaapi and dont use gold gold does not seem to work with arm architectures. libva patches are from void linux --- community/chromium/APKBUILD | 31 +- community/chromium/chromium-enable-vaapi.patch | 542 +++++++++++++++++++++ .../chromium/chromium-i686-vaapi-fpermissive.patch | 23 + 3 files changed, 578 insertions(+), 18 deletions(-) create mode 100644 community/chromium/chromium-enable-vaapi.patch create mode 100644 community/chromium/chromium-i686-vaapi-fpermissive.patch diff --git a/community/chromium/APKBUILD b/community/chromium/APKBUILD index 01944bc3bf..cffbe543d5 100644 --- a/community/chromium/APKBUILD +++ b/community/chromium/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: Carlo Landmeter pkgname=chromium pkgver=71.0.3578.98 -pkgrel=1 +pkgrel=2 pkgdesc="chromium web browser" url="http://www.chromium.org/" arch="x86_64 aarch64 armhf armv7" @@ -109,6 +109,8 @@ source="https://commondatastorage.googleapis.com/chromium-browser-official/$pkgn chromium-71-gcc-0.patch gcc8-alignof.patch chromium-fix_harfbuzz_2.patch + chromium-enable-vaapi.patch + chromium-i686-vaapi-fpermissive.patch " builddir="$srcdir"/$pkgname-$pkgver @@ -171,12 +173,6 @@ prepare() { -delete done - # Work around bug in blink in which GCC 6 optimizes away null pointer checks - # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=833524 - # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68853#c2 - sed -i '/config("compiler")/ a cflags_cc = [ "-fno-delete-null-pointer-checks" ]' \ - build/config/linux/BUILD.gn - msg "Replacing gyp files" python build/linux/unbundle/replace_gn_files.py --system-libraries \ ${use_system} @@ -198,13 +194,6 @@ build() { eval "$(base64 -d < $srcdir/google-api.keys)" local _ca="" - #case "$CARCH" in - # Chromium build as armv6 is broken, ffmpeg fails utterly - # The default is armv7 which is not armhf standard, but better than nothing. - #armhf) _ca=$(_gn_flags arm_version=6 arm_arch=\"armv6zk\" \ - # arm_fpu=\"vfp\" arm_float_abi=\"hard\" \ - # arm_use_neon=false arm_optionally_use_neon=true);; - #esac msg "Bootstrapping GN" local _c=$(_gn_flags is_clang=false \ @@ -212,9 +201,10 @@ build() { treat_warnings_as_errors=false \ fatal_linker_warnings=false \ binutils_path=\"/usr/bin\" \ - use_gold=true \ + use_gold=false \ use_allocator=\"none\" \ use_allocator_shim=false \ + use_vaapi=true \ ) AR="ar" CC="${CC:-gcc}" CXX="${CXX:-g++}" LD="${CXX:-g++}" \ @@ -225,7 +215,6 @@ build() { clang_use_chrome_plugins=false \ custom_toolchain=\"//build/toolchain/linux/unbundle:default\" \ enable_hangout_services_extension=true \ - enable_hotwording=false \ enable_nacl=false \ enable_nacl_nonsfi=false \ enable_precompiled_headers=false \ @@ -240,6 +229,7 @@ build() { icu_use_data_file=true \ is_clang=false \ is_debug=$_is_debug \ + is_desktop_linux=true \ linux_use_bundled_binutils=false \ proprietary_codecs=true \ remove_webcore_debug_symbols=true \ @@ -250,7 +240,7 @@ build() { use_cups=true \ use_custom_libcxx=false \ use_gnome_keyring=false \ - use_gold=true \ + use_gold=false \ use_lld=false \ use_pulseaudio=false \ use_sysroot=false \ @@ -272,6 +262,9 @@ build() { paxmark -m out/Release/v8_context_snapshot_generator \ out/Release/obj/tools/v8_context_snapshot/v8_context_snapshot_generator + # final link needs lots of file descriptors + ulimit -n 2048 + # finish rest of the build ninja -C out/$_buildtype chrome chrome_sandbox chromedriver } @@ -357,4 +350,6 @@ cbd99d51178fa5c2c3dee1eb4990240ca2ff829cee9151384e36bc3c634698c0ecaf9b51c99e901f 05c1af43038f76014f5f8b605085310414242f2bfad0e3258ddb29a08e7f4307de31b2d551b0a291986cc7d5a01cf3a003ac864216877195bb4310fd33193f0f musl-crashpad.patch 74fcae35afd964e2dc09508325465ee0d2efd13b94941eaf6464da1f4b32a34b326cf2c290fffcfc930acefda51a64dfbc980527900849efb5a94922cc17bc20 chromium-71-gcc-0.patch 9bfc532fd1e84e30362ac41fcd68253e17ee4cb5e986ceb5bb122e3235e4617e295ce9dddfdfbbd0b9d3e67267096152da2a19e3bb4bb9111c7fdb22fa398872 gcc8-alignof.patch -4e6bfecdece829306b8c2ea2a4b6d9b0598f97e5b164e0f468e765ffa10cac6b9e57c8814b79eb1244a314d81e8954654111a2e1e056b2c450b369994337cb40 chromium-fix_harfbuzz_2.patch" +4e6bfecdece829306b8c2ea2a4b6d9b0598f97e5b164e0f468e765ffa10cac6b9e57c8814b79eb1244a314d81e8954654111a2e1e056b2c450b369994337cb40 chromium-fix_harfbuzz_2.patch +b0e61b4710a8e9009bd9c10722d902391b83c0400a48a6a40cc0e117ca4c1895732babe5baa078f5b3096b72d105fa2d1f4196f8d35c1ae94ff4d8d99d2a17f5 chromium-enable-vaapi.patch +42d64d07215476295a35568e4492297a00b66205b5a41288a98b1663985fe1868e9595e961284dfbbd8b5846cc1b04e365ab89733270ffbc6967e3366571cf47 chromium-i686-vaapi-fpermissive.patch" diff --git a/community/chromium/chromium-enable-vaapi.patch b/community/chromium/chromium-enable-vaapi.patch new file mode 100644 index 0000000000..24f1ba77f7 --- /dev/null +++ b/community/chromium/chromium-enable-vaapi.patch @@ -0,0 +1,542 @@ +diff -ur chrome/browser/about_flags.cc chromium-69.0.3497.92/chrome/browser/about_flags.cc +--- chrome/browser/about_flags.cc 2018-09-12 00:39:23.000000000 +0530 ++++ chrome/browser/about_flags.cc 2018-09-13 22:10:33.938016199 +0530 +@@ -1238,12 +1238,14 @@ + {"ui-disable-partial-swap", flag_descriptions::kUiPartialSwapName, + flag_descriptions::kUiPartialSwapDescription, kOsAll, + SINGLE_DISABLE_VALUE_TYPE(switches::kUIDisablePartialSwap)}, ++#if defined(OS_CHROMEOS) || defined(OS_ANDROID) + {"disable-webrtc-hw-decoding", flag_descriptions::kWebrtcHwDecodingName, + flag_descriptions::kWebrtcHwDecodingDescription, kOsAndroid | kOsCrOS, + SINGLE_DISABLE_VALUE_TYPE(switches::kDisableWebRtcHWDecoding)}, + {"disable-webrtc-hw-encoding", flag_descriptions::kWebrtcHwEncodingName, + flag_descriptions::kWebrtcHwEncodingDescription, kOsAndroid | kOsCrOS, + SINGLE_DISABLE_VALUE_TYPE(switches::kDisableWebRtcHWEncoding)}, ++#endif + {"enable-webrtc-hw-h264-encoding", + flag_descriptions::kWebrtcHwH264EncodingName, + flag_descriptions::kWebrtcHwH264EncodingDescription, kOsAndroid | kOsCrOS, +@@ -1612,6 +1614,13 @@ + flag_descriptions::kShowTouchHudDescription, kOsCrOS, + SINGLE_VALUE_TYPE(ash::switches::kAshTouchHud)}, + #endif // OS_CHROMEOS ++#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_ANDROID) ++ { ++ "enable-accelerated-video", flag_descriptions::kAcceleratedVideoName, ++ flag_descriptions::kAcceleratedVideoDescription, kOsLinux, ++ SINGLE_VALUE_TYPE(switches::kEnableAcceleratedVideo), ++ }, ++#else + { + "disable-accelerated-video-decode", + flag_descriptions::kAcceleratedVideoDecodeName, +@@ -1619,6 +1628,7 @@ + kOsMac | kOsWin | kOsCrOS | kOsAndroid, + SINGLE_DISABLE_VALUE_TYPE(switches::kDisableAcceleratedVideoDecode), + }, ++#endif + #if defined(OS_WIN) + {"enable-hdr", flag_descriptions::kEnableHDRName, + flag_descriptions::kEnableHDRDescription, kOsWin, +@@ -2291,12 +2301,17 @@ + FEATURE_VALUE_TYPE(features::kOpenVR)}, + #endif // ENABLE_OPENVR + #endif // ENABLE_VR +-#if defined(OS_CHROMEOS) ++#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_ANDROID) ++ {"enable-accelerated-mjpeg-decode", ++ flag_descriptions::kAcceleratedMjpegDecodeName, ++ flag_descriptions::kAcceleratedMjpegDecodeDescription, kOsLinux, ++ SINGLE_VALUE_TYPE(switches::kEnableAcceleratedMjpegDecode)}, ++#elif defined(OS_CHROMEOS) + {"disable-accelerated-mjpeg-decode", + flag_descriptions::kAcceleratedMjpegDecodeName, + flag_descriptions::kAcceleratedMjpegDecodeDescription, kOsCrOS, + SINGLE_DISABLE_VALUE_TYPE(switches::kDisableAcceleratedMjpegDecode)}, +-#endif // OS_CHROMEOS ++#endif + {"v8-cache-options", flag_descriptions::kV8CacheOptionsName, + flag_descriptions::kV8CacheOptionsDescription, kOsAll, + MULTI_VALUE_TYPE(kV8CacheOptionsChoices)}, +Only in chrome/browser: about_flags.cc.orig +diff -ur chrome/browser/chromeos/login/chrome_restart_request.cc chromium-69.0.3497.92/chrome/browser/chromeos/login/chrome_restart_request.cc +--- chrome/browser/chromeos/login/chrome_restart_request.cc 2018-09-12 00:39:23.000000000 +0530 ++++ chrome/browser/chromeos/login/chrome_restart_request.cc 2018-09-13 22:10:33.986014728 +0530 +@@ -19,6 +19,7 @@ + #include "base/sys_info.h" + #include "base/timer/timer.h" + #include "base/values.h" ++#include "build/build_config.h" + #include "cc/base/switches.h" + #include "chrome/browser/browser_process.h" + #include "chrome/browser/chromeos/boot_times_recorder.h" +@@ -84,9 +85,14 @@ + ::switches::kDisable2dCanvasImageChromium, + ::switches::kDisableAccelerated2dCanvas, + ::switches::kDisableAcceleratedJpegDecoding, ++#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_ANDROID) ++ ::switches::kEnableAcceleratedMjpegDecode, ++ ::switches::kEnableAcceleratedVideo, ++#else + ::switches::kDisableAcceleratedMjpegDecode, + ::switches::kDisableAcceleratedVideoDecode, + ::switches::kDisableAcceleratedVideoEncode, ++#endif + ::switches::kDisableBlinkFeatures, + ::switches::kDisableCastStreamingHWEncoding, + ::switches::kDisableGpu, +@@ -160,8 +166,10 @@ + ::switches::kEnableWebGLImageChromium, + ::switches::kEnableWebVR, + ::switches::kEnableUnsafeWebGPU, ++#if (defined(OS_CHROMEOS) || defined(OS_ANDROID)) + ::switches::kDisableWebRtcHWDecoding, + ::switches::kDisableWebRtcHWEncoding, ++#endif + ::switches::kOzonePlatform, + ash::switches::kAshEnableTabletMode, + ash::switches::kAshEnableWaylandServer, +diff -ur chrome/browser/flag_descriptions.cc chromium-69.0.3497.92/chrome/browser/flag_descriptions.cc +--- chrome/browser/flag_descriptions.cc 2018-09-12 00:39:24.000000000 +0530 ++++ chrome/browser/flag_descriptions.cc 2018-09-13 22:10:34.007014085 +0530 +@@ -14,6+14,13 @@ + "Enables the use of the GPU to perform 2d canvas rendering instead of " + "using software rendering."; + ++#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_ANDROID) ++const char kAcceleratedVideoName[] = "Hardware-accelerated video"; ++const char kAcceleratedVideoDescription[] = ++ "Hardware-accelerated video where VA-API driver is installed on the" ++ "system."; ++#endif ++ + const char kAcceleratedVideoDecodeName[] = "Hardware-accelerated video decode"; + const char kAcceleratedVideoDecodeDescription[] = + "Hardware-accelerated video decode where available."; +@@ -1986,6 +1993,7 @@ + const char kWebrtcEchoCanceller3Description[] = + "Experimental WebRTC echo canceller (AEC3)."; + ++#if defined(OS_CHROMEOS) || defined(OS_ANDROID) + const char kWebrtcHwDecodingName[] = "WebRTC hardware video decoding"; + const char kWebrtcHwDecodingDescription[] = + "Support in WebRTC for decoding video streams using platform hardware."; +@@ -1993,6 +2001,7 @@ + const char kWebrtcHwEncodingName[] = "WebRTC hardware video encoding"; + const char kWebrtcHwEncodingDescription[] = + "Support in WebRTC for encoding video streams using platform hardware."; ++#endif + + const char kWebrtcHwH264EncodingName[] = "WebRTC hardware h264 video encoding"; + const char kWebrtcHwH264EncodingDescription[] = +@@ -2892,14 +2901,16 @@ + + // Chrome OS ------------------------------------------------------------------- + +-#if defined(OS_CHROMEOS) ++#if defined(OS_CHROMEOS) || (defined(OS_LINUX) && !defined(OS_ANDROID)) + + const char kAcceleratedMjpegDecodeName[] = + "Hardware-accelerated mjpeg decode for captured frame"; + const char kAcceleratedMjpegDecodeDescription[] = + "Enable hardware-accelerated mjpeg decode for captured frame where " + "available."; ++#endif + ++#if defined(OS_CHROMEOS) + const char kAllowTouchpadThreeFingerClickName[] = "Touchpad three-finger-click"; + const char kAllowTouchpadThreeFingerClickDescription[] = + "Enables touchpad three-finger-click as middle button."; +diff -ur chrome/browser/flag_descriptions.h chromium-69.0.3497.92/chrome/browser/flag_descriptions.h +--- chrome/browser/flag_descriptions.h 2018-09-12 00:39:24.000000000 +0530 ++++ chrome/browser/flag_descriptions.h 2018-09-13 22:10:34.030013380 +0530 +@@ -37,6 +37,10 @@ + extern const char kAccelerated2dCanvasName[]; + extern const char kAccelerated2dCanvasDescription[]; + ++#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_ANDROID) ++extern const char kAcceleratedVideoName[]; ++extern const char kAcceleratedVideoDescription[]; ++#endif + extern const char kAcceleratedVideoDecodeName[]; + extern const char kAcceleratedVideoDecodeDescription[]; + +@@ -1762,13 +1766,17 @@ + + #endif // defined(OS_MACOSX) + +-// Chrome OS ------------------------------------------------------------------ +- +-#if defined(OS_CHROMEOS) ++#if defined(OS_CHROMEOS) || (defined(OS_LINUX) && !defined(OS_ANDROID)) + + extern const char kAcceleratedMjpegDecodeName[]; + extern const char kAcceleratedMjpegDecodeDescription[]; + ++#endif ++ ++// Chrome OS ------------------------------------------------------------------ ++ ++#if defined(OS_CHROMEOS) ++ + extern const char kAllowTouchpadThreeFingerClickName[]; + extern const char kAllowTouchpadThreeFingerClickDescription[]; + +diff -ur content/browser/gpu/compositor_util.cc chromium-69.0.3497.92/content/browser/gpu/compositor_util.cc +--- content/browser/gpu/compositor_util.cc 2018-09-12 00:39:41.000000000 +0530 ++++ content/browser/gpu/compositor_util.cc 2018-09-13 22:10:34.072012092 +0530 +@@ -149,7 +149,11 @@ + {"video_decode", + SafeGetFeatureStatus(gpu_feature_info, + gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE), ++#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_ANDROID) ++ !command_line.HasSwitch(switches::kEnableAcceleratedVideo), ++#else + command_line.HasSwitch(switches::kDisableAcceleratedVideoDecode), ++#endif + "Accelerated video decode has been disabled, either via blacklist, " + "about:flags or the command line.", + true, true}, +diff -ur content/browser/gpu/gpu_process_host.cc chromium-69.0.3497.92/content/browser/gpu/gpu_process_host.cc +--- content/browser/gpu/gpu_process_host.cc 2018-09-12 00:39:41.000000000 +0530 ++++ content/browser/gpu/gpu_process_host.cc 2018-09-13 22:10:34.113010836 +0530 +@@ -209,7 +209,9 @@ + switches::kDisableLogging, + switches::kDisableShaderNameHashing, + switches::kDisableSkiaRuntimeOpts, ++#if !defined(OS_LINUX) + switches::kDisableWebRtcHWEncoding, ++#endif + #if defined(OS_WIN) + switches::kEnableAcceleratedVpxDecode, + #endif +diff -ur content/browser/renderer_host/media/video_capture_browsertest.cc chromium-69.0.3497.92/content/browser/renderer_host/media/video_capture_browsertest.cc +--- content/browser/renderer_host/media/video_capture_browsertest.cc 2018-09-12 00:39:41.000000000 +0530 ++++ content/browser/renderer_host/media/video_capture_browsertest.cc 2018-09-13 22:10:34.124010499 +0530 +@@ -165,8 +165,13 @@ + base::CommandLine::ForCurrentProcess()->AppendSwitch( + switches::kUseFakeJpegDecodeAccelerator); + } else { ++#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_ANDROID) ++ base::CommandLine::ForCurrentProcess()->AppendSwitch( ++ switches::kEnableAcceleratedMjpegDecode); ++#else + base::CommandLine::ForCurrentProcess()->AppendSwitch( + switches::kDisableAcceleratedMjpegDecode); ++#endif + } + } + +diff -ur content/browser/renderer_host/render_process_host_impl.cc chromium-69.0.3497.92/content/browser/renderer_host/render_process_host_impl.cc +--- content/browser/renderer_host/render_process_host_impl.cc 2018-09-12 00:39:41.000000000 +0530 ++++ content/browser/renderer_host/render_process_host_impl.cc 2018-09-13 22:10:34.133010223 +0530 +@@ -2798,7 +2798,11 @@ + switches::kDefaultTileHeight, + switches::kDisable2dCanvasImageChromium, + switches::kDisableAcceleratedJpegDecoding, ++#if defined(OS_LINUX) && !defined(OS_CHROMEOS) ++ switches::kEnableAcceleratedVideo, ++#else + switches::kDisableAcceleratedVideoDecode, ++#endif + switches::kDisableBackgroundTasks, + switches::kDisableBackgroundTimerThrottling, + switches::kDisableBreakpad, +@@ -2933,8 +2937,10 @@ + #if BUILDFLAG(ENABLE_RUNTIME_MEDIA_RENDERER_SELECTION) + switches::kDisableMojoRenderer, + #endif ++#if !defined(OS_LINUX) || defined(OS_CHROMEOS) + switches::kDisableWebRtcHWDecoding, + switches::kDisableWebRtcHWEncoding, ++#endif + switches::kEnableWebRtcSrtpAesGcm, + switches::kEnableWebRtcSrtpEncryptedHeaders, + switches::kEnableWebRtcStunOrigin, +Only in content/browser/renderer_host: render_process_host_impl.cc.orig +diff -ur content/browser/utility_process_host.cc chromium-69.0.3497.92/content/browser/utility_process_host.cc +--- content/browser/utility_process_host.cc 2018-09-12 00:39:41.000000000 +0530 ++++ content/browser/utility_process_host.cc 2018-09-13 22:10:34.296005227 +0530 +@@ -296,7 +296,11 @@ + switches::kOverrideUseSoftwareGLForTests, + switches::kOverrideEnabledCdmInterfaceVersion, + switches::kProxyServer, ++#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_ANDROID) ++ switches::kEnableAcceleratedMjpegDecode, ++#else + switches::kDisableAcceleratedMjpegDecode, ++#endif + switches::kUseFakeDeviceForMediaStream, + switches::kUseFakeJpegDecodeAccelerator, + switches::kUseFileForFakeVideoCapture, +diff -ur content/browser/webrtc/webrtc_media_recorder_browsertest.cc chromium-69.0.3497.92/content/browser/webrtc/webrtc_media_recorder_browsertest.cc +--- content/browser/webrtc/webrtc_media_recorder_browsertest.cc 2018-09-12 00:39:41.000000000 +0530 ++++ content/browser/webrtc/webrtc_media_recorder_browsertest.cc 2018-09-13 22:10:34.143009916 +0530 +@@ -66,7 +66,12 @@ + return; + // This flag is also used for encoding, https://crbug.com/616640. + base::CommandLine::ForCurrentProcess()->AppendSwitch( +- switches::kDisableAcceleratedVideoDecode); ++#if defined(OS_LINUX) && !defined(OS_CHROMEOS) ++ switches::kEnableAcceleratedVideo ++#else ++ switches::kDisableAcceleratedVideoDecode ++#endif ++ ); + } + + private: +diff -ur content/gpu/BUILD.gn chromium-69.0.3497.92/content/gpu/BUILD.gn +--- content/gpu/BUILD.gn 2018-09-12 00:39:41.000000000 +0530 ++++ content/gpu/BUILD.gn 2018-09-13 22:10:34.148009763 +0530 +@@ -133,4 +133,8 @@ + (!is_chromecast || is_cast_desktop_build)) { + configs += [ "//build/config/linux/dri" ] + } ++ ++ if (is_desktop_linux) { ++ public_configs = [ "//media/gpu:libva_config" ] ++ } + } +diff -ur content/gpu/gpu_main.cc chromium-69.0.3497.92/content/gpu/gpu_main.cc +--- content/gpu/gpu_main.cc 2018-09-12 00:39:41.000000000 +0530 ++++ content/gpu/gpu_main.cc 2018-09-13 22:10:34.153009610 +0530 +@@ -284,7 +284,7 @@ + + base::PlatformThread::SetName("CrGpuMain"); + +-#if defined(OS_ANDROID) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) + // Set thread priority before sandbox initialization. + base::PlatformThread::SetCurrentThreadPriority(base::ThreadPriority::DISPLAY); + #endif +@@ -317,7 +317,7 @@ + GetContentClient()->SetGpuInfo(gpu_init->gpu_info()); + + base::ThreadPriority io_thread_priority = base::ThreadPriority::NORMAL; +-#if defined(OS_ANDROID) || defined(OS_CHROMEOS) ++#if defined(OS_LINUX) + io_thread_priority = base::ThreadPriority::DISPLAY; + #endif + +diff -ur content/public/browser/gpu_utils.cc chromium-69.0.3497.92/content/public/browser/gpu_utils.cc +--- content/public/browser/gpu_utils.cc 2018-09-12 00:39:42.000000000 +0530 ++++ content/public/browser/gpu_utils.cc 2018-09-13 22:10:34.164009273 +0530 +@@ -57,9 +57,17 @@ + gpu_preferences.in_process_gpu = + command_line->HasSwitch(switches::kInProcessGPU); + gpu_preferences.disable_accelerated_video_decode = ++#if defined(OS_LINUX) && !defined(OS_CHROMEOS) ++ !command_line->HasSwitch(switches::kEnableAcceleratedVideo); ++#else + command_line->HasSwitch(switches::kDisableAcceleratedVideoDecode); ++#endif + gpu_preferences.disable_accelerated_video_encode = ++#if defined(OS_LINUX) && !defined(OS_CHROMEOS) ++ !command_line->HasSwitch(switches::kEnableAcceleratedVideo); ++#else + command_line->HasSwitch(switches::kDisableAcceleratedVideoEncode); ++#endif + #if defined(OS_WIN) + uint32_t enable_accelerated_vpx_decode_val = + gpu::GpuPreferences::VPX_VENDOR_MICROSOFT; +diff -ur content/public/common/content_switches.cc chromium-69.0.3497.92/content/public/common/content_switches.cc +--- content/public/common/content_switches.cc 2018-09-12 00:39:42.000000000 +0530 ++++ content/public/common/content_switches.cc 2018-09-13 22:10:34.172009028 +0530 +@@ -79,6 +79,11 @@ + // Disable gpu-accelerated 2d canvas. + const char kDisableAccelerated2dCanvas[] = "disable-accelerated-2d-canvas"; + ++#if defined(OS_LINUX) ++// Enables hardware acceleration of video for Linux only. VA-API driver ++// is required to be present on the system installation. ++const char kEnableAcceleratedVideo[] = "enable-accelerated-video"; ++#endif + // Disables hardware acceleration of video decode, where available. + const char kDisableAcceleratedVideoDecode[] = + "disable-accelerated-video-decode"; +@@ -868,11 +873,13 @@ + // ignores this switch on its stable and beta channels. + const char kDisableWebRtcEncryption[] = "disable-webrtc-encryption"; + ++#if defined(OS_CHROMEOS) + // Disables HW decode acceleration for WebRTC. + const char kDisableWebRtcHWDecoding[] = "disable-webrtc-hw-decoding"; + + // Disables HW encode acceleration for WebRTC. + const char kDisableWebRtcHWEncoding[] = "disable-webrtc-hw-encoding"; ++#endif + + // Enables negotiation of GCM cipher suites from RFC 7714 for SRTP in WebRTC. + // See https://tools.ietf.org/html/rfc7714 for further information. +diff -ur content/public/common/content_switches.h chromium-69.0.3497.92/content/public/common/content_switches.h +--- content/public/common/content_switches.h 2018-09-12 00:39:42.000000000 +0530 ++++ content/public/common/content_switches.h 2018-09-13 22:10:34.172009028 +0530 +@@ -104,6 +104,9 @@ + CONTENT_EXPORT extern const char kDomAutomationController[]; + extern const char kDisable2dCanvasClipAntialiasing[]; + CONTENT_EXPORT extern const char kDumpBlinkRuntimeCallStats[]; ++#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_ANDROID) ++CONTENT_EXPORT extern const char kEnableAcceleratedVideo[]; ++#endif + CONTENT_EXPORT extern const char kEnableAccessibilityObjectModel[]; + CONTENT_EXPORT extern const char kEnableAggressiveDOMStorageFlushing[]; + CONTENT_EXPORT extern const char kEnableAutomation[]; +@@ -241,8 +244,10 @@ + CONTENT_EXPORT extern const char kWaitForDebuggerChildren[]; + + CONTENT_EXPORT extern const char kDisableWebRtcEncryption[]; ++#if defined(OS_CHROMEOS) + CONTENT_EXPORT extern const char kDisableWebRtcHWDecoding[]; + CONTENT_EXPORT extern const char kDisableWebRtcHWEncoding[]; ++#endif + CONTENT_EXPORT extern const char kEnableWebRtcSrtpAesGcm[]; + CONTENT_EXPORT extern const char kEnableWebRtcSrtpEncryptedHeaders[]; + CONTENT_EXPORT extern const char kEnableWebRtcStunOrigin[]; +diff -ur content/renderer/media/webrtc/peer_connection_dependency_factory.cc chromium-69.0.3497.92/content/renderer/media/webrtc/peer_connection_dependency_factory.cc +--- content/renderer/media/webrtc/peer_connection_dependency_factory.cc 2018-09-12 00:39:42.000000000 +0530 ++++ content/renderer/media/webrtc/peer_connection_dependency_factory.cc 2018-09-13 22:10:34.181008752 +0530 +@@ -276,10 +276,18 @@ + + const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); + if (gpu_factories && gpu_factories->IsGpuVideoAcceleratorEnabled()) { ++#if defined(OS_LINUX) && !defined(OS_CHROMEOS) ++ if (cmd_line->HasSwitch(switches::kEnableAcceleratedVideo)) ++#else + if (!cmd_line->HasSwitch(switches::kDisableWebRtcHWDecoding)) ++#endif + decoder_factory.reset(new RTCVideoDecoderFactory(gpu_factories)); + ++#if defined(OS_LINUX) && !defined(OS_CHROMEOS) ++ if (cmd_line->HasSwitch(switches::kEnableAcceleratedVideo)) ++#else + if (!cmd_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) ++#endif + encoder_factory.reset(new RTCVideoEncoderFactory(gpu_factories)); + } + +diff -ur content/renderer/render_thread_impl.cc chromium-69.0.3497.92/content/renderer/render_thread_impl.cc +--- content/renderer/render_thread_impl.cc 2018-09-12 00:39:42.000000000 +0530 ++++ content/renderer/render_thread_impl.cc 2018-09-13 22:10:34.192008415 +0530 +@@ -1441,7 +1441,11 @@ + kGpuStreamPriorityMedia); + + const bool enable_video_accelerator = ++#if defined(OS_LINUX) && !defined(OS_CHROMEOS) ++ cmd_line->HasSwitch(switches::kEnableAcceleratedVideo) && ++#else + !cmd_line->HasSwitch(switches::kDisableAcceleratedVideoDecode) && ++#endif + (gpu_channel_host->gpu_feature_info() + .status_values[gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE] == + gpu::kGpuFeatureStatusEnabled); +Only in content/renderer: render_thread_impl.cc.orig +diff -ur gpu/config/software_rendering_list.json chromium-69.0.3497.92/gpu/config/software_rendering_list.json +--- gpu/config/software_rendering_list.json 2018-09-12 00:39:44.000000000 +0530 ++++ gpu/config/software_rendering_list.json 2018-09-13 22:10:34.193008384 +0530 +@@ -377,17 +377,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], +diff -ur media/base/media_switches.cc chromium-69.0.3497.92/media/base/media_switches.cc +--- media/base/media_switches.cc 2018-09-12 00:39:48.000000000 +0530 ++++ media/base/media_switches.cc 2018-09-13 22:10:34.214007740 +0530 +@@ -117,10 +117,15 @@ + // accelerator hardware to be present. + const char kUseFakeJpegDecodeAccelerator[] = "use-fake-jpeg-decode-accelerator"; + ++#if defined(OS_LINUX) && !defined(OS_CHROMEOS) ++// Enable hardware accelerated mjpeg decode on linux ++const char kEnableAcceleratedMjpegDecode[] = "enable-accelerated-mjpeg-decode"; ++#else + // Disable hardware acceleration of mjpeg decode for captured frame, where + // available. + const char kDisableAcceleratedMjpegDecode[] = + "disable-accelerated-mjpeg-decode"; ++#endif + + // When running tests on a system without the required hardware or libraries, + // this flag will cause the tests to fail. Otherwise, they silently succeed. +@@ -462,15 +467,22 @@ + #endif + + bool IsVideoCaptureAcceleratedJpegDecodingEnabled() { ++ ++#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_ANDROID) ++ if (!base::CommandLine::ForCurrentProcess()->HasSwitch( ++ switches::kEnableAcceleratedMjpegDecode) ++#else + if (base::CommandLine::ForCurrentProcess()->HasSwitch( +- switches::kDisableAcceleratedMjpegDecode)) { ++ switches::kDisableAcceleratedMjpegDecode) ++#endif ++ ) { + return false; + } + if (base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kUseFakeJpegDecodeAccelerator)) { + return true; + } +-#if defined(OS_CHROMEOS) ++#if !defined(OS_ANDROID) && defined(OS_LINUX) + return true; + #endif + return false; +diff -ur media/base/media_switches.h chromium-69.0.3497.92/media/base/media_switches.h +--- media/base/media_switches.h 2018-09-12 00:39:48.000000000 +0530 ++++ media/base/media_switches.h 2018-09-13 22:10:34.283005625 +0530 +@@ -66,7 +66,11 @@ + MEDIA_EXPORT extern const char kUseFileForFakeVideoCapture[]; + MEDIA_EXPORT extern const char kUseFileForFakeAudioCapture[]; + MEDIA_EXPORT extern const char kUseFakeJpegDecodeAccelerator[]; ++#if defined(OS_LINUX) && !defined(OS_CHROMEOS) ++MEDIA_EXPORT extern const char kEnableAcceleratedMjpegDecode[]; ++#else + MEDIA_EXPORT extern const char kDisableAcceleratedMjpegDecode[]; ++#endif + + MEDIA_EXPORT extern const char kRequireAudioHardwareForTesting[]; + MEDIA_EXPORT extern const char kMuteAudio[]; +diff -ur media/gpu/BUILD.gn chromium-69.0.3497.92/media/gpu/BUILD.gn +--- media/gpu/BUILD.gn 2018-09-12 00:39:48.000000000 +0530 ++++ media/gpu/BUILD.gn 2018-09-13 22:10:34.210007863 +0530 +@@ -495,6 +495,14 @@ + } + } + ++if (is_desktop_linux && use_vaapi) { ++ import("//build/config/linux/pkg_config.gni") ++ ++ pkg_config("libva_config") { ++ packages = [ "libva" ] ++ } ++} ++ + if (use_vaapi) { + test("jpeg_encode_accelerator_unittest") { + deps = [ +@@ -559,6 +567,10 @@ + if (use_ozone) { + deps += [ "//ui/ozone" ] + } ++ ++ if (is_desktop_linux) { ++ public_configs = [ ":libva_config" ] ++ } + } + } + diff --git a/community/chromium/chromium-i686-vaapi-fpermissive.patch b/community/chromium/chromium-i686-vaapi-fpermissive.patch new file mode 100644 index 0000000000..a099f5fac5 --- /dev/null +++ b/community/chromium/chromium-i686-vaapi-fpermissive.patch @@ -0,0 +1,23 @@ +--- media/gpu/vaapi/BUILD.gn.i686permissive 2018-11-29 09:27:02.405909871 -0500 ++++ media/gpu/vaapi/BUILD.gn 2018-11-29 09:29:50.648259696 -0500 +@@ -10,6 +10,11 @@ import("//ui/ozone/ozone.gni") + + assert(use_vaapi) + ++config("vaapi_permissive") { ++ cflags = [ "-fpermissive" ] ++} ++ ++ + action("libva_generate_stubs") { + extra_header = "va_stub_header.fragment" + +@@ -98,6 +103,8 @@ source_set("vaapi") { + "//third_party/libyuv", + ] + ++ configs += [ ":vaapi_permissive" ] ++ + if (use_x11) { + configs += [ "//build/config/linux:x11" ] + deps += [ "//ui/gfx/x" ] -- cgit v1.2.3