summarylogtreecommitdiffstats
path: root/chromium-vaapi-init-r16.patch
diff options
context:
space:
mode:
Diffstat (limited to 'chromium-vaapi-init-r16.patch')
-rw-r--r--chromium-vaapi-init-r16.patch253
1 files changed, 0 insertions, 253 deletions
diff --git a/chromium-vaapi-init-r16.patch b/chromium-vaapi-init-r16.patch
deleted file mode 100644
index 8b49d2a08e04..000000000000
--- a/chromium-vaapi-init-r16.patch
+++ /dev/null
@@ -1,253 +0,0 @@
-From 281edc278272f0650fc190c8539d443ac59157bc Mon Sep 17 00:00:00 2001
-From: Daniel Charles <daniel.charles@intel.com>
-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 <daniel.charles@intel.com>
-Reviewed-on: https://chromium-review.googlesource.com/666138
-Commit-Queue: Miguel Casas <mcasas@chromium.org>
-Reviewed-by: Kenneth Russell <kbr@chromium.org>
-Reviewed-by: Antoine Labour <piman@chromium.org>
-Reviewed-by: Dongseong Hwang <dongseong.hwang@intel.com>
-Reviewed-by: Pawel Osciak <posciak@chromium.org>
-Reviewed-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
-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()