summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamantha McVey2016-09-16 12:28:12 -0700
committerSamantha McVey2016-09-16 12:28:12 -0700
commit2ad8d9d8b705a23fee1ec3a939adc90613f66736 (patch)
treeb8d34aa07a1dad0a29d1614f64663c83518ec387
parente4b74aa4688495c07daa81c22cbaa21a8afda25e (diff)
downloadaur-2ad8d9d8b705a23fee1ec3a939adc90613f66736.tar.gz
pkgup and add my chromium-vaapi-other patch and handle building for chromium-vaapi and chromium-vaapi-other
-rw-r--r--.SRCINFO12
-rw-r--r--PKGBUILD21
-rw-r--r--chromium_vaapi-intel.patch155
-rw-r--r--chromium_vaapi-other.patch75
-rw-r--r--chromium_vaapi.patch151
5 files changed, 255 insertions, 159 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 292e9134ba8c..ac0add84ae93 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,6 +1,6 @@
pkgbase = chromium-vaapi
pkgdesc = Chromium compiled with support for VA-API, allowing GPU accelerated decode of H.264 and other video formats supported by your GPU.
- pkgver = 53.0.2785.101
+ pkgver = 53.0.2785.116
pkgrel = 1
url = http://www.chromium.org/
install = chromium.install
@@ -46,18 +46,22 @@ pkgbase = chromium-vaapi
provides = chromium
conflicts = chromium
options = !strip
- source = https://commondatastorage.googleapis.com/chromium-browser-official/chromium-53.0.2785.101.tar.xz
+ source = https://commondatastorage.googleapis.com/chromium-browser-official/chromium-53.0.2785.116.tar.xz
source = chromium-launcher-3.tar.gz::https://github.com/foutrelis/chromium-launcher/archive/v3.tar.gz
source = chromium.desktop
source = chromium-widevine.patch
source = chromium-52.0.2743.116-unset-madv_free.patch
source = chromium_vaapi.patch
- sha256sums = edc55ed74b11064251be35ee89cfd8d6c7055c607d35135c41246c6735c4aee0
+ source = chromium_vaapi-intel.patch
+ source = chromium_vaapi-other.patch
+ sha256sums = 7a87629504346f64122ca7754574d187a4c1bf5736dea672ff3e247a0af16062
sha256sums = 8b01fb4efe58146279858a754d90b49e5a38c9a0b36a1f84cbb7d12f92b84c28
sha256sums = 028a748a5c275de9b8f776f97909f999a8583a4b77fd1cd600b4fc5c0c3e91e9
sha256sums = d6fdcb922e5a7fbe15759d39ccc8ea4225821c44d98054ce0f23f9d1f00c9808
sha256sums = 3b3aa9e28f29e6f539ed1c7832e79463b13128863a02e9c6fecd16c30d61c227
- sha256sums = 37bb0d812819cf21ab8826d04300514103a5fde5c010f7b9f06d7209f33e0c9d
+ sha256sums = 4700a2d75c5cec59ff4d78c284d20df591c07321565bb25e4bbbd5c671a5d22e
+ sha256sums = c479910bc405666f8c8c7760e983abc20ab65764ca1d889040bcba34e8b5b4b9
+ sha256sums = c6196905893027dd2e74d34d3000fd6cf50ceaa238b748a504434d4442d7f1ba
pkgname = chromium-vaapi
diff --git a/PKGBUILD b/PKGBUILD
index 89bcd4df1b69..060b82681624 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -9,7 +9,7 @@
# Contributor: Daniel J Griffiths <ghost1227@archlinux.us>
#
pkgname=chromium-vaapi
-pkgver=53.0.2785.101
+pkgver=53.0.2785.116
pkgrel=1
_launcher_ver=3
pkgdesc="Chromium compiled with support for VA-API, allowing GPU accelerated decode of H.264 and other video formats supported by
@@ -38,13 +38,17 @@ source=(https://commondatastorage.googleapis.com/chromium-browser-official/chrom
chromium.desktop
chromium-widevine.patch
chromium-52.0.2743.116-unset-madv_free.patch
- chromium_vaapi.patch)
-sha256sums=('edc55ed74b11064251be35ee89cfd8d6c7055c607d35135c41246c6735c4aee0'
+ chromium_vaapi.patch
+ chromium_vaapi-intel.patch
+ chromium_vaapi-other.patch)
+sha256sums=('7a87629504346f64122ca7754574d187a4c1bf5736dea672ff3e247a0af16062'
'8b01fb4efe58146279858a754d90b49e5a38c9a0b36a1f84cbb7d12f92b84c28'
'028a748a5c275de9b8f776f97909f999a8583a4b77fd1cd600b4fc5c0c3e91e9'
'd6fdcb922e5a7fbe15759d39ccc8ea4225821c44d98054ce0f23f9d1f00c9808'
'3b3aa9e28f29e6f539ed1c7832e79463b13128863a02e9c6fecd16c30d61c227'
- '37bb0d812819cf21ab8826d04300514103a5fde5c010f7b9f06d7209f33e0c9d')
+ '4700a2d75c5cec59ff4d78c284d20df591c07321565bb25e4bbbd5c671a5d22e'
+ 'c479910bc405666f8c8c7760e983abc20ab65764ca1d889040bcba34e8b5b4b9'
+ 'c6196905893027dd2e74d34d3000fd6cf50ceaa238b748a504434d4442d7f1ba')
# Google API keys (see http://www.chromium.org/developers/how-tos/api-keys)
# Note: These are for Arch Linux use ONLY. For your own distribution, please
@@ -76,7 +80,16 @@ prepare() {
patch -Np1
# Patch to enable VA-API
+ printf "Applying chromium_vaapi.patch\n"
patch -p1 -i "$srcdir"/chromium_vaapi.patch
+
+ if [ $pkgname == "chromium-vaapi" ]; then
+ printf "Applying chromium_vaapi-intel.patch\n"
+ patch -p1 -i "$srcdir"/chromium_vaapi-intel.patch
+ else
+ printf "Applying chromium_vaapi-other.patch\n"
+ patch -p1 -i "$srcdir"/chromium_vaapi-other.patch
+ fi
# Commentception – use bundled ICU due to build failures (50.0.2661.75)
# See https://crbug.com/584920 and https://crbug.com/592268
# ---
diff --git a/chromium_vaapi-intel.patch b/chromium_vaapi-intel.patch
new file mode 100644
index 000000000000..c734c1adf43a
--- /dev/null
+++ b/chromium_vaapi-intel.patch
@@ -0,0 +1,155 @@
+Patch for Intel GPU's, but doesn't seem to work on NVIDIA/ATI cards
+Thanks to Saikrishna Arcot (saiarcot895)
+Originally from https://raw.githubusercontent.com/saiarcot895/chromium-ubuntu-build/master/debian/patches/enable_vaapi_on_linux.diff
+
+The patch for bpf_gpu_policy_linux.cc initially came from
+https://codereview.chromium.org/15955009/diff/92001/content/common/sandbox_linux/bpf_gpu_policy_linux.cc.
+
+
+diff -aur chromium-53.0.2785.89.orig/content/common/sandbox_linux/bpf_gpu_policy_linux.cc chromium-53.0.2785.89/content/common/sandbox_linux/bpf_gpu_policy_linux.cc
+--- chromium-53.0.2785.89.orig/content/common/sandbox_linux/bpf_gpu_policy_linux.cc 2016-08-31 15:03:31.000000000 -0700
++++ chromium-53.0.2785.89/content/common/sandbox_linux/bpf_gpu_policy_linux.cc 2016-09-02 01:35:26.224998192 -0700
+@@ -23,6 +23,12 @@
+ #include "base/macros.h"
+ #include "base/memory/ptr_util.h"
+ #include "build/build_config.h"
++
++#if !defined(__arm__)
++// Auto-generated for dlopen libva libraries
++#include "content/common/va_stubs.h"
++#endif
++
+ #include "content/common/sandbox_linux/sandbox_bpf_base_policy_linux.h"
+ #include "content/common/sandbox_linux/sandbox_seccomp_bpf_linux.h"
+ #include "content/common/set_process_title.h"
+@@ -34,6 +40,14 @@
+ #include "sandbox/linux/syscall_broker/broker_process.h"
+ #include "sandbox/linux/system_headers/linux_syscalls.h"
+
++#if !defined(__arm__)
++#include "third_party/libva/va/va.h"
++#include "third_party/libva/va/va_x11.h"
++#if defined(USE_OZONE)
++#include "third_party/libva/va/wayland/va_wayland.h"
++#endif
++#endif
++
+ using sandbox::arch_seccomp_data;
+ using sandbox::bpf_dsl::Allow;
+ using sandbox::bpf_dsl::ResultExpr;
+@@ -42,6 +56,16 @@
+ using sandbox::syscall_broker::BrokerProcess;
+ using sandbox::SyscallSets;
+
++#if !defined(__arm__)
++using content_common::kModuleVa;
++using content_common::kModuleVa_x11;
++#if defined(USE_OZONE)
++using content_common::kModuleVa_drm;
++#endif
++using content_common::InitializeStubs;
++using content_common::StubPathMap;
++#endif
++
+ namespace content {
+
+ namespace {
+@@ -96,7 +120,7 @@
+
+ bool IsAcceleratedVaapiVideoEncodeEnabled() {
+ bool accelerated_encode_enabled = false;
+-#if defined(OS_CHROMEOS)
++#if defined(OS_CHROMEOS) || defined(OS_LINUX)
+ const base::CommandLine& command_line =
+ *base::CommandLine::ForCurrentProcess();
+ accelerated_encode_enabled =
+@@ -297,32 +321,72 @@
+ GpuBrokerProcessPolicy::Create,
+ std::vector<BrokerFilePermission>()); // No extra files in whitelist.
+
++#if !defined(__arm__)
+ if (IsArchitectureX86_64() || IsArchitectureI386()) {
+ // Accelerated video dlopen()'s some shared objects
+ // inside the sandbox, so preload them now.
+ if (IsAcceleratedVaapiVideoEncodeEnabled() ||
+ IsAcceleratedVideoDecodeEnabled()) {
+- const char* I965DrvVideoPath = NULL;
+- const char* I965HybridDrvVideoPath = NULL;
+-
+- if (IsArchitectureX86_64()) {
+- I965DrvVideoPath = "/usr/lib64/va/drivers/i965_drv_video.so";
+- I965HybridDrvVideoPath = "/usr/lib64/va/drivers/hybrid_drv_video.so";
+- } else if (IsArchitectureI386()) {
+- I965DrvVideoPath = "/usr/lib/va/drivers/i965_drv_video.so";
++ VLOG(1) << "Attempting to enable hardware video acceleration.";
++ StubPathMap paths;
++ paths[kModuleVa].push_back("libva.so.1");
++ paths[kModuleVa_x11].push_back("libva-x11.so.1");
++#if defined(USE_OZONE)
++ paths[kModuleVa_drm].push_back("libva-drm.so.1");
++#endif
++ if (!InitializeStubs(paths)) {
++ LOG(WARNING) << "Failed to initialize stubs";
++ return true;
+ }
+
+- dlopen(I965DrvVideoPath, RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
+- if (I965HybridDrvVideoPath)
+- dlopen(I965HybridDrvVideoPath, RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
+- dlopen("libva.so.1", RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
++ // libva drivers won't get loaded even above two libraries get dlopened.
++ // Thus, libva calls will fail after post sandbox stage.
++ //
++ // To get the va driver loaded before sandboxing, upstream simply dlopen
++ // the hard-coded va driver path because ChromeOS is the only platform
++ // that Google want to support libva.
++ //
++ // While generic linux distros ship va driver as anywhere they want.
++ // Fortunately, the va driver will be loadded when vaInitialize() get
++ // called.
++ // So the following code is to call vaInitialize() before sandboxing.
++
++ VADisplay va_display = NULL;
+ #if defined(USE_OZONE)
+- dlopen("libva-drm.so.1", RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
+-#elif defined(USE_X11)
+- dlopen("libva-x11.so.1", RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
++ struct wl_display* wayland_display = wl_display_connect(NULL);
++ if (wayland_display) {
++ va_display = vaGetDisplayWl(wayland_display);
++ if (!vaDisplayIsValid(va_display)) {
++ LOG(WARNING) << "Failed to call vaGetDisplayWl()";
++ va_display = NULL;
++ }
++ } else {
++ LOG(WARNING) << "Failed to find Wayland display";
++ }
++#endif
++
++ if (!va_display) {
++ Display* x_display = XOpenDisplay(NULL);
++ if (!x_display) {
++ LOG(WARNING) << "Failed to find X-Display";
++ return true;
++ }
++ va_display = vaGetDisplay(x_display);
++ if (!vaDisplayIsValid(va_display)) {
++ LOG(WARNING) << "Failed to call vaGetDisplay()";
++ return true;
++ }
++ }
++
++ int major_version, minor_version;
++ if (vaInitialize(va_display, &major_version, &minor_version)
++ != VA_STATUS_SUCCESS) {
++ LOG(WARNING) << "Failed to call vaInitialize()";
++ return true;
++ }
++ } // end of IsAcceleratedVaapiVideoEncodeEnabled() || IsAcceleratedVideoDecodeEnabled()
++ } // end of IsArchitectureX86_64() || IsArchitectureI386()
+ #endif
+- }
+- }
+
+ return true;
+ }
diff --git a/chromium_vaapi-other.patch b/chromium_vaapi-other.patch
new file mode 100644
index 000000000000..52d439a84d52
--- /dev/null
+++ b/chromium_vaapi-other.patch
@@ -0,0 +1,75 @@
+Patch by me, Samantha McVey <samantham@posteo.net>
+Attempt to load these VA-API drivers before sandbox.
+
+diff -aur chromium-53.0.2785.101/content/common/sandbox_linux/bpf_gpu_policy_linux.cc chromium-53.0.2785.101.new/content/common/sandbox_linux/bpf_gpu_policy_linux.cc
+--- chromium-53.0.2785.101/content/common/sandbox_linux/bpf_gpu_policy_linux.cc 2016-09-07 18:02:39.000000000 -0700
++++ chromium-53.0.2785.101.new/content/common/sandbox_linux/bpf_gpu_policy_linux.cc 2016-09-16 11:46:20.339655906 -0700
+@@ -96,7 +96,7 @@
+
+ bool IsAcceleratedVaapiVideoEncodeEnabled() {
+ bool accelerated_encode_enabled = false;
+-#if defined(OS_CHROMEOS)
++#if defined(OS_CHROMEOS) || defined(OS_LINUX)
+ const base::CommandLine& command_line =
+ *base::CommandLine::ForCurrentProcess();
+ accelerated_encode_enabled =
+@@ -302,19 +302,49 @@
+ // inside the sandbox, so preload them now.
+ if (IsAcceleratedVaapiVideoEncodeEnabled() ||
+ IsAcceleratedVideoDecodeEnabled()) {
+- const char* I965DrvVideoPath = NULL;
+- const char* I965HybridDrvVideoPath = NULL;
++ const char* I965_Drv_Video_Path = NULL;
++ const char* I965_Hybrid_Drv_Video_Path = NULL;
++ const char* NVIDIA_Drv_Video_Path = NULL;
++ const char* LIB_VA_Path = NULL;
++ const char* LIB_VA_X11_Path = NULL;
++ const char* R600_Drv_VideoPath = NULL;
++ const char* RADEONSIDrvVideoPath = NULL;
++ const char* VDPAU_Drv_VideoPath = NULL;
++
++ if (IsArchitectureX86_64() || IsArchitectureI386() ) {
++ I965_Drv_Video_Path = "/usr/lib/dri/i965_drv_video.so";
++ I965_Hybrid_Drv_Video_Path = "/usr/lib/dri/hybrid_drv_video.so";
++ NVIDIA_Drv_Video_Path = "/usr/lib/dri/nvidia_drv_video.so";
++ R600_Drv_VideoPath = "/usr/lib/dri/r600_drv_video.so";
++ VDPAU_Drv_VideoPath = "/usr/lib/dri/vdpau_drv_video.so";
++ RADEONSI_Drv_VideoPath = "/usr/lib/dri/radeonsi_drv_video.so";
++ NOUVEAU_Drv_VideoPath = "/usr/lib/dri/nouveau_drv_video.so";
+
+- if (IsArchitectureX86_64()) {
+- I965DrvVideoPath = "/usr/lib64/va/drivers/i965_drv_video.so";
+- I965HybridDrvVideoPath = "/usr/lib64/va/drivers/hybrid_drv_video.so";
+- } else if (IsArchitectureI386()) {
+- I965DrvVideoPath = "/usr/lib/va/drivers/i965_drv_video.so";
++ LIB_VA_Path = "/usr/lib/libva.so.1";
++ LIB_VA_X11_Path = "/usr/lib/libva-x11.so.1";
++ }
++ if ( access(I965_Drv_Video_Path , X_OK|R_OK ) != -1 ) {
++ dlopen(I965_Drv_Video_Path, RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
++ }
++ if ( access(I965_Hybrid_Drv_Video_Path , X_OK|R_OK ) != -1 ) {
++ dlopen(I965_Hybrid_Drv_Video_Path, RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
++ }
++ if ( access(VDPAU_Drv_VideoPath , X_OK|R_OK ) != -1 ) {
++ dlopen(VDPAU_Drv_VideoPath, RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
++ }
++ if ( access(NVIDIA_Drv_Video_Path , X_OK|R_OK ) != -1 ) {
++ dlopen(NVIDIA_Drv_Video_Path, RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
++ }
++ if ( access(R600_Drv_VideoPath , X_OK|R_OK ) != -1 ) {
++ dlopen(R600_Drv_VideoPath, RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
++ }
++ if ( access(RADEONSI_Drv_VideoPath , X_OK|R_OK ) != -1 ) {
++ dlopen(RADEONSI_Drv_VideoPath, RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
++ }
++ if ( access(NOUVEAU_Drv_VideoPath , X_OK|R_OK ) != -1 ) {
++ dlopen(NOUVEAU_Drv_VideoPath, RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
+ }
+
+- dlopen(I965DrvVideoPath, RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
+- if (I965HybridDrvVideoPath)
+- dlopen(I965HybridDrvVideoPath, RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
+ dlopen("libva.so.1", RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
+ #if defined(USE_OZONE)
+ dlopen("libva-drm.so.1", RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
diff --git a/chromium_vaapi.patch b/chromium_vaapi.patch
index ee20774a5dcd..e13037851055 100644
--- a/chromium_vaapi.patch
+++ b/chromium_vaapi.patch
@@ -3,10 +3,6 @@ Thanks to Saikrishna Arcot (saiarcot895)
Refactored for Chromium 53 by Samantha McVey (samcv) samantham@posteo.net
-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.
-
diff -aur chromium-53.0.2785.89.orig/chrome/browser/about_flags.cc chromium-53.0.2785.89/chrome/browser/about_flags.cc
--- chromium-53.0.2785.89.orig/chrome/browser/about_flags.cc 2016-08-31 15:03:27.000000000 -0700
+++ chromium-53.0.2785.89/chrome/browser/about_flags.cc 2016-09-02 01:35:26.221664850 -0700
@@ -88,153 +84,6 @@ diff -aur chromium-53.0.2785.89.orig/content/common/BUILD.gn chromium-53.0.2785.
} else {
if (is_linux) {
sources -= [
-diff -aur chromium-53.0.2785.89.orig/content/common/sandbox_linux/bpf_gpu_policy_linux.cc chromium-53.0.2785.89/content/common/sandbox_linux/bpf_gpu_policy_linux.cc
---- chromium-53.0.2785.89.orig/content/common/sandbox_linux/bpf_gpu_policy_linux.cc 2016-08-31 15:03:31.000000000 -0700
-+++ chromium-53.0.2785.89/content/common/sandbox_linux/bpf_gpu_policy_linux.cc 2016-09-02 01:35:26.224998192 -0700
-@@ -23,6 +23,12 @@
- #include "base/macros.h"
- #include "base/memory/ptr_util.h"
- #include "build/build_config.h"
-+
-+#if !defined(__arm__)
-+// Auto-generated for dlopen libva libraries
-+#include "content/common/va_stubs.h"
-+#endif
-+
- #include "content/common/sandbox_linux/sandbox_bpf_base_policy_linux.h"
- #include "content/common/sandbox_linux/sandbox_seccomp_bpf_linux.h"
- #include "content/common/set_process_title.h"
-@@ -34,6 +40,14 @@
- #include "sandbox/linux/syscall_broker/broker_process.h"
- #include "sandbox/linux/system_headers/linux_syscalls.h"
-
-+#if !defined(__arm__)
-+#include "third_party/libva/va/va.h"
-+#include "third_party/libva/va/va_x11.h"
-+#if defined(USE_OZONE)
-+#include "third_party/libva/va/wayland/va_wayland.h"
-+#endif
-+#endif
-+
- using sandbox::arch_seccomp_data;
- using sandbox::bpf_dsl::Allow;
- using sandbox::bpf_dsl::ResultExpr;
-@@ -42,6 +56,16 @@
- using sandbox::syscall_broker::BrokerProcess;
- using sandbox::SyscallSets;
-
-+#if !defined(__arm__)
-+using content_common::kModuleVa;
-+using content_common::kModuleVa_x11;
-+#if defined(USE_OZONE)
-+using content_common::kModuleVa_drm;
-+#endif
-+using content_common::InitializeStubs;
-+using content_common::StubPathMap;
-+#endif
-+
- namespace content {
-
- namespace {
-@@ -96,7 +120,7 @@
-
- bool IsAcceleratedVaapiVideoEncodeEnabled() {
- bool accelerated_encode_enabled = false;
--#if defined(OS_CHROMEOS)
-+#if defined(OS_CHROMEOS) || defined(OS_LINUX)
- const base::CommandLine& command_line =
- *base::CommandLine::ForCurrentProcess();
- accelerated_encode_enabled =
-@@ -297,32 +321,72 @@
- GpuBrokerProcessPolicy::Create,
- std::vector<BrokerFilePermission>()); // No extra files in whitelist.
-
-+#if !defined(__arm__)
- if (IsArchitectureX86_64() || IsArchitectureI386()) {
- // Accelerated video dlopen()'s some shared objects
- // inside the sandbox, so preload them now.
- if (IsAcceleratedVaapiVideoEncodeEnabled() ||
- IsAcceleratedVideoDecodeEnabled()) {
-- const char* I965DrvVideoPath = NULL;
-- const char* I965HybridDrvVideoPath = NULL;
--
-- if (IsArchitectureX86_64()) {
-- I965DrvVideoPath = "/usr/lib64/va/drivers/i965_drv_video.so";
-- I965HybridDrvVideoPath = "/usr/lib64/va/drivers/hybrid_drv_video.so";
-- } else if (IsArchitectureI386()) {
-- I965DrvVideoPath = "/usr/lib/va/drivers/i965_drv_video.so";
-+ VLOG(1) << "Attempting to enable hardware video acceleration.";
-+ StubPathMap paths;
-+ paths[kModuleVa].push_back("libva.so.1");
-+ paths[kModuleVa_x11].push_back("libva-x11.so.1");
-+#if defined(USE_OZONE)
-+ paths[kModuleVa_drm].push_back("libva-drm.so.1");
-+#endif
-+ if (!InitializeStubs(paths)) {
-+ LOG(WARNING) << "Failed to initialize stubs";
-+ return true;
- }
-
-- dlopen(I965DrvVideoPath, RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
-- if (I965HybridDrvVideoPath)
-- dlopen(I965HybridDrvVideoPath, RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
-- dlopen("libva.so.1", RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
-+ // libva drivers won't get loaded even above two libraries get dlopened.
-+ // Thus, libva calls will fail after post sandbox stage.
-+ //
-+ // To get the va driver loaded before sandboxing, upstream simply dlopen
-+ // the hard-coded va driver path because ChromeOS is the only platform
-+ // that Google want to support libva.
-+ //
-+ // While generic linux distros ship va driver as anywhere they want.
-+ // Fortunately, the va driver will be loadded when vaInitialize() get
-+ // called.
-+ // So the following code is to call vaInitialize() before sandboxing.
-+
-+ VADisplay va_display = NULL;
- #if defined(USE_OZONE)
-- dlopen("libva-drm.so.1", RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
--#elif defined(USE_X11)
-- dlopen("libva-x11.so.1", RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
-+ struct wl_display* wayland_display = wl_display_connect(NULL);
-+ if (wayland_display) {
-+ va_display = vaGetDisplayWl(wayland_display);
-+ if (!vaDisplayIsValid(va_display)) {
-+ LOG(WARNING) << "Failed to call vaGetDisplayWl()";
-+ va_display = NULL;
-+ }
-+ } else {
-+ LOG(WARNING) << "Failed to find Wayland display";
-+ }
-+#endif
-+
-+ if (!va_display) {
-+ Display* x_display = XOpenDisplay(NULL);
-+ if (!x_display) {
-+ LOG(WARNING) << "Failed to find X-Display";
-+ return true;
-+ }
-+ va_display = vaGetDisplay(x_display);
-+ if (!vaDisplayIsValid(va_display)) {
-+ LOG(WARNING) << "Failed to call vaGetDisplay()";
-+ return true;
-+ }
-+ }
-+
-+ int major_version, minor_version;
-+ if (vaInitialize(va_display, &major_version, &minor_version)
-+ != VA_STATUS_SUCCESS) {
-+ LOG(WARNING) << "Failed to call vaInitialize()";
-+ return true;
-+ }
-+ } // end of IsAcceleratedVaapiVideoEncodeEnabled() || IsAcceleratedVideoDecodeEnabled()
-+ } // end of IsArchitectureX86_64() || IsArchitectureI386()
- #endif
-- }
-- }
-
- return true;
- }
diff -aur chromium-53.0.2785.89.orig/content/content_common.gypi chromium-53.0.2785.89/content/content_common.gypi
--- chromium-53.0.2785.89.orig/content/content_common.gypi 2016-08-31 15:03:31.000000000 -0700
+++ chromium-53.0.2785.89/content/content_common.gypi 2016-09-02 01:35:26.224998192 -0700