chromium: update to 55.0.2883.44

This commit is contained in:
Lukas Rusak 2016-11-29 09:18:11 -08:00
parent 222f750d79
commit eb7323b919
No known key found for this signature in database
GPG Key ID: 8C310C807E7393A3
6 changed files with 744 additions and 620 deletions

View File

@ -1,3 +1,6 @@
7.0.105
- Update to 55.0.2883.44
7.0.104
- Update to 53.0.2785.92

View File

@ -19,8 +19,8 @@
################################################################################
PKG_NAME="chromium"
PKG_VERSION="53.0.2785.92"
PKG_REV="104"
PKG_VERSION="55.0.2883.44"
PKG_REV="105"
PKG_ARCH="x86_64"
PKG_LICENSE="Mixed"
PKG_SITE="http://www.chromium.org/Home"
@ -39,21 +39,17 @@ PKG_ADDON_PROVIDES="executable"
PKG_ADDON_REPOVERSION="7.0"
pre_make_target() {
export MAKEFLAGS="-j4"
strip_lto
# https://groups.google.com/a/chromium.org/d/topic/chromium-packagers/9JX1N2nf4PU/discussion
touch chrome/test/data/webui/i18n_process_css_test.html
sed -i -e 's/@WIDEVINE_VERSION@/Pinkie Pie/' third_party/widevine/cdm/stub/widevine_cdm_version.h
}
make_target() {
# CFLAGS are passed through release_extra_cflags below
export -n CFLAGS CXXFLAGS
export LDFLAGS="$LDFLAGS -ludev"
export LD=$CXX
# Use Python 2
find . -name '*.py' -exec sed -i -r "s|/usr/bin/python$|$ROOT/$TOOLCHAIN/bin/python|g" {} +
# Google API keys (see http://www.chromium.org/developers/how-tos/api-keys)
# Note: These are for OpenELEC use ONLY. For your own distribution, please
@ -63,61 +59,66 @@ make_target() {
_google_default_client_id=740889307901-4bkm4e0udppnp1lradko85qsbnmkfq3b.apps.googleusercontent.com
_google_default_client_secret=9TJlhL661hvShQub4cWhANXa
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
-Dtarget_arch=x64
-Dfastbuild=2
-Dwerror=
-Dclang=0
-Dpython_ver=2.7
-Dlinux_link_gsettings=0
-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
-Dremove_webcore_debug_symbols=1
-Drelease_extra_cflags="$CFLAGS"
-Dlibspeechd_h_prefix=speech-dispatcher/
-Dffmpeg_branding=Chrome
-Dproprietary_codecs=1
-Duse_system_bzip2=1
-Duse_system_flac=0
-Duse_system_ffmpeg=0
-Duse_system_harfbuzz=1
-Duse_system_icu=0
-Duse_system_libevent=0
-Duse_system_libjpeg=1
-Duse_system_libpng=1
-Duse_system_libvpx=0
-Duse_system_libxml=0
-Duse_system_snappy=0
-Duse_system_xdg_utils=0
-Duse_system_yasm=1
-Duse_system_zlib=0
-Duse_mojo=0
-Duse_gconf=0
-Duse_gnome_keyring=0
-Duse_pulseaudio=0
-Duse_kerberos=0
-Duse_cups=0
-Denable_hangout_services_extension=1
-Ddisable_fatal_linker_warnings=1
-Dsysroot=$SYSROOT_PREFIX
-Ddisable_glibc=1
-Denable_widevine=1
-Ddisable_nacl=1
-Ddisable_pnacl=1)
local _flags=(
'is_clang=false'
'clang_use_chrome_plugins=false'
'symbol_level=0'
'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_allocator="none"'
'use_cups=false'
'use_gconf=false'
'use_gnome_keyring=false'
'use_gold=false'
'use_gtk3=false'
'use_kerberos=false'
'use_pulseaudio=false'
'use_sysroot=true'
"target_sysroot=\"${SYSROOT_PREFIX}\""
'enable_hangout_services_extension=true'
'enable_widevine=true'
'enable_nacl=false'
'enable_nacl_nonsfi=false'
"google_api_key=\"${_google_api_key}\""
"google_default_client_id=\"${_google_default_client_id}\""
"google_default_client_secret=\"${_google_default_client_secret}\""
)
./build/linux/unbundle/replace_gyp_files.py "${_chromium_conf[@]}"
./build/gyp_chromium --depth=. "${_chromium_conf[@]}"
# Possible replacements are listed in build/linux/unbundle/replace_gn_files.py
local _system_libs=(
harfbuzz-ng
libjpeg
libpng
libxslt
yasm
)
ninja -C out/Release chrome chrome_sandbox
# 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}; do
find -type f -path "*third_party/$_lib/*" \
\! -path "*third_party/$_lib/chromium/*" \
\! -path "*third_party/$_lib/google/*" \
\! -regex '.*\.\(gn\|gni\|isolate\|py\)' \
-delete
done
./build/linux/unbundle/replace_gn_files.py --system-libraries "${_system_libs}"
./third_party/libaddressinput/chromium/tools/update-strings.py
./tools/gn/bootstrap/bootstrap.py --gn-gen-args "${_flags[*]}"
./out/Release/gn gen out/Release --args="${_flags[*]}" --script-executable=$ROOT/$TOOLCHAIN/bin/python
ninja -C out/Release chrome chrome_sandbox widevinecdmadapter
}
makeinstall_target() {
@ -130,9 +131,9 @@ addon() {
cp -P $PKG_BUILD/out/Release/chrome_sandbox $ADDON_BUILD/$PKG_ADDON_ID/bin/chrome-sandbox
cp -P $PKG_BUILD/out/Release/{*.pak,*.dat,*.bin,libwidevinecdmadapter.so} $ADDON_BUILD/$PKG_ADDON_ID/bin
cp -PR $PKG_BUILD/out/Release/locales $ADDON_BUILD/$PKG_ADDON_ID/bin/
cp -PR $PKG_BUILD/out/Release/gen/content/content_resources.pak $ADDON_BUILD/$PKG_ADDON_ID/bin/
$STRIP $ADDON_BUILD/$PKG_ADDON_ID/bin/chromium.bin
$STRIP $ADDON_BUILD/$PKG_ADDON_ID/bin/chrome-sandbox
debug_strip $ADDON_BUILD/$PKG_ADDON_ID/bin
# config
mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/config
@ -153,7 +154,8 @@ addon() {
cp -PL $(get_build_dir gtk+)/.install_pkg/usr/lib/libgtk-x11-2.0.so.0 $ADDON_BUILD/$PKG_ADDON_ID/lib
# harfbuzz
cp -PL $(get_build_dir harfbuzz)/.install_pkg/usr/lib/libharfbuzz.so.0 $ADDON_BUILD/$PKG_ADDON_ID/lib
cp -PL $(get_build_dir harfbuzz)/.install_pkg/usr/lib/libharfbuzz.so* $ADDON_BUILD/$PKG_ADDON_ID/lib
cp -PL $(get_build_dir harfbuzz)/.install_pkg/usr/lib/libharfbuzz-icu.so* $ADDON_BUILD/$PKG_ADDON_ID/lib
# gdk-pixbuf
cp -PL $(get_build_dir gdk-pixbuf)/.install_pkg/usr/lib/libgdk_pixbuf-2.0.so.0 $ADDON_BUILD/$PKG_ADDON_ID/lib

View File

@ -0,0 +1,639 @@
Description: Enables using VA-API hardware acceleration in Linux. 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. The code in bpf_gpu_policy_linux.cc was then updated by Steven Newbury to support Nvidia drivers.
Index: dev/chrome/browser/about_flags.cc
===================================================================
--- dev.orig/chrome/browser/about_flags.cc
+++ dev/chrome/browser/about_flags.cc
@@ -947,7 +947,7 @@ const FeatureEntry kFeatureEntries[] = {
"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)
Index: dev/content/common/BUILD.gn
===================================================================
--- dev.orig/content/common/BUILD.gn
+++ dev/content/common/BUILD.gn
@@ -11,6 +11,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)
@@ -502,6 +545,15 @@ source_set("common") {
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 -= [
Index: dev/content/common/sandbox_linux/bpf_gpu_policy_linux.cc
===================================================================
--- dev.orig/content/common/sandbox_linux/bpf_gpu_policy_linux.cc
+++ dev/content/common/sandbox_linux/bpf_gpu_policy_linux.cc
@@ -24,6 +24,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"
@@ -35,6 +41,27 @@
#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 "third_party/libva/va/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;
@@ -43,6 +70,17 @@ using sandbox::syscall_broker::BrokerFil
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 {
@@ -97,7 +135,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 =
@@ -282,6 +320,32 @@ ResultExpr GpuProcessPolicy::EvaluateSys
}
}
+#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)
+ va_display = vaGetDisplayDRM(drm_fd_.get());
+#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.
@@ -295,32 +359,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;
}
Index: dev/content/common/va_wayland.sigs
===================================================================
--- /dev/null
+++ dev/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);
Index: dev/content/gpu/BUILD.gn
===================================================================
--- dev.orig/content/gpu/BUILD.gn
+++ dev/content/gpu/BUILD.gn
@@ -91,7 +91,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" ]
}
Index: dev/content/gpu/gpu_main.cc
===================================================================
--- dev.orig/content/gpu/gpu_main.cc
+++ dev/content/gpu/gpu_main.cc
@@ -79,7 +79,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
@@ -138,7 +138,7 @@ class ContentSandboxHelper : public gpu:
(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)
Index: dev/content/public/common/content_switches.cc
===================================================================
--- dev.orig/content/public/common/content_switches.cc
+++ dev/content/public/common/content_switches.cc
@@ -985,7 +985,9 @@ const char kDisableAudioSupportForDeskto
#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";
Index: dev/content/public/common/content_switches.h
===================================================================
--- dev.orig/content/public/common/content_switches.h
+++ dev/content/public/common/content_switches.h
@@ -288,6 +288,8 @@ CONTENT_EXPORT extern const char kEnable
#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
Index: dev/gpu/config/software_rendering_list_json.cc
===================================================================
--- dev.orig/gpu/config/software_rendering_list_json.cc
+++ dev/gpu/config/software_rendering_list_json.cc
@@ -415,17 +415,6 @@ const char kSoftwareRenderingListJson[]
]
},
{
- "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],
Index: dev/media/BUILD.gn
===================================================================
--- dev.orig/media/BUILD.gn
+++ dev/media/BUILD.gn
@@ -370,7 +370,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",
@@ -653,7 +653,7 @@ test("media_unittests") {
}
}
- if (current_cpu != "arm" && is_chromeos) {
+ if (current_cpu != "arm" && (is_chromeos || is_desktop_linux)) {
sources += [ "filters/h264_bitstream_buffer_unittest.cc" ]
}
Index: dev/media/gpu/BUILD.gn
===================================================================
--- dev.orig/media/gpu/BUILD.gn
+++ dev/media/gpu/BUILD.gn
@@ -12,7 +12,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"
@@ -238,7 +238,7 @@ component("gpu") {
}
}
- if (is_chromeos) {
+ if (is_linux) {
sources += [
"accelerated_video_decoder.h",
"h264_decoder.cc",
@@ -281,7 +281,7 @@ component("gpu") {
"GLESv2",
]
}
- if (current_cpu == "arm") {
+ if (current_cpu == "arm" && is_chromeos) {
sources += [
"tegra_v4l2_device.cc",
"tegra_v4l2_device.h",
Index: dev/media/gpu/gpu_video_decode_accelerator_factory.cc
===================================================================
--- dev.orig/media/gpu/gpu_video_decode_accelerator_factory.cc
+++ dev/media/gpu/gpu_video_decode_accelerator_factory.cc
@@ -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 @@ GpuVideoDecodeAcceleratorFactory::GetDec
#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();
@@ -131,7 +131,7 @@ GpuVideoDecodeAcceleratorFactory::Create
&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)
@@ -199,11 +199,12 @@ GpuVideoDecodeAcceleratorFactory::Create
}
#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_));
Index: dev/media/gpu/gpu_video_decode_accelerator_factory.h
===================================================================
--- dev.orig/media/gpu/gpu_video_decode_accelerator_factory.h
+++ dev/media/gpu/gpu_video_decode_accelerator_factory.h
@@ -98,7 +98,7 @@ class MEDIA_GPU_EXPORT GpuVideoDecodeAcc
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;
Index: dev/media/gpu/ipc/service/BUILD.gn
===================================================================
--- dev.orig/media/gpu/ipc/service/BUILD.gn
+++ dev/media/gpu/ipc/service/BUILD.gn
@@ -45,7 +45,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" ]
}
Index: dev/media/gpu/ipc/service/gpu_video_decode_accelerator.cc
===================================================================
--- dev.orig/media/gpu/ipc/service/gpu_video_decode_accelerator.cc
+++ dev/media/gpu/ipc/service/gpu_video_decode_accelerator.cc
@@ -58,7 +58,7 @@ static bool MakeDecoderContextCurrent(
return true;
}
-#if (defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY)) || defined(OS_MACOSX)
+#if ((defined(OS_LINUX) || defined(OS_CHROMEOS)) && 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 @@ GpuVideoDecodeAccelerator::GpuVideoDecod
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_LINUX) || defined(OS_CHROMEOS)) && 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());
Index: dev/media/gpu/va_stub_header.fragment
===================================================================
--- dev.orig/media/gpu/va_stub_header.fragment
+++ dev/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
}
Index: dev/media/gpu/vaapi_video_decode_accelerator.cc
===================================================================
--- dev.orig/media/gpu/vaapi_video_decode_accelerator.cc
+++ dev/media/gpu/vaapi_video_decode_accelerator.cc
@@ -359,17 +359,17 @@ bool VaapiVideoDecodeAccelerator::Initia
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;
}
@@ -379,7 +379,7 @@ bool VaapiVideoDecodeAccelerator::Initia
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;
}
@@ -394,7 +394,7 @@ bool VaapiVideoDecodeAccelerator::Initia
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;
}
Index: dev/media/gpu/vaapi_wrapper.cc
===================================================================
--- dev.orig/media/gpu/vaapi_wrapper.cc
+++ dev/media/gpu/vaapi_wrapper.cc
@@ -194,7 +194,7 @@ scoped_refptr<VaapiWrapper> VaapiWrapper
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 @@ VaapiWrapper::GetSupportedProfileInfosFo
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 @@ bool VaapiWrapper::IsEntrypointSupported
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 @@ bool VaapiWrapper::AreAttribsSupported_L
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;
}
}

View File

@ -1,554 +0,0 @@
From 0cc8e208feef2c49b8f2344005e97684b5e84012 Mon Sep 17 00:00:00 2001
From: Knut Andre Tidemann <Knut.Andre.Tidemann@jotron.com>
Date: Mon, 29 Aug 2016 20:57:27 +0200
Subject: [PATCH] Enable VAAPI on Linux.
---
content/content_gpu.gypi | 2 +-
content/public/common/content_switches.cc | 2 ++
content/public/common/content_switches.h | 3 +++
gpu/command_buffer/service/gpu_preferences.h | 2 +-
gpu/config/software_rendering_list_json.cc | 11 -----------
media/gpu/BUILD.gn | 10 +++++-----
media/gpu/gpu_video_decode_accelerator_factory_impl.cc | 12 ++++++------
media/gpu/gpu_video_decode_accelerator_factory_impl.h | 4 ++--
media/gpu/ipc/service/BUILD.gn | 2 +-
media/gpu/ipc/service/gpu_jpeg_decode_accelerator.cc | 6 +++---
media/gpu/ipc/service/gpu_video_decode_accelerator.cc | 4 ++--
media/gpu/ipc/service/gpu_video_encode_accelerator.cc | 10 +++++-----
media/gpu/ipc/service/gpu_video_encode_accelerator.h | 4 ++--
media/gpu/jpeg_decode_accelerator_unittest.cc | 8 ++++----
media/gpu/video_decode_accelerator_unittest.cc | 4 ++--
media/gpu/video_encode_accelerator_unittest.cc | 10 +++++-----
media/media.gyp | 12 ++++++------
media/media_gpu.gypi | 8 ++++----
18 files changed, 54 insertions(+), 60 deletions(-)
diff --git a/content/content_gpu.gypi b/content/content_gpu.gypi
index f2a21d9..f9df0e6 100644
--- a/content/content_gpu.gypi
+++ b/content/content_gpu.gypi
@@ -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 --git a/content/public/common/content_switches.cc b/content/public/common/content_switches.cc
index 244e371..48cdffb 100644
--- a/content/public/common/content_switches.cc
+++ b/content/public/common/content_switches.cc
@@ -970,7 +970,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";
diff --git a/content/public/common/content_switches.h b/content/public/common/content_switches.h
index be5cc9e..9585fb6 100644
--- a/content/public/common/content_switches.h
+++ b/content/public/common/content_switches.h
@@ -278,6 +278,9 @@ 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
diff --git a/gpu/command_buffer/service/gpu_preferences.h b/gpu/command_buffer/service/gpu_preferences.h
index 6fe15b0..ee31d3e 100644
--- a/gpu/command_buffer/service/gpu_preferences.h
+++ b/gpu/command_buffer/service/gpu_preferences.h
@@ -37,7 +37,7 @@ struct GPU_EXPORT GpuPreferences {
// 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 --git a/gpu/config/software_rendering_list_json.cc b/gpu/config/software_rendering_list_json.cc
index 9adc5f0..abf7bc5 100644
--- a/gpu/config/software_rendering_list_json.cc
+++ b/gpu/config/software_rendering_list_json.cc
@@ -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 --git a/media/gpu/BUILD.gn b/media/gpu/BUILD.gn
index ba02e8a..c31bae2 100644
--- a/media/gpu/BUILD.gn
+++ b/media/gpu/BUILD.gn
@@ -12,7 +12,7 @@ if (is_mac) {
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 && current_cpu != "arm") {
}
}
-if (is_chromeos && use_v4lplugin) {
+if ((is_chromeos || is_linux) && use_v4lplugin) {
action("libv4l2_generate_stubs") {
extra_header = "v4l2_stub_header.fragment"
@@ -229,7 +229,7 @@ component("gpu") {
}
}
- if (is_chromeos) {
+ if (is_chromeos || is_linux) {
sources += [
"accelerated_video_decoder.h",
"h264_decoder.cc",
@@ -356,7 +356,7 @@ component("gpu") {
}
}
-if (is_win || is_android || is_chromeos) {
+if (is_win || is_android || is_chromeos || is_linux) {
test("video_decode_accelerator_unittest") {
sources = [
"video_accelerator_unittest_helpers.h",
@@ -425,7 +425,7 @@ if (is_win || is_android || is_chromeos) {
}
}
-if (is_chromeos || is_mac) {
+if (is_chromeos || is_linux || is_mac) {
test("video_encode_accelerator_unittest") {
deps = [
"//base",
diff --git a/media/gpu/gpu_video_decode_accelerator_factory_impl.cc b/media/gpu/gpu_video_decode_accelerator_factory_impl.cc
index 0a1a883..add2a8e 100644
--- a/media/gpu/gpu_video_decode_accelerator_factory_impl.cc
+++ b/media/gpu/gpu_video_decode_accelerator_factory_impl.cc
@@ -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();
@@ -126,11 +126,11 @@ GpuVideoDecodeAcceleratorFactoryImpl::CreateVDA(
#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,7 +199,7 @@
}
#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,
diff --git a/media/gpu/gpu_video_decode_accelerator_factory_impl.h b/media/gpu/gpu_video_decode_accelerator_factory_impl.h
index a005a1c..5974972 100644
--- a/media/gpu/gpu_video_decode_accelerator_factory_impl.h
+++ b/media/gpu/gpu_video_decode_accelerator_factory_impl.h
@@ -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,7 +101,7 @@
const gpu::GpuDriverBugWorkarounds& workarounds,
const gpu::GpuPreferences& gpu_preferences) const;
#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> CreateVaapiVDA(
const gpu::GpuDriverBugWorkarounds& workarounds,
const gpu::GpuPreferences& gpu_preferences) const;
diff --git a/media/gpu/ipc/service/BUILD.gn b/media/gpu/ipc/service/BUILD.gn
index 16d6922..78a4b94 100644
--- a/media/gpu/ipc/service/BUILD.gn
+++ b/media/gpu/ipc/service/BUILD.gn
@@ -37,7 +37,7 @@ source_set("service") {
"//third_party/mesa:mesa_headers",
]
- if (is_chromeos && current_cpu != "arm") {
+ if ((is_chromeos || is_linux) && current_cpu != "arm") {
configs += [ "//third_party/libva:libva_config" ]
}
diff --git a/media/gpu/ipc/service/gpu_jpeg_decode_accelerator.cc b/media/gpu/ipc/service/gpu_jpeg_decode_accelerator.cc
index bffc7fb..09dd0ef 100644
--- a/media/gpu/ipc/service/gpu_jpeg_decode_accelerator.cc
+++ b/media/gpu/ipc/service/gpu_jpeg_decode_accelerator.cc
@@ -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 --git a/media/gpu/ipc/service/gpu_video_decode_accelerator.cc b/media/gpu/ipc/service/gpu_video_decode_accelerator.cc
index 44f8a12..014a752 100644
--- 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)) || 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,
@@ -170,7 +170,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)) || 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 --git a/media/gpu/ipc/service/gpu_video_encode_accelerator.cc b/media/gpu/ipc/service/gpu_video_encode_accelerator.cc
index 62a8539..6367661 100644
--- a/media/gpu/ipc/service/gpu_video_encode_accelerator.cc
+++ b/media/gpu/ipc/service/gpu_video_encode_accelerator.cc
@@ -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
@@ -196,10 +196,10 @@ std::vector<GpuVideoEncodeAccelerator::CreateVEAFp>
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
@@ -213,7 +213,7 @@ GpuVideoEncodeAccelerator::CreateVEAFps(
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<media::VideoEncodeAccelerator>
GpuVideoEncodeAccelerator::CreateV4L2VEA() {
@@ -225,7 +225,7 @@ GpuVideoEncodeAccelerator::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<media::VideoEncodeAccelerator>
GpuVideoEncodeAccelerator::CreateVaapiVEA() {
diff --git a/media/gpu/ipc/service/gpu_video_encode_accelerator.h b/media/gpu/ipc/service/gpu_video_encode_accelerator.h
index cfe44d2..29da8b8 100644
--- a/media/gpu/ipc/service/gpu_video_encode_accelerator.h
+++ b/media/gpu/ipc/service/gpu_video_encode_accelerator.h
@@ -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 --git a/media/gpu/jpeg_decode_accelerator_unittest.cc b/media/gpu/jpeg_decode_accelerator_unittest.cc
index 5c68851..796ca54 100644
--- a/media/gpu/jpeg_decode_accelerator_unittest.cc
+++ b/media/gpu/jpeg_decode_accelerator_unittest.cc
@@ -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"
@@ -135,10 +135,10 @@ JpegClient::JpegClient(const std::vector<TestImageFile*>& test_image_files,
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()) {
@@ -575,7 +575,7 @@ int main(int argc, char** argv) {
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 --git a/media/gpu/video_decode_accelerator_unittest.cc b/media/gpu/video_decode_accelerator_unittest.cc
index f9f2711..936cd6d 100644
--- a/media/gpu/video_decode_accelerator_unittest.cc
+++ b/media/gpu/video_decode_accelerator_unittest.cc
@@ -61,7 +61,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"
@@ -1732,7 +1732,7 @@ int main(int argc, char** argv) {
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 --git a/media/gpu/video_encode_accelerator_unittest.cc b/media/gpu/video_encode_accelerator_unittest.cc
index b8b4dd9..07ddff5 100644
--- a/media/gpu/video_encode_accelerator_unittest.cc
+++ b/media/gpu/video_encode_accelerator_unittest.cc
@@ -48,7 +48,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;
@@ -1812,7 +1812,7 @@ int main(int argc, char** argv) {
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 --git a/media/media.gyp b/media/media.gyp
index a8a370e..9a92e5f 100644
--- a/media/media.gyp
+++ b/media/media.gyp
@@ -752,7 +752,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',
@@ -1330,7 +1330,7 @@
'cdm/cdm_adapter_unittest.cc',
],
}],
- ['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',
],
@@ -2098,7 +2098,7 @@
},
],
}],
- ['chromeos==1', {
+ ['chromeos==1 or desktop_linux==1', {
'targets': [
{
'target_name': 'jpeg_decode_accelerator_unittest',
@@ -2125,7 +2125,7 @@
}
]
}],
- ['chromeos==1 or OS=="mac"', {
+ ['chromeos==1 or desktop_linux==1 or OS=="mac"', {
'targets': [
{
'target_name': 'video_encode_accelerator_unittest',
@@ -2171,7 +2171,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
@@ -2264,7 +2264,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/media/media_gpu.gypi b/media/media_gpu.gypi
index 70c1398..810ac32 100644
--- a/media/media_gpu.gypi
+++ b/media/media_gpu.gypi
@@ -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',
--
2.9.3

View File

@ -0,0 +1,22 @@
--- a/build/toolchain/linux/BUILD.gn 2016-11-09 19:49:39.000000000 -0800
+++ b/build/toolchain/linux/BUILD.gn 2016-11-10 20:33:18.200587987 -0800
@@ -102,13 +102,14 @@
}
gcc_toolchain("x64") {
- cc = "gcc"
- cxx = "g++"
+ toolprefix = "x86_64-libreelec-linux-gnu-"
+ cc = "${toolprefix}gcc"
+ cxx = "${toolprefix}g++"
- readelf = "readelf"
- nm = "nm"
- ar = "ar"
+ ar = "${toolprefix}ar"
ld = cxx
+ readelf = "${toolprefix}readelf"
+ nm = "${toolprefix}nm"
toolchain_args = {
current_cpu = "x64"

View File

@ -0,0 +1,12 @@
diff -Naur a/tools/gn/bootstrap/bootstrap.py b/tools/gn/bootstrap/bootstrap.py
--- a/tools/gn/bootstrap/bootstrap.py 2016-10-20 15:02:19.000000000 -0700
+++ b/tools/gn/bootstrap/bootstrap.py 2016-11-10 09:26:36.026611661 -0800
@@ -563,7 +563,7 @@
}
if is_linux:
- libs.extend(['-lrt', '-latomic'])
+ libs.extend(['-lrt'])
ldflags.extend(['-pthread'])
static_libraries['xdg_user_dirs'] = {