Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From 53b93dfe87fd10cced5d2a2a63072dfc7a2af6e4 Mon Sep 17 00:00:00 2001
- From: Daniel Charles <daniel.charles@intel.com>
- Date: Fri, 28 Jul 2017 16:31:47 -0700
- 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"
- TEST="and decoder hardware accelerated"
- TEST="have libva/intel-vaapi-driver installed and not installed in the system"
- TEST="repeat on different hardware families"
- R=posciak@chromium.org
- R=kcwu@chromium.org
- 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 <daniel.charles@intel.com>
- --- a/AUTHORS
- +++ b/AUTHORS
- @@ -158,6 +158,7 @@
- Daniel Bevenius <daniel.bevenius@gmail.com>
- Daniel Bomar <dbdaniel42@gmail.com>
- Daniel Carvalho Liedke <dliedke@gmail.com>
- +Daniel Charles <daniel.charles@intel.com>
- Daniel Imms <daniimms@amazon.com>
- Daniel Johnson <danielj41@gmail.com>
- Daniel Lockyer <thisisdaniellockyer@gmail.com>
- --- a/chrome/browser/about_flags.cc
- +++ b/chrome/browser/about_flags.cc
- @@ -1121,12 +1121,14 @@
- flag_descriptions::kUiPartialSwapDescription, kOsAll,
- SINGLE_DISABLE_VALUE_TYPE(switches::kUIDisablePartialSwap)},
- #if BUILDFLAG(ENABLE_WEBRTC)
- +#if !defined(OS_LINUX) || 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,
- @@ -1416,6 +1418,13 @@
- flag_descriptions::kTetherDescription, kOsCrOS,
- SINGLE_VALUE_TYPE(chromeos::switches::kEnableTether)},
- #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,
- @@ -1423,6 +1432,7 @@
- kOsMac | kOsWin | kOsCrOS | kOsAndroid,
- SINGLE_DISABLE_VALUE_TYPE(switches::kDisableAcceleratedVideoDecode),
- },
- +#endif
- #if defined(OS_WIN)
- {
- "enable-hdr", flag_descriptions::kEnableHDRName,
- @@ -2072,12 +2082,17 @@
- FEATURE_VALUE_TYPE(chrome::android::kWebVrAutopresent)},
- #endif // OS_ANDROID
- #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"
- @@ -79,8 +80,13 @@
- ::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,
- +#endif
- ::switches::kDisableBlinkFeatures,
- ::switches::kDisableCastStreamingHWEncoding,
- ::switches::kDisableDistanceFieldText,
- @@ -170,7 +176,7 @@
- ::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
- @@ -371,6 +371,13 @@
- "Enables the use of the GPU to perform 2d canvas rendering instead of "
- "using software rendering.";
- +#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
- +const char kAcceleratedVideoName[] = "Hardware-accelerated video";
- +const char kAcceleratedVideoDescription[] =
- + "Hardware-accelerated video where VA-API driver is installed on the"
- + "system.";
- +#endif
- +
- const char kDisplayList2dCanvasName[] = "Display list 2D canvas";
- const char kDisplayList2dCanvasDescription[] =
- @@ -528,6 +535,7 @@
- "Enabling this option allows web applications to access the WebGL "
- "Extensions that are still in draft status.";
- +#if !defined(OS_LINUX) || !defined(OS_CHROMEOS)
- const char kWebrtcHwDecodingName[] = "WebRTC hardware video decoding";
- const char kWebrtcHwDecodingDescription[] =
- @@ -543,6 +551,7 @@
- const char kWebrtcHwH264EncodingDescription[] =
- "Support in WebRTC for encoding h264 video streams using platform "
- "hardware.";
- +#endif
- const char kWebrtcHwVP8EncodingName[] = "WebRTC hardware vp8 video encoding";
- @@ -1514,7 +1523,7 @@
- #endif // defined(OS_MACOSX)
- -#if defined(OS_CHROMEOS)
- +#if defined(OS_CHROMEOS) || (defined(OS_LINUX) && !defined(OS_ANDROID))
- const char kAcceleratedMjpegDecodeName[] =
- "Hardware-accelerated mjpeg decode for captured frame";
- @@ -1523,7 +1532,7 @@
- "Enable hardware-accelerated mjpeg decode for captured frame where "
- "available.";
- -#endif // defined(OS_CHROMEOS)
- +#endif // defined(OS_CHROMEOS) || BUILDFLAG(USE_VAAPI)
- const char kSimplifiedFullscreenUiName[] =
- "Simplified full screen / mouse lock UI.";
- --- a/chrome/browser/flag_descriptions.h
- +++ b/chrome/browser/flag_descriptions.h
- @@ -31,6 +31,11 @@
- 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[];
- @@ -1202,13 +1207,17 @@
- #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
- @@ -106,7 +106,11 @@
- {"video_decode",
- manager->IsFeatureBlacklisted(
- 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},
- @@ -114,7 +118,11 @@
- {"video_encode",
- manager->IsFeatureBlacklisted(
- gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_ENCODE),
- +#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
- + !command_line.HasSwitch(switches::kEnableAcceleratedVideo),
- +#else
- command_line.HasSwitch(switches::kDisableWebRtcHWEncoding),
- +#endif
- "Accelerated video encode has been disabled, either via blacklist,"
- " about:flags or the command line.",
- true},
- --- a/content/browser/gpu/gpu_data_manager_impl_private.cc
- +++ b/content/browser/gpu/gpu_data_manager_impl_private.cc
- @@ -757,7 +757,11 @@
- DCHECK(command_line);
- if (ShouldDisableAcceleratedVideoDecode(command_line))
- +#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
- + command_line->AppendSwitch(switches::kEnableAcceleratedVideo);
- +#else
- command_line->AppendSwitch(switches::kDisableAcceleratedVideoDecode);
- +#endif
- #if defined(USE_AURA)
- if (!CanUseGpuBrowserCompositor())
- @@ -822,7 +826,11 @@
- if (gpu_preferences) {
- gpu_preferences->disable_accelerated_video_decode = true;
- } else {
- +#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
- + command_line->AppendSwitch(switches::kEnableAcceleratedVideo);
- +#else
- command_line->AppendSwitch(switches::kDisableAcceleratedVideoDecode);
- +#endif
- }
- }
- @@ -926,7 +934,12 @@
- const base::CommandLine* command_line =
- base::CommandLine::ForCurrentProcess();
- if (!ShouldDisableAcceleratedVideoDecode(command_line) &&
- - !command_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) {
- +#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
- + command_line->HasSwitch(switches::kEnableAcceleratedVideo)
- +#else
- + !command_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)
- +#endif
- + ) {
- prefs->pepper_accelerated_video_decode_enabled = true;
- }
- prefs->disable_2d_canvas_copy_on_write =
- @@ -1101,7 +1114,13 @@
- // to resolve crbug/442039 has been collected.
- const std::string group_name = base::FieldTrialList::FindFullName(
- "DisableAcceleratedVideoDecode");
- - if (command_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) {
- + if (
- +#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
- + !command_line->HasSwitch(switches::kEnableAcceleratedVideo)
- +#else
- + command_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)
- +#endif
- + ) {
- // It was already disabled on the command line.
- return false;
- }
- --- a/content/browser/gpu/gpu_process_host.cc
- +++ b/content/browser/gpu/gpu_process_host.cc
- @@ -116,7 +116,11 @@
- // Command-line switches to propagate to the GPU process.
- static const char* const kSwitchNames[] = {
- switches::kCreateDefaultGLContext,
- +#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
- + switches::kEnableAcceleratedVideo,
- +#else
- switches::kDisableAcceleratedVideoDecode,
- +#endif
- switches::kDisableBreakpad,
- switches::kDisableES3GLContext,
- switches::kDisableGpuRasterization,
- @@ -126,7 +130,7 @@
- switches::kDisableLogging,
- switches::kDisableSeccompFilterSandbox,
- 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
- @@ -154,8 +154,13 @@
- 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
- }
- if (params_.use_mojo_service) {
- base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
- --- a/content/browser/renderer_host/media/video_capture_gpu_jpeg_decoder.cc
- +++ b/content/browser/renderer_host/media/video_capture_gpu_jpeg_decoder.cc
- @@ -54,15 +54,21 @@
- 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
- @@ -2070,7 +2070,11 @@
- switches::kDisable2dCanvasImageChromium,
- switches::kDisable3DAPIs,
- switches::kDisableAcceleratedJpegDecoding,
- +#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
- + switches::kEnableAcceleratedVideo,
- +#else
- switches::kDisableAcceleratedVideoDecode,
- +#endif
- switches::kDisableBackgroundTimerThrottling,
- switches::kDisableBlinkFeatures,
- switches::kDisableBreakpad,
- @@ -2226,8 +2230,10 @@
- switches::kEnablePepperTesting,
- #endif
- #if BUILDFLAG(ENABLE_WEBRTC)
- +#if !defined(OS_LINUX) || defined(OS_CHROMEOS)
- switches::kDisableWebRtcHWDecoding,
- switches::kDisableWebRtcHWEncoding,
- +#endif
- switches::kEnableWebRtcSrtpAesGcm,
- switches::kEnableWebRtcStunOrigin,
- switches::kEnforceWebRtcIPPermissionCheck,
- --- a/content/browser/webrtc/webrtc_media_recorder_browsertest.cc
- +++ b/content/browser/webrtc/webrtc_media_recorder_browsertest.cc
- @@ -58,7 +58,12 @@
- 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/common/sandbox_linux/bpf_gpu_policy_linux.cc
- +++ b/content/common/sandbox_linux/bpf_gpu_policy_linux.cc
- @@ -56,22 +56,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(__arm__) || defined(__aarch64__)
- return true;
- @@ -96,21 +80,14 @@
- #endif
- }
- -bool IsAcceleratedVaapiVideoEncodeEnabled() {
- - bool accelerated_encode_enabled = false;
- -#if defined(OS_CHROMEOS)
- - const base::CommandLine& command_line =
- - *base::CommandLine::ForCurrentProcess();
- - accelerated_encode_enabled =
- - !command_line.HasSwitch(switches::kDisableVaapiAcceleratedVideoEncode);
- -#endif
- - return accelerated_encode_enabled;
- -}
- -
- bool IsAcceleratedVideoDecodeEnabled() {
- const base::CommandLine& command_line =
- *base::CommandLine::ForCurrentProcess();
- +#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
- + return command_line.HasSwitch(switches::kEnableAcceleratedVideo);
- +#else
- return !command_line.HasSwitch(switches::kDisableAcceleratedVideoDecode);
- +#endif
- }
- intptr_t GpuSIGSYS_Handler(const struct arch_seccomp_data& args,
- @@ -303,33 +280,6 @@
- GpuBrokerProcessPolicy::Create,
- std::vector<BrokerFilePermission>()); // No extra files in whitelist.
- - 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);
- -#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
- - }
- - }
- -
- return true;
- }
- --- a/content/gpu/BUILD.gn
- +++ b/content/gpu/BUILD.gn
- @@ -5,6 +5,7 @@
- import("//build/config/ui.gni")
- import("//gpu/vulkan/features.gni")
- import("//media/media_options.gni")
- +import("//media/gpu/args.gni")
- import("//ui/ozone/ozone.gni")
- # See //content/BUILD.gn for how this works.
- @@ -45,7 +46,6 @@
- ]
- configs += [ "//content:content_implementation" ]
- -
- deps = [
- "//base",
- "//base/third_party/dynamic_annotations",
- @@ -117,4 +117,8 @@
- if (enable_vulkan) {
- deps += [ "//gpu/vulkan" ]
- }
- -}
- +
- + if (is_desktop_linux) {
- + public_configs = [ "//media/gpu:libva_config" ]
- + }
- +}
- \ Pas de fin de ligne à la fin du fichier
- --- a/content/gpu/gpu_main.cc
- +++ b/content/gpu/gpu_main.cc
- @@ -243,7 +243,7 @@
- // Initializes StatisticsRecorder which tracks UMA histograms.
- base::StatisticsRecorder::Initialize();
- -#if defined(OS_ANDROID) || defined(OS_CHROMEOS)
- +#if defined(OS_LINUX)
- // Set thread priority before sandbox initialization.
- base::PlatformThread::SetCurrentThreadPriority(base::ThreadPriority::DISPLAY);
- #endif
- @@ -271,7 +271,7 @@
- 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"
- @@ -56,12 +57,19 @@
- gpu_preferences.ui_prioritize_in_gpu_process =
- command_line->HasSwitch(switches::kUIPrioritizeInGpuProcess);
- gpu_preferences.disable_accelerated_video_decode =
- +#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
- + !command_line->HasSwitch(switches::kEnableAcceleratedVideo);
- +#else
- command_line->HasSwitch(switches::kDisableAcceleratedVideoDecode);
- -#if defined(OS_CHROMEOS)
- +#endif
- +#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
- + gpu_preferences.disable_vaapi_accelerated_video_encode =
- + !command_line->HasSwitch(switches::kEnableAcceleratedVideo);
- +#elif defined(OS_CHROMEOS)
- gpu_preferences.disable_vaapi_accelerated_video_encode =
- command_line->HasSwitch(switches::kDisableVaapiAcceleratedVideoEncode);
- #endif
- -#if BUILDFLAG(ENABLE_WEBRTC)
- +#if BUILDFLAG(ENABLE_WEBRTC) && (!defined(OS_LINUX) || defined(OS_CHROMEOS))
- 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
- @@ -85,12 +85,21 @@
- // 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";
- @@ -911,11 +920,13 @@
- // 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
- @@ -34,7 +34,11 @@
- 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 kDisableAudioSupportForDesktopShare[];
- extern const char kDisableBackingStoreLimit[];
- @@ -106,6 +110,9 @@
- CONTENT_EXPORT extern const char kDisableZeroCopyDxgiVideo[];
- CONTENT_EXPORT extern const char kDomAutomationController[];
- extern const char kDisable2dCanvasClipAntialiasing[];
- +#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 kEnablePreferCompositingToLCDText[];
- CONTENT_EXPORT extern const char kEnableBlinkFeatures[];
- @@ -261,8 +268,10 @@
- #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 kEnableWebRtcStunOrigin[];
- CONTENT_EXPORT extern const char kEnforceWebRtcIPPermissionCheck[];
- --- a/content/renderer/media/webrtc/peer_connection_dependency_factory.cc
- +++ b/content/renderer/media/webrtc/peer_connection_dependency_factory.cc
- @@ -240,10 +240,19 @@
- 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));
- }
- }
- --- a/content/renderer/render_thread_impl.cc
- +++ b/content/renderer/render_thread_impl.cc
- @@ -1414,7 +1414,11 @@
- 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
- const bool enable_gpu_memory_buffer_video_frames =
- #if defined(OS_MACOSX) || defined(OS_LINUX)
- !cmd_line->HasSwitch(switches::kDisableGpuMemoryBufferVideoFrames) &&
- --- a/gpu/command_buffer/service/gpu_preferences.h
- +++ b/gpu/command_buffer/service/gpu_preferences.h
- @@ -50,7 +50,7 @@
- // 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
- --- a/gpu/config/software_rendering_list.json
- +++ b/gpu/config/software_rendering_list.json
- @@ -371,17 +371,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/BUILD.gn
- +++ b/media/BUILD.gn
- @@ -9,6 +9,7 @@
- import("//build/config/linux/pkg_config.gni")
- import("//build/config/ui.gni")
- import("//media/media_options.gni")
- +import("//media/gpu/args.gni")
- import("//ppapi/features/features.gni")
- import("//testing/libfuzzer/fuzzer_test.gni")
- import("//testing/test.gni")
- @@ -354,7 +355,7 @@
- ]
- }
- - if (current_cpu != "arm" && is_chromeos) {
- + if (use_vaapi) {
- sources += [
- "filters/h264_bitstream_buffer.cc",
- "filters/h264_bitstream_buffer.h",
- --- a/media/gpu/BUILD.gn
- +++ b/media/gpu/BUILD.gn
- @@ -18,7 +18,15 @@
- import("//build/config/mac/mac_sdk.gni")
- }
- -if (is_chromeos && current_cpu != "arm") {
- +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 = "va_stub_header.fragment"
- @@ -230,7 +238,7 @@
- }
- }
- - if (is_chromeos || is_win) {
- + if (is_chromeos || is_win || is_desktop_linux) {
- sources += [
- "accelerated_video_decoder.h",
- "h264_decoder.cc",
- @@ -239,7 +247,8 @@
- "h264_dpb.h",
- ]
- }
- - if (is_chromeos) {
- +
- + if (is_chromeos || is_desktop_linux) {
- sources += [
- "vp8_decoder.cc",
- "vp8_decoder.h",
- @@ -323,6 +332,9 @@
- "vaapi_drm_picture.h",
- ]
- }
- + if (is_desktop_linux) {
- + public_configs = [ ":libva_config" ]
- + }
- }
- }
- @@ -370,7 +382,7 @@
- }
- # TODO(watk): Run this on bots. http://crbug.com/461437
- -if (is_win || is_android || is_chromeos) {
- +if (is_win || is_android || is_chromeos || is_desktop_linux) {
- test("video_decode_accelerator_unittest") {
- sources = [
- "video_accelerator_unittest_helpers.h",
- @@ -474,7 +486,7 @@
- }
- }
- -if (is_chromeos || is_mac || is_win) {
- +if (is_chromeos || is_mac || is_win || is_desktop_linux) {
- test("video_encode_accelerator_unittest") {
- deps = [
- "//base",
- @@ -507,7 +519,7 @@
- }
- }
- -if (is_chromeos) {
- +if (is_chromeos || is_desktop_linux) {
- test("jpeg_decode_accelerator_unittest") {
- deps = [
- "//base",
- --- a/media/gpu/gpu_video_decode_accelerator_factory.cc
- +++ b/media/gpu/gpu_video_decode_accelerator_factory.cc
- @@ -16,7 +16,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"
- @@ -82,6 +82,7 @@
- // profile (instead of calculating a superset).
- // TODO(posciak,henryhsu): improve this so that we choose a superset of
- // resolutions and other supported profile parameters.
- + DVLOG(1) << "Get Supported profiles";
- #if defined(OS_WIN)
- capabilities.supported_profiles =
- DXVAVideoDecodeAccelerator::GetSupportedProfiles(gpu_preferences,
- --- a/media/gpu/gpu_video_encode_accelerator_factory.cc
- +++ b/media/gpu/gpu_video_encode_accelerator_factory.cc
- @@ -7,7 +7,7 @@
- #include "base/memory/ptr_util.h"
- #include "media/gpu/gpu_video_accelerator_util.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
- --- a/media/gpu/vaapi_wrapper.cc
- +++ b/media/gpu/vaapi_wrapper.cc
- @@ -1132,6 +1132,7 @@
- if (drm_file.IsValid())
- GetDisplayState()->SetDrmFd(drm_file.GetPlatformFile());
- #endif
- + GetProfileInfos(); // dlopen all necessary libraries
- }
- // static
- --- a/services/ui/gpu/gpu_main.cc
- +++ b/services/ui/gpu/gpu_main.cc
- @@ -9,6 +9,7 @@
- #include "base/message_loop/message_loop.h"
- #include "base/power_monitor/power_monitor_device_source.h"
- #include "base/single_thread_task_runner.h"
- +#include "build/build_config.h"
- #include "components/viz/frame_sinks/mojo_frame_sink_manager.h"
- #include "gpu/command_buffer/common/activity_flags.h"
- #include "gpu/ipc/common/gpu_memory_buffer_support.h"
- @@ -73,7 +74,7 @@
- thread_options.message_loop_type = base::MessageLoop::TYPE_IO;
- #endif
- -#if defined(OS_ANDROID) || defined(OS_CHROMEOS)
- +#if defined(OS_LINUX)
- thread_options.priority = base::ThreadPriority::DISPLAY;
- #endif
- CHECK(gpu_thread_.StartWithOptions(thread_options));
- @@ -83,7 +84,7 @@
- // should be possible to use |main_task_runner_| for doing IO tasks.
- thread_options = base::Thread::Options(base::MessageLoop::TYPE_IO, 0);
- thread_options.priority = base::ThreadPriority::NORMAL;
- -#if defined(OS_ANDROID) || defined(OS_CHROMEOS)
- +#if defined(OS_LINUX)
- // TODO(reveman): Remove this in favor of setting it explicitly for each type
- // of process.
- thread_options.priority = base::ThreadPriority::DISPLAY;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement