diff options
author | Eric Hameleers <alien@slackware.com> | 2015-05-14 10:05:27 +0000 |
---|---|---|
committer | Eric Hameleers <alien@slackware.com> | 2015-05-14 10:05:27 +0000 |
commit | 09f9afc22d7ec53debc1a3ab0e3b7af8ac1a742e (patch) | |
tree | c4e71cef936eec3f520f43d909efc6b75331bdec /chromium-dev | |
parent | 253e56e0db8f6609f111a3a715acc13cab12d515 (diff) | |
download | asb-09f9afc22d7ec53debc1a3ab0e3b7af8ac1a742e.tar.gz asb-09f9afc22d7ec53debc1a3ab0e3b7af8ac1a742e.tar.xz |
Initial revision
Diffstat (limited to 'chromium-dev')
-rw-r--r-- | chromium-dev/build/patches/chromium_vaapi.patch | 288 |
1 files changed, 288 insertions, 0 deletions
diff --git a/chromium-dev/build/patches/chromium_vaapi.patch b/chromium-dev/build/patches/chromium_vaapi.patch new file mode 100644 index 00000000..52ea1fcd --- /dev/null +++ b/chromium-dev/build/patches/chromium_vaapi.patch @@ -0,0 +1,288 @@ +# +# Adapted from http://bazaar.launchpad.net/~saiarcot895/chromium-browser +# +--- dev.vivid.orig/content/common/gpu/media/gpu_video_decode_accelerator.cc 2015-03-12 08:50:35.492933024 -0400 ++++ dev.vivid/content/common/gpu/media/gpu_video_decode_accelerator.cc 2015-03-12 08:50:35.486933116 -0400 +@@ -30,7 +30,7 @@ + #include "content/common/gpu/media/dxva_video_decode_accelerator.h" + #elif defined(OS_MACOSX) + #include "content/common/gpu/media/vt_video_decode_accelerator.h" +-#elif defined(OS_CHROMEOS) ++#elif defined(OS_CHROMEOS) || defined(OS_LINUX) + #if defined(USE_V4L2_CODEC) + #include "content/common/gpu/media/v4l2_device.h" + #include "content/common/gpu/media/v4l2_slice_video_decode_accelerator.h" +@@ -348,7 +348,7 @@ + scoped_ptr<media::VideoDecodeAccelerator> + GpuVideoDecodeAccelerator::CreateVaapiVDA() { + scoped_ptr<media::VideoDecodeAccelerator> 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 VaapiVideoDecodeAccelerator( + make_context_current_, base::Bind(&GpuVideoDecodeAccelerator::BindImage, + base::Unretained(this)))); +Index: dev.vivid/content/content_common.gypi +=================================================================== +--- dev.vivid.orig/content/content_common.gypi 2015-03-12 08:50:35.492933024 -0400 ++++ dev.vivid/content/content_common.gypi 2015-03-12 08:50:35.486933116 -0400 +@@ -859,7 +859,7 @@ + 'common/gpu/media/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', +Index: dev.vivid/content/content_gpu.gypi +=================================================================== +--- dev.vivid.orig/content/content_gpu.gypi 2015-03-12 08:50:35.492933024 -0400 ++++ dev.vivid/content/content_gpu.gypi 2015-03-12 08:50:35.486933116 -0400 +@@ -39,7 +39,7 @@ + ], + }, + }], +- ['target_arch!="arm" and chromeos == 1', { ++ ['target_arch!="arm" and (chromeos == 1 or desktop_linux == 1)', { + 'include_dirs': [ + '<(DEPTH)/third_party/libva', + ], +Index: dev.vivid/content/content_tests.gypi +=================================================================== +--- dev.vivid.orig/content/content_tests.gypi 2015-03-12 08:50:35.492933024 -0400 ++++ dev.vivid/content/content_tests.gypi 2015-03-12 08:50:35.487933101 -0400 +@@ -1639,7 +1639,7 @@ + }, + ] + }], +- ['chromeos==1 and target_arch != "arm"', { ++ ['(chromeos==1 or desktop_linux==1) and target_arch != "arm"', { + 'targets': [ + { + 'target_name': 'vaapi_h264_decoder_unittest', +Index: dev.vivid/content/public/common/content_switches.cc +=================================================================== +--- dev.vivid.orig/content/public/common/content_switches.cc 2015-03-12 08:50:35.492933024 -0400 ++++ dev.vivid/content/public/common/content_switches.cc 2015-03-12 08:50:35.487933101 -0400 +@@ -937,7 +937,7 @@ + // Disable web audio API. + const char kDisableWebAudio[] = "disable-webaudio"; + +-#if defined(OS_CHROMEOS) ++#if defined(OS_CHROMEOS) || defined(OS_LINUX) + // Disables panel fitting (used for mirror mode). + const char kDisablePanelFitting[] = "disable-panel-fitting"; + +Index: dev.vivid/content/public/common/content_switches.h +=================================================================== +--- dev.vivid.orig/content/public/common/content_switches.h 2015-03-12 08:50:35.492933024 -0400 ++++ dev.vivid/content/public/common/content_switches.h 2015-03-12 08:50:35.488933086 -0400 +@@ -269,7 +269,7 @@ + + CONTENT_EXPORT extern const char kDisableWebAudio[]; + +-#if defined(OS_CHROMEOS) ++#if defined(OS_CHROMEOS) || defined(OS_LINUX) + CONTENT_EXPORT extern const char kDisablePanelFitting[]; + CONTENT_EXPORT extern const char kDisableVaapiAcceleratedVideoEncode[]; + #endif +Index: dev.vivid/media/media.gyp +=================================================================== +--- dev.vivid.orig/media/media.gyp 2015-03-12 08:50:35.492933024 -0400 ++++ dev.vivid/media/media.gyp 2015-03-12 08:50:35.488933086 -0400 +@@ -732,7 +732,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', +Index: dev.vivid/gpu/config/software_rendering_list_json.cc +=================================================================== +--- dev.vivid.orig/gpu/config/software_rendering_list_json.cc 2015-03-12 08:50:35.492933024 -0400 ++++ dev.vivid/gpu/config/software_rendering_list_json.cc 2015-03-12 08:50:35.488933086 -0400 +@@ -507,17 +507,6 @@ + ] + }, + { +- "id": 48, +- "description": "Accelerated video decode is unavailable on Linux", +- "cr_bugs": [137247], +- "os": { +- "type": "linux" +- }, +- "features": [ +- "accelerated_video_decode" +- ] +- }, +- { + "id": 49, + "description": "NVidia GeForce GT 650M can cause the system to hang with flash 3D", + "cr_bugs": [140175], +@@ -1087,6 +1076,11 @@ + "os": { + "type": "android" + } ++ }, ++ { ++ "os": { ++ "type": "linux" ++ } + } + ], + "features": [ +Index: dev.vivid/content/common/sandbox_linux/bpf_gpu_policy_linux.cc +=================================================================== +--- dev.vivid.orig/content/common/sandbox_linux/bpf_gpu_policy_linux.cc 2015-03-12 08:50:35.492933024 -0400 ++++ dev.vivid/content/common/sandbox_linux/bpf_gpu_policy_linux.cc 2015-03-12 08:50:35.488933086 -0400 +@@ -21,6 +21,8 @@ + #include "base/logging.h" + #include "base/memory/scoped_ptr.h" + #include "build/build_config.h" ++// Auto-generated for dlopen libva libraries ++#include "content/common/gpu/media/va_stubs.h" + #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" +@@ -31,6 +33,8 @@ + #include "sandbox/linux/syscall_broker/broker_file_permission.h" + #include "sandbox/linux/syscall_broker/broker_process.h" + #include "sandbox/linux/system_headers/linux_syscalls.h" ++#include "third_party/libva/va/va.h" ++#include "third_party/libva/va/va_x11.h" + + using sandbox::arch_seccomp_data; + using sandbox::bpf_dsl::Allow; +@@ -40,6 +44,11 @@ + using sandbox::syscall_broker::BrokerProcess; + using sandbox::SyscallSets; + ++using content_common_gpu_media::kModuleVa; ++using content_common_gpu_media::kModuleVa_x11; ++using content_common_gpu_media::InitializeStubs; ++using content_common_gpu_media::StubPathMap; ++ + namespace content { + + namespace { +@@ -94,7 +103,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 = +@@ -295,23 +304,41 @@ + // inside the sandbox, so preload them now. + if (IsAcceleratedVaapiVideoEncodeEnabled() || + IsAcceleratedVideoDecodeEnabled()) { +- const char* I965DrvVideoPath = NULL; ++ 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 (!InitializeStubs(paths)) { ++ VLOG(1) << "Failed to initialize stubs"; ++ return false; ++ } + +- if (IsArchitectureX86_64()) { +- I965DrvVideoPath = "/usr/lib64/va/drivers/i965_drv_video.so"; +- } else if (IsArchitectureI386()) { +- I965DrvVideoPath = "/usr/lib/va/drivers/i965_drv_video.so"; ++ // 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. ++ Display* x_display = XOpenDisplay(NULL); ++ VADisplay va_display = vaGetDisplay(x_display); ++ if (!vaDisplayIsValid(va_display)) { ++ VLOG(1) << "Failed to call vaGetDisplay()"; ++ return false; + } + +- dlopen(I965DrvVideoPath, 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); +-#elif defined(USE_X11) +- dlopen("libva-x11.so.1", RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE); +-#endif +- } +- } ++ int major_version, minor_version; ++ if (vaInitialize(va_display, &major_version, &minor_version) ++ != VA_STATUS_SUCCESS) { ++ VLOG(1) << "Failed to call vaInitialize()"; ++ return false; ++ } ++ } // end of IsAcceleratedVaapiVideoEncodeEnabled() || IsAcceleratedVideoDecodeEnabled() ++ } // end of IsArchitectureX86_64() || IsArchitectureI386() + + return true; + } +Index: dev.vivid/chrome/browser/about_flags.cc +=================================================================== +--- dev.vivid.orig/chrome/browser/about_flags.cc 2015-03-12 08:50:35.492933024 -0400 ++++ dev.vivid/chrome/browser/about_flags.cc 2015-03-12 08:50:35.489933071 -0400 +@@ -949,7 +949,7 @@ + { "disable-accelerated-video-decode", + IDS_FLAGS_DISABLE_ACCELERATED_VIDEO_DECODE_NAME, + IDS_FLAGS_DISABLE_ACCELERATED_VIDEO_DECODE_DESCRIPTION, +- kOsMac | kOsWin | kOsCrOS, ++ kOsAll, + SINGLE_VALUE_TYPE(switches::kDisableAcceleratedVideoDecode), + }, + #if defined(USE_ASH) +Index: dev.vivid/content/common/gpu/media/vaapi_wrapper.cc +=================================================================== +--- dev.vivid.orig/content/common/gpu/media/vaapi_wrapper.cc 2015-03-12 08:50:35.492933024 -0400 ++++ dev.vivid/content/common/gpu/media/vaapi_wrapper.cc 2015-03-12 08:50:35.489933071 -0400 +@@ -184,14 +184,17 @@ + + if (!vaapi_wrapper->VaInitialize(report_error_to_uma_cb)) + return nullptr; ++ VLOG(1) << "VAAPI wrapper: initialized VA driver"; + + std::vector<VAProfile> supported_va_profiles; + if (!vaapi_wrapper->GetSupportedVaProfiles(&supported_va_profiles)) + return nullptr; ++ VLOG(1) << "VAAPI wrapper: got supported VA profiles"; + + VAProfile va_profile = ProfileToVAProfile(profile, supported_va_profiles); + if (!vaapi_wrapper->Initialize(mode, va_profile)) + return nullptr; ++ VLOG(1) << "VAAPI wrapper: VAAPI wrapper initialized"; + + return vaapi_wrapper.Pass(); + } +@@ -363,6 +366,7 @@ + bool VaapiWrapper::Initialize(CodecMode mode, VAProfile va_profile) { + if (va_profile == VAProfileNone) { + DVLOG(1) << "Unsupported profile"; ++ VLOG(1) << "Unsupported profile"; + return false; + } + VAEntrypoint entrypoint = +@@ -372,8 +376,10 @@ + std::vector<VAConfigAttrib> required_attribs = GetRequiredAttribs(mode); + if (!AreAttribsSupported(va_profile, entrypoint, required_attribs)) + return false; ++ VLOG(1) << "VAAPI Wrapper Initialization: entrypoint and attribs supported"; + + TryToSetVADisplayAttributeToLocalGPU(); ++ VLOG(1) << "VAAPI Wrapper Initialization: attributes set"; + + base::AutoLock auto_lock(va_lock_); + VAStatus va_res = vaCreateConfig(va_display_, |