Hello community, here is the log from the commit of package chromium for openSUSE:Factory checked in at 2018-04-11 13:57:11 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/chromium (Old) and /work/SRC/openSUSE:Factory/.chromium.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "chromium" Wed Apr 11 13:57:11 2018 rev:183 rq:594640 version:65.0.3325.181 Changes: -------- --- /work/SRC/openSUSE:Factory/chromium/chromium.changes 2018-03-22 12:11:17.676388224 +0100 +++ /work/SRC/openSUSE:Factory/.chromium.new/chromium.changes 2018-04-11 13:57:24.480744781 +0200 @@ -1,0 +2,12 @@ +Sun Apr 8 10:49:06 UTC 2018 - [email protected] + +- Add vaapi patches: + * chromium-vaapi-init.patch + * chromium-vaapi.patch + +------------------------------------------------------------------- +Fri Apr 6 12:54:24 UTC 2018 - [email protected] + +- Use memory-constraints package to limit threads as needed + +------------------------------------------------------------------- New: ---- chromium-vaapi-init.patch chromium-vaapi.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ chromium.spec ++++++ --- /var/tmp/diff_new_pack.GljNlv/_old 2018-04-11 13:57:33.836406503 +0200 +++ /var/tmp/diff_new_pack.GljNlv/_new 2018-04-11 13:57:33.840406358 +0200 @@ -40,7 +40,7 @@ Summary: Google's open source browser project License: BSD-3-Clause AND LGPL-2.1-or-later Group: Productivity/Networking/Web/Browsers -Url: http://code.google.com/p/chromium/ +URL: http://code.google.com/p/chromium/ Source0: http://commondatastorage.googleapis.com/chromium-browser-official/%{rname}-%{version}.tar.xz # Toolchain definitions Source1: BUILD.gn @@ -69,6 +69,10 @@ Patch14: chromium-buildname.patch Patch17: chromium-non-void-return.patch Patch18: chromium-drm.patch +# Google seem not too keen on merging this but GPU accel is quite important +# https://chromium-review.googlesource.com/c/chromium/src/+/532294 +Patch100: chromium-vaapi-init.patch +Patch101: chromium-vaapi.patch # GN buildsystem related patches Patch200: chromium-last-commit-position-r0.patch Patch201: fix-gn-bootstrap.diff @@ -92,6 +96,7 @@ BuildRequires: libjpeg-devel >= 8.1 BuildRequires: libpng-devel BuildRequires: libva-devel +BuildRequires: memory-constraints BuildRequires: ncurses-devel BuildRequires: ninja >= 1.7.2 BuildRequires: pam-devel @@ -117,9 +122,6 @@ BuildRequires: pkgconfig(gnome-keyring-1) BuildRequires: pkgconfig(gtk+-2.0) BuildRequires: pkgconfig(gtk+-3.0) -%if %{with system_harfbuzz} -BuildRequires: pkgconfig(harfbuzz) >= 1.7.0 -%endif BuildRequires: pkgconfig(hunspell) BuildRequires: pkgconfig(imlib2) BuildRequires: pkgconfig(jack) @@ -191,6 +193,9 @@ Obsoletes: chromium-ffmpegsumo # no 32bit supported and it takes ages to build ExcludeArch: %{arm} aarch64 i586 ppc ppc64 ppc64le +%if %{with system_harfbuzz} +BuildRequires: pkgconfig(harfbuzz) >= 1.7.0 +%endif %if 0%{?suse_version} >= 1330 BuildRequires: nodejs8 %else @@ -258,6 +263,10 @@ %patch17 -p1 %patch18 -p1 +# vaapi +%patch100 -p1 +%patch101 -p1 + # Copy the toolchain settings mkdir toolchain cp %{SOURCE1} toolchain/BUILD.gn @@ -459,18 +468,7 @@ %endif %endif # do not eat all memory -ninjaproc="%{?jobs:%{jobs}}" -echo "Available memory:" -cat /proc/meminfo -echo "System limits:" -ulimit -a -if test -n "$ninjaproc" -a "$ninjaproc" -gt 1 ; then - mem_per_process=1600000 - max_mem=$(awk '/MemTotal/ { print $2 }' /proc/meminfo) - max_jobs="$(($max_mem / $mem_per_process))" - test "$ninjaproc" -gt "$max_jobs" && ninjaproc="$max_jobs" && echo "Warning: Reducing number of jobs to $max_jobs because of memory limits" - test "$ninjaproc" -le 0 && ninjaproc=1 && echo "Warning: Do not use the parallel build at all becuse of memory limits" -fi +%limit_build -m 1600 # Set system libraries to be used gn_system_libraries=( @@ -580,7 +578,7 @@ # https://bugs.chromium.org/p/chromium/issues/detail?id=642016 out/Release/gn gen --args="${myconf_gn}" out/Release -ninja -v -j $ninjaproc -C out/Release chrome chrome_sandbox chromedriver +ninja -v %{?_smp_mflags} -C out/Release chrome chrome_sandbox chromedriver %install mkdir -p %{buildroot}%{_libdir}/chromium @@ -664,7 +662,8 @@ %files %verify(not mode) %{_libexecdir}/chrome_sandbox -%doc AUTHORS LICENSE +%license LICENSE +%doc AUTHORS %config %{_sysconfdir}/chromium %config(noreplace) %{_sysconfdir}/default/chromium %dir %{_datadir}/gnome-control-center ++++++ chromium-vaapi-init.patch ++++++ >From 281edc278272f0650fc190c8539d443ac59157bc Mon Sep 17 00:00:00 2001 From: Daniel Charles <[email protected]> Date: Thu, 08 Feb 2018 02:36:51 +0000 Subject: [PATCH] vaapi initialization: move it to vaapi_wrapper vaapi loading of libraries happens on the Pre and Post Sandbox functions. Moving dynamic loading of libaries, i.e. libva,libva-drm and i965_drv_video shared libraries to vaapi_wrapper. When calling PreSandbox function in vaapi_wrapper libva will open i965_drv_video shared library and both will be available for use BUG=785117 TEST=video initialization of h/w dec/enc, VAVDA/VAVEA/VAJDA subjective testing and include unittests and autotests Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel Change-Id: I862bb49f1167d7437e80387882cb9081ad53f54b Signed-off-by: Daniel Charles <[email protected]> Reviewed-on: https://chromium-review.googlesource.com/666138 Commit-Queue: Miguel Casas <[email protected]> Reviewed-by: Kenneth Russell <[email protected]> Reviewed-by: Antoine Labour <[email protected]> Reviewed-by: Dongseong Hwang <[email protected]> Reviewed-by: Pawel Osciak <[email protected]> Reviewed-by: Jorge Lucangeli Obes <[email protected]> Cr-Commit-Position: refs/heads/master@{#535274} --- diff --git a/content/gpu/gpu_sandbox_hook_linux.cc b/content/gpu/gpu_sandbox_hook_linux.cc index e69e23e..5c4013c 100644 --- a/content/gpu/gpu_sandbox_hook_linux.cc +++ b/content/gpu/gpu_sandbox_hook_linux.cc @@ -29,10 +29,6 @@ #include "services/service_manager/sandbox/linux/bpf_gpu_policy_linux.h" #include "services/service_manager/sandbox/linux/sandbox_linux.h" -#if BUILDFLAG(USE_VAAPI) -#include <va/va_version.h> -#endif - using sandbox::bpf_dsl::Policy; using sandbox::syscall_broker::BrokerFilePermission; using sandbox::syscall_broker::BrokerProcess; @@ -48,22 +44,6 @@ #endif } -inline bool IsArchitectureX86_64() { -#if defined(__x86_64__) - return true; -#else - return false; -#endif -} - -inline bool IsArchitectureI386() { -#if defined(__i386__) - return true; -#else - return false; -#endif -} - inline bool IsArchitectureArm() { #if defined(ARCH_CPU_ARM_FAMILY) return true; @@ -88,14 +68,6 @@ #endif } -inline bool IsLibVAVersion2() { -#if BUILDFLAG(USE_VAAPI) && VA_MAJOR_VERSION == 1 - return true; -#else - return false; -#endif -} - constexpr int dlopen_flag = RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE; void AddV4L2GpuWhitelist( @@ -270,50 +242,6 @@ } } -void LoadStandardLibraries( - const service_manager::SandboxSeccompBPF::Options& options) { - if (IsArchitectureX86_64() || IsArchitectureI386()) { - // Accelerated video dlopen()'s some shared objects - // inside the sandbox, so preload them now. - if (IsAcceleratedVideoEnabled(options)) { - if (IsLibVAVersion2()) { - if (IsArchitectureX86_64()) { - dlopen("/usr/lib64/va/drivers/i965_drv_video.so", dlopen_flag); - dlopen("/usr/lib64/va/drivers/hybrid_drv_video.so", dlopen_flag); - } else if (IsArchitectureI386()) { - dlopen("/usr/lib/va/drivers/i965_drv_video.so", dlopen_flag); - } - dlopen("libva.so.2", dlopen_flag); -#if defined(USE_OZONE) - dlopen("libva-drm.so.2", dlopen_flag); -#endif - } else { - // If we are linked against libva 1, we have two cases to handle: - // - the sysroot includes both libva 1 and 2, in which case the drivers - // are in /usr/lib{64}/va1/ - // - the sysroot only includes libva 1, in which case the drivers are - // are in /usr/lib{64}/va/ - // This is ugly, but temporary until all builds have switched to libva 2. - if (IsArchitectureX86_64()) { - if (!dlopen("/usr/lib64/va1/drivers/i965_drv_video.so", dlopen_flag)) - dlopen("/usr/lib64/va/drivers/i965_drv_video.so", dlopen_flag); - if (!dlopen("/usr/lib64/va1/drivers/hybrid_drv_video.so", dlopen_flag)) - dlopen("/usr/lib64/va/drivers/hybrid_drv_video.so", dlopen_flag); - } else if (IsArchitectureI386()) { - if (!dlopen("/usr/lib/va1/drivers/i965_drv_video.so", dlopen_flag)) - dlopen("/usr/lib/va/drivers/i965_drv_video.so", dlopen_flag); - } - dlopen("libva.so.1", dlopen_flag); -#if defined(USE_OZONE) - dlopen("libva-drm.so.1", dlopen_flag); -#elif defined(USE_X11) - dlopen("libva-x11.so.1", dlopen_flag); -#endif - } - } - } -} - bool LoadLibrariesForGpu( const service_manager::SandboxSeccompBPF::Options& options) { if (IsChromeOS()) { @@ -326,7 +254,6 @@ if (options.use_amd_specific_policies) return LoadAmdGpuLibraries(); } - LoadStandardLibraries(options); return true; } diff --git a/media/gpu/vaapi/vaapi_wrapper.cc b/media/gpu/vaapi/vaapi_wrapper.cc index bc3d735..7421a74 100644 --- a/media/gpu/vaapi/vaapi_wrapper.cc +++ b/media/gpu/vaapi/vaapi_wrapper.cc @@ -48,6 +48,11 @@ using media_gpu_vaapi::kModuleVa_x11; #endif using media_gpu_vaapi::InitializeStubs; +using media_gpu_vaapi::IsVaInitialized; +#if defined(USE_X11) +using media_gpu_vaapi::IsVa_x11Initialized; +#endif +using media_gpu_vaapi::IsVa_drmInitialized; using media_gpu_vaapi::StubPathMap; #define LOG_VA_ERROR_AND_REPORT(va_error, err_msg) \ @@ -166,9 +171,6 @@ void SetDrmFd(base::PlatformFile fd) { drm_fd_.reset(HANDLE_EINTR(dup(fd))); } private: - // Returns false on init failure. - static bool PostSandboxInitialization(); - // Protected by |va_lock_|. int refcount_; @@ -203,41 +205,17 @@ VADisplayState::Get()->SetDrmFd(drm_file.GetPlatformFile()); } -// static -bool VADisplayState::PostSandboxInitialization() { - const std::string va_suffix(std::to_string(VA_MAJOR_VERSION + 1)); - StubPathMap paths; - - paths[kModuleVa].push_back(std::string("libva.so.") + va_suffix); - paths[kModuleVa_drm].push_back(std::string("libva-drm.so.") + va_suffix); -#if defined(USE_X11) - // libva-x11 does not exist on libva >= 2 - if (VA_MAJOR_VERSION == 0) - paths[kModuleVa_x11].push_back("libva-x11.so.1"); -#endif - - const bool success = InitializeStubs(paths); - if (!success) { - static const char kErrorMsg[] = "Failed to initialize VAAPI libs"; -#if defined(OS_CHROMEOS) - // When Chrome runs on Linux with target_os="chromeos", do not log error - // message without VAAPI libraries. - LOG_IF(ERROR, base::SysInfo::IsRunningOnChromeOS()) << kErrorMsg; -#else - DVLOG(1) << kErrorMsg; -#endif - } - return success; -} - VADisplayState::VADisplayState() : refcount_(0), va_display_(nullptr), va_initialized_(false) {} bool VADisplayState::Initialize() { va_lock_.AssertAcquired(); - static bool result = PostSandboxInitialization(); - if (!result) + if (!IsVaInitialized() || +#if defined(USE_X11) + !IsVa_x11Initialized() || +#endif + !IsVa_drmInitialized()) return false; if (refcount_++ > 0) @@ -1169,6 +1147,38 @@ // static void VaapiWrapper::PreSandboxInitialization() { VADisplayState::PreSandboxInitialization(); + + const std::string va_suffix(std::to_string(VA_MAJOR_VERSION + 1)); + StubPathMap paths; + + paths[kModuleVa].push_back(std::string("libva.so.") + va_suffix); + paths[kModuleVa_drm].push_back(std::string("libva-drm.so.") + va_suffix); +#if defined(USE_X11) + paths[kModuleVa_x11].push_back(std::string("libva-x11.so.") + va_suffix); +#endif + + // InitializeStubs dlopen() VA-API libraries + // libva.so + // libva-x11.so (X11) + // libva-drm.so (X11 and Ozone). + static bool result = InitializeStubs(paths); + if (!result) { + static const char kErrorMsg[] = "Failed to initialize VAAPI libs"; +#if defined(OS_CHROMEOS) + // When Chrome runs on Linux with target_os="chromeos", do not log error + // message without VAAPI libraries. + LOG_IF(ERROR, base::SysInfo::IsRunningOnChromeOS()) << kErrorMsg; +#else + DVLOG(1) << kErrorMsg; +#endif + } + + // VASupportedProfiles::Get creates VADisplayState and in so doing + // driver associated libraries are dlopen(), to know: + // i965_drv_video.so + // hybrid_drv_video.so (platforms that support it) + // libcmrt.so (platforms that support it) + VASupportedProfiles::Get(); } VaapiWrapper::VaapiWrapper() ++++++ chromium-vaapi.patch ++++++ >From 4bf343ab8c4a538205f9c1e96a661e40620c716b Mon Sep 17 00:00:00 2001 From: Daniel Charles <[email protected]> Date: Fri, 09 Feb 2018 14:39:27 -0800 Subject: [PATCH] Enable VAVDA, VAVEA and VAJDA on linux with VAAPI only This patch contains all the changes necessary to use VA-API along with vaapi-driver to run all media use cases supported with hardware acceleration. It is intended to remain as experimental accessible from chrome://flags on linux. It requires libva/intel-vaapi-driver to be installed on the system path where chrome is executed. Other drivers could be tested if available. Flags are kept independent for linux, where this feature has to be enabled before actually using it. This should not change how other OSes use the flags already, the new flags will show at the buttom on the section of unavailable experiments The changes cover a range of compiler pre-processor flags to enable the stack. It moves the presandbox operations to the vaapi_wrapper class as the hook function is available there. vaInit will open driver on the correct installed folder. chrome flags consolidtation into only two flags for linux. Mjpeg and accelerated video are used. The other flags are kept for ChromeOS and other OSes. Developer testing was made on skylake hardware, ChromeOS and Ubuntu. BUG=NONE TEST=subjective testing with VAVDA,VAVEA and VAJDA, autotest for encoder and decoder hardware accelerated have libva/intel-vaapi-driver installed and not installed in the system repeat on different hardware families Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel Change-Id: Ifbbf5c9e5221a8b5733fc6d4d0cf984a1f103171 Signed-off-by: Daniel Charles <[email protected]> --- --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc @@ -1249,12 +1249,14 @@ const FeatureEntry kFeatureEntries[] = { flag_descriptions::kUiPartialSwapDescription, kOsAll, SINGLE_DISABLE_VALUE_TYPE(switches::kUIDisablePartialSwap)}, #if BUILDFLAG(ENABLE_WEBRTC) +#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, @@ -1550,6 +1552,13 @@ const FeatureEntry kFeatureEntries[] = { 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, @@ -1557,6 +1566,7 @@ const FeatureEntry kFeatureEntries[] = { kOsMac | kOsWin | kOsCrOS | kOsAndroid, SINGLE_DISABLE_VALUE_TYPE(switches::kDisableAcceleratedVideoDecode), }, +#endif #if defined(OS_WIN) {"enable-hdr", flag_descriptions::kEnableHDRName, flag_descriptions::kEnableHDRDescription, kOsWin, @@ -2268,12 +2278,17 @@ const FeatureEntry kFeatureEntries[] = { 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)}, --- a/chrome/browser/chromeos/login/chrome_restart_request.cc +++ b/chrome/browser/chromeos/login/chrome_restart_request.cc @@ -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 @@ void DeriveCommandLine(const GURL& start ::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::kDisableDistanceFieldText, @@ -164,7 +170,7 @@ void DeriveCommandLine(const GURL& start ::switches::kDisableWebGLImageChromium, ::switches::kEnableWebGLImageChromium, ::switches::kEnableWebVR, -#if BUILDFLAG(ENABLE_WEBRTC) +#if BUILDFLAG(ENABLE_WEBRTC) && (defined(OS_CHROMEOS) || defined(OS_ANDROID)) ::switches::kDisableWebRtcHWDecoding, ::switches::kDisableWebRtcHWEncoding, #endif --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc @@ -14,6 +14,13 @@ const char kAccelerated2dCanvasDescripti "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."; @@ -1597,6 +1604,7 @@ const char kWebrtcEchoCanceller3Name[] = 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."; @@ -1604,6 +1612,7 @@ const char kWebrtcHwDecodingDescription[ 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[] = @@ -2434,14 +2443,16 @@ const char kTranslateNewUxDescription[] // 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."; --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h @@ -37,6 +37,10 @@ namespace flag_descriptions { 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[]; @@ -1498,13 +1502,17 @@ extern const char kPermissionPromptPersi #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[]; --- a/content/browser/gpu/compositor_util.cc +++ b/content/browser/gpu/compositor_util.cc @@ -98,7 +98,11 @@ const GpuFeatureData GetGpuFeatureData(s {"video_decode", manager->GetFeatureStatus( 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}, --- a/content/browser/gpu/gpu_process_host.cc +++ b/content/browser/gpu/gpu_process_host.cc @@ -120,7 +120,7 @@ static const char* const kSwitchNames[] switches::kDisableGLExtensions, switches::kDisableLogging, switches::kDisableShaderNameHashing, -#if BUILDFLAG(ENABLE_WEBRTC) +#if BUILDFLAG(ENABLE_WEBRTC) && !defined(OS_LINUX) switches::kDisableWebRtcHWEncoding, #endif #if defined(OS_WIN) --- a/content/browser/renderer_host/media/video_capture_browsertest.cc +++ b/content/browser/renderer_host/media/video_capture_browsertest.cc @@ -164,8 +164,13 @@ class VideoCaptureBrowserTest : public C 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 } } --- a/content/browser/renderer_host/media/video_capture_gpu_jpeg_decoder.cc +++ b/content/browser/renderer_host/media/video_capture_gpu_jpeg_decoder.cc @@ -65,15 +65,21 @@ void VideoCaptureGpuJpegDecoder::Initial bool is_platform_supported = base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kUseFakeJpegDecodeAccelerator); -#if defined(OS_CHROMEOS) - // Non-ChromeOS platforms do not support HW JPEG decode now. Do not establish - // gpu channel to avoid introducing overhead. +#if !defined(OS_ANDROID) && defined(OS_LINUX) + // Non-ChromeOS or Non-Linux platforms do not support HW JPEG decode now. Do + // not establish gpu channel to avoid introducing overhead. is_platform_supported = true; #endif if (!is_platform_supported || +#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_ANDROID) + !base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kEnableAcceleratedMjpegDecode) +#else base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kDisableAcceleratedMjpegDecode)) { + switches::kDisableAcceleratedMjpegDecode) +#endif + ) { decoder_status_ = FAILED; RecordInitDecodeUMA_Locked(); return; --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc @@ -2530,7 +2530,11 @@ void RenderProcessHostImpl::PropagateBro switches::kDefaultTileHeight, switches::kDisable2dCanvasImageChromium, switches::kDisableAcceleratedJpegDecoding, +#if defined(OS_LINUX) && !defined(OS_CHROMEOS) + switches::kEnableAcceleratedVideo, +#else switches::kDisableAcceleratedVideoDecode, +#endif switches::kDisableBackgroundTimerThrottling, switches::kDisableBreakpad, switches::kDisableCompositorUkmForTests, @@ -2663,8 +2667,10 @@ void RenderProcessHostImpl::PropagateBro switches::kDisableMojoRenderer, #endif #if BUILDFLAG(ENABLE_WEBRTC) +#if !defined(OS_LINUX) || defined(OS_CHROMEOS) switches::kDisableWebRtcHWDecoding, switches::kDisableWebRtcHWEncoding, +#endif switches::kEnableWebRtcSrtpAesGcm, switches::kEnableWebRtcSrtpEncryptedHeaders, switches::kEnableWebRtcStunOrigin, --- a/content/browser/webrtc/webrtc_media_recorder_browsertest.cc +++ b/content/browser/webrtc/webrtc_media_recorder_browsertest.cc @@ -58,7 +58,12 @@ class WebRtcMediaRecorderTest 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: --- a/content/gpu/BUILD.gn +++ b/content/gpu/BUILD.gn @@ -125,4 +125,8 @@ target(link_target_type, "gpu_sources") if (is_desktop_linux && (!is_chromecast || is_cast_desktop_build)) { configs += [ "//build/config/linux/dri" ] } + + if (is_desktop_linux) { + public_configs = [ "//media/gpu:libva_config" ] + } } --- a/content/gpu/gpu_main.cc +++ b/content/gpu/gpu_main.cc @@ -273,7 +273,7 @@ int GpuMain(const MainFunctionParams& pa 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 @@ -302,7 +302,7 @@ int GpuMain(const MainFunctionParams& pa 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 --- a/content/public/browser/gpu_utils.cc +++ b/content/public/browser/gpu_utils.cc @@ -7,6 +7,7 @@ #include "base/command_line.h" #include "base/single_thread_task_runner.h" #include "base/strings/string_number_conversions.h" +#include "build/build_config.h" #include "content/browser/gpu/gpu_process_host.h" #include "content/public/common/content_features.h" #include "content/public/common/content_switches.h" @@ -55,10 +56,18 @@ const gpu::GpuPreferences GetGpuPreferen 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); -#if BUILDFLAG(ENABLE_WEBRTC) +#endif +#if BUILDFLAG(ENABLE_WEBRTC) && (defined(OS_CHROMEOS) || defined(OS_ANDROID)) gpu_preferences.disable_web_rtc_hw_encoding = command_line->HasSwitch(switches::kDisableWebRtcHWEncoding); #endif --- a/content/public/common/content_switches.cc +++ b/content/public/common/content_switches.cc @@ -78,12 +78,21 @@ const char kDisable3DAPIs[] // Disable gpu-accelerated 2d canvas. const char kDisableAccelerated2dCanvas[] = "disable-accelerated-2d-canvas"; - +#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 +#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"; @@ -888,11 +897,13 @@ const char kZygoteProcess[] // 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. --- a/content/public/common/content_switches.h +++ b/content/public/common/content_switches.h @@ -33,7 +33,11 @@ CONTENT_EXPORT extern const char kDisabl CONTENT_EXPORT extern const char kDisable3DAPIs[]; CONTENT_EXPORT extern const char kDisableAccelerated2dCanvas[]; CONTENT_EXPORT extern const char kDisableAcceleratedJpegDecoding[]; +#if defined(OS_LINUX) && !defined(OS_CHROMEOS) +CONTENT_EXPORT extern const char kEnableAcceleratedMjpegDecode[]; +#else CONTENT_EXPORT extern const char kDisableAcceleratedMjpegDecode[]; +#endif CONTENT_EXPORT extern const char kDisableAcceleratedVideoDecode[]; CONTENT_EXPORT extern const char kDisableAcceleratedVideoEncode[]; CONTENT_EXPORT extern const char kDisableAudioSupportForDesktopShare[]; @@ -107,6 +111,9 @@ CONTENT_EXPORT extern const char kDisabl 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 kEnableAggressiveDOMStorageFlushing[]; CONTENT_EXPORT extern const char kEnableAutomation[]; CONTENT_EXPORT extern const char kEnablePreferCompositingToLCDText[]; @@ -244,8 +251,10 @@ CONTENT_EXPORT extern const char kZygote #if BUILDFLAG(ENABLE_WEBRTC) 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[]; --- a/content/renderer/media/webrtc/peer_connection_dependency_factory.cc +++ b/content/renderer/media/webrtc/peer_connection_dependency_factory.cc @@ -245,12 +245,19 @@ void PeerConnectionDependencyFactory::In 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 (!cmd_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) { +#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)); - } } #if defined(OS_ANDROID) --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc @@ -1485,7 +1485,11 @@ media::GpuVideoAcceleratorFactories* Ren scoped_refptr<base::SingleThreadTaskRunner> media_task_runner = GetMediaThreadTaskRunner(); 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); --- a/gpu/config/software_rendering_list.json +++ b/gpu/config/software_rendering_list.json @@ -373,17 +373,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], --- a/media/gpu/BUILD.gn +++ b/media/gpu/BUILD.gn @@ -24,6 +24,14 @@ if (is_mac) { import("//build/config/mac/mac_sdk.gni") } +if (is_desktop_linux && use_vaapi) { + import("//build/config/linux/pkg_config.gni") + + pkg_config("libva_config") { + packages = [ "libva" ] + } +} + if (use_vaapi) { action("libva_generate_stubs") { extra_header = "vaapi/va_stub_header.fragment" @@ -353,6 +361,10 @@ component("gpu") { if (use_ozone) { deps += [ "//ui/ozone" ] } + + if (is_desktop_linux) { + public_configs = [ ":libva_config" ] + } } if (is_win) {
