Advertisement
Guest User

Untitled

a guest
Jan 27th, 2018
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 25.47 KB | None | 0 0
  1. diff --git i/chrome/browser/about_flags.cc w/chrome/browser/about_flags.cc
  2. index 5ed7048e81..83b5a9faa5 100644
  3. --- i/chrome/browser/about_flags.cc
  4. +++ w/chrome/browser/about_flags.cc
  5. @@ -1230,12 +1230,14 @@ const FeatureEntry kFeatureEntries[] = {
  6.       flag_descriptions::kUiPartialSwapDescription, kOsAll,
  7.       SINGLE_DISABLE_VALUE_TYPE(switches::kUIDisablePartialSwap)},
  8.  #if BUILDFLAG(ENABLE_WEBRTC)
  9. +#if !defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
  10.      {"disable-webrtc-hw-decoding", flag_descriptions::kWebrtcHwDecodingName,
  11.       flag_descriptions::kWebrtcHwDecodingDescription, kOsAndroid | kOsCrOS,
  12.       SINGLE_DISABLE_VALUE_TYPE(switches::kDisableWebRtcHWDecoding)},
  13.      {"disable-webrtc-hw-encoding", flag_descriptions::kWebrtcHwEncodingName,
  14.       flag_descriptions::kWebrtcHwEncodingDescription, kOsAndroid | kOsCrOS,
  15.       SINGLE_DISABLE_VALUE_TYPE(switches::kDisableWebRtcHWEncoding)},
  16. +#endif
  17.      {"enable-webrtc-hw-h264-encoding",
  18.       flag_descriptions::kWebrtcHwH264EncodingName,
  19.       flag_descriptions::kWebrtcHwH264EncodingDescription, kOsAndroid | kOsCrOS,
  20. @@ -1527,6 +1529,13 @@ const FeatureEntry kFeatureEntries[] = {
  21.       flag_descriptions::kShowTouchHudDescription, kOsCrOS,
  22.       SINGLE_VALUE_TYPE(ash::switches::kAshTouchHud)},
  23.  #endif  // OS_CHROMEOS
  24. +#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
  25. +    {
  26. +        "enable-accelerated-video", flag_descriptions::kAcceleratedVideoName,
  27. +        flag_descriptions::kAcceleratedVideoDescription, kOsLinux,
  28. +        SINGLE_VALUE_TYPE(switches::kEnableAcceleratedVideo),
  29. +    },
  30. +#else
  31.      {
  32.          "disable-accelerated-video-decode",
  33.          flag_descriptions::kAcceleratedVideoDecodeName,
  34. @@ -1534,6 +1543,7 @@ const FeatureEntry kFeatureEntries[] = {
  35.          kOsMac | kOsWin | kOsCrOS | kOsAndroid,
  36.          SINGLE_DISABLE_VALUE_TYPE(switches::kDisableAcceleratedVideoDecode),
  37.      },
  38. +#endif
  39.  #if defined(OS_WIN)
  40.      {"enable-hdr", flag_descriptions::kEnableHDRName,
  41.       flag_descriptions::kEnableHDRDescription, kOsWin,
  42. @@ -2245,12 +2255,17 @@ const FeatureEntry kFeatureEntries[] = {
  43.       FEATURE_VALUE_TYPE(features::kOpenVR)},
  44.  #endif  // ENABLE_OPENVR
  45.  #endif  // ENABLE_VR
  46. -#if defined(OS_CHROMEOS)
  47. +#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
  48. +    {"enable-accelerated-mjpeg-decode",
  49. +     flag_descriptions::kAcceleratedMjpegDecodeName,
  50. +     flag_descriptions::kAcceleratedMjpegDecodeDescription, kOsLinux,
  51. +     SINGLE_VALUE_TYPE(switches::kEnableAcceleratedMjpegDecode)},
  52. +#elif defined(OS_CHROMEOS)
  53.      {"disable-accelerated-mjpeg-decode",
  54.       flag_descriptions::kAcceleratedMjpegDecodeName,
  55.       flag_descriptions::kAcceleratedMjpegDecodeDescription, kOsCrOS,
  56.       SINGLE_DISABLE_VALUE_TYPE(switches::kDisableAcceleratedMjpegDecode)},
  57. -#endif  // OS_CHROMEOS
  58. +#endif
  59.      {"v8-cache-options", flag_descriptions::kV8CacheOptionsName,
  60.       flag_descriptions::kV8CacheOptionsDescription, kOsAll,
  61.       MULTI_VALUE_TYPE(kV8CacheOptionsChoices)},
  62. diff --git i/chrome/browser/chromeos/login/chrome_restart_request.cc w/chrome/browser/chromeos/login/chrome_restart_request.cc
  63. index 5a52d36009..1e06e2f529 100644
  64. --- i/chrome/browser/chromeos/login/chrome_restart_request.cc
  65. +++ w/chrome/browser/chromeos/login/chrome_restart_request.cc
  66. @@ -19,6 +19,7 @@
  67.  #include "base/sys_info.h"
  68.  #include "base/timer/timer.h"
  69.  #include "base/values.h"
  70. +#include "build/build_config.h"
  71.  #include "cc/base/switches.h"
  72.  #include "chrome/browser/browser_process.h"
  73.  #include "chrome/browser/chromeos/boot_times_recorder.h"
  74. @@ -84,8 +85,9 @@ void DeriveCommandLine(const GURL& start_url,
  75.      ::switches::kDisable2dCanvasImageChromium,
  76.      ::switches::kDisableAccelerated2dCanvas,
  77.      ::switches::kDisableAcceleratedJpegDecoding,
  78. +    ::switches::kEnableAcceleratedMjpegDecode,
  79. +    ::switches::kEnableAcceleratedVideo,
  80.      ::switches::kDisableAcceleratedMjpegDecode,
  81. -    ::switches::kDisableAcceleratedVideoDecode,
  82.      ::switches::kDisableAcceleratedVideoEncode,
  83.      ::switches::kDisableBlinkFeatures,
  84.      ::switches::kDisableCastStreamingHWEncoding,
  85. @@ -164,7 +166,7 @@ void DeriveCommandLine(const GURL& start_url,
  86.      ::switches::kDisableWebGLImageChromium,
  87.      ::switches::kEnableWebGLImageChromium,
  88.      ::switches::kEnableWebVR,
  89. -#if BUILDFLAG(ENABLE_WEBRTC)
  90. +#if BUILDFLAG(ENABLE_WEBRTC) && (defined(OS_CHROMEOS) || defined(OS_ANDROID))
  91.      ::switches::kDisableWebRtcHWDecoding,
  92.      ::switches::kDisableWebRtcHWEncoding,
  93.  #endif
  94. diff --git i/chrome/browser/flag_descriptions.cc w/chrome/browser/flag_descriptions.cc
  95. index ea921685c9..91856003dc 100644
  96. --- i/chrome/browser/flag_descriptions.cc
  97. +++ w/chrome/browser/flag_descriptions.cc
  98. @@ -14,6 +14,13 @@ const char kAccelerated2dCanvasDescription[] =
  99.      "Enables the use of the GPU to perform 2d canvas rendering instead of "
  100.      "using software rendering.";
  101.  
  102. +#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
  103. +const char kAcceleratedVideoName[] = "Hardware-accelerated video";
  104. +const char kAcceleratedVideoDescription[] =
  105. +    "Hardware-accelerated video where VA-API driver is installed on the"
  106. +    "system.";
  107. +#endif
  108. +
  109.  const char kAcceleratedVideoDecodeName[] = "Hardware-accelerated video decode";
  110.  const char kAcceleratedVideoDecodeDescription[] =
  111.      "Hardware-accelerated video decode where available.";
  112. @@ -1610,6 +1617,7 @@ const char kWebrtcEchoCanceller3Name[] = "WebRTC Echo Canceller 3.";
  113.  const char kWebrtcEchoCanceller3Description[] =
  114.      "Experimental WebRTC echo canceller (AEC3).";
  115.  
  116. +#if !defined(OS_LINUX) || !defined(OS_CHROMEOS)
  117.  const char kWebrtcHwDecodingName[] = "WebRTC hardware video decoding";
  118.  const char kWebrtcHwDecodingDescription[] =
  119.      "Support in WebRTC for decoding video streams using platform hardware.";
  120. @@ -1617,6 +1625,7 @@ const char kWebrtcHwDecodingDescription[] =
  121.  const char kWebrtcHwEncodingName[] = "WebRTC hardware video encoding";
  122.  const char kWebrtcHwEncodingDescription[] =
  123.      "Support in WebRTC for encoding video streams using platform hardware.";
  124. +#endif
  125.  
  126.  const char kWebrtcHwH264EncodingName[] = "WebRTC hardware h264 video encoding";
  127.  const char kWebrtcHwH264EncodingDescription[] =
  128. @@ -2442,14 +2451,16 @@ const char kTranslateNewUxDescription[] =
  129.  
  130.  // Chrome OS -------------------------------------------------------------------
  131.  
  132. -#if defined(OS_CHROMEOS)
  133. +#if defined(OS_CHROMEOS) || (defined(OS_LINUX) && !defined(OS_ANDROID))
  134.  
  135.  const char kAcceleratedMjpegDecodeName[] =
  136.      "Hardware-accelerated mjpeg decode for captured frame";
  137.  const char kAcceleratedMjpegDecodeDescription[] =
  138.      "Enable hardware-accelerated mjpeg decode for captured frame where "
  139.      "available.";
  140. +#endif
  141.  
  142. +#if defined(OS_CHROMEOS)
  143.  const char kAllowTouchpadThreeFingerClickName[] = "Touchpad three-finger-click";
  144.  const char kAllowTouchpadThreeFingerClickDescription[] =
  145.      "Enables touchpad three-finger-click as middle button.";
  146. diff --git i/chrome/browser/flag_descriptions.h w/chrome/browser/flag_descriptions.h
  147. index 9209b4ad59..9c7e52b9cc 100644
  148. --- i/chrome/browser/flag_descriptions.h
  149. +++ w/chrome/browser/flag_descriptions.h
  150. @@ -37,6 +37,10 @@ namespace flag_descriptions {
  151.  extern const char kAccelerated2dCanvasName[];
  152.  extern const char kAccelerated2dCanvasDescription[];
  153.  
  154. +#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
  155. +extern const char kAcceleratedVideoName[];
  156. +extern const char kAcceleratedVideoDescription[];
  157. +#endif
  158.  extern const char kAcceleratedVideoDecodeName[];
  159.  extern const char kAcceleratedVideoDecodeDescription[];
  160.  
  161. @@ -1502,13 +1506,17 @@ extern const char kPermissionPromptPersistenceToggleDescription[];
  162.  
  163.  #endif  // defined(OS_MACOSX)
  164.  
  165. -// Chrome OS ------------------------------------------------------------------
  166. -
  167. -#if defined(OS_CHROMEOS)
  168. +#if defined(OS_CHROMEOS) || (defined(OS_LINUX) && !defined(OS_ANDROID))
  169.  
  170.  extern const char kAcceleratedMjpegDecodeName[];
  171.  extern const char kAcceleratedMjpegDecodeDescription[];
  172.  
  173. +#endif
  174. +
  175. +// Chrome OS ------------------------------------------------------------------
  176. +
  177. +#if defined(OS_CHROMEOS)
  178. +
  179.  extern const char kAllowTouchpadThreeFingerClickName[];
  180.  extern const char kAllowTouchpadThreeFingerClickDescription[];
  181.  
  182. diff --git i/chrome/browser/ui/libgtkui/BUILD.gn w/chrome/browser/ui/libgtkui/BUILD.gn
  183. index 505d87c67b..fb5b6792f3 100644
  184. --- i/chrome/browser/ui/libgtkui/BUILD.gn
  185. +++ w/chrome/browser/ui/libgtkui/BUILD.gn
  186. @@ -101,10 +101,10 @@ template("libgtkui") {
  187.               "//printing",
  188.               "//skia",
  189.  
  190. -             # GTK pulls pangoft2, which requires HarfBuzz symbols. When linking
  191. -             # our own HarfBuzz avoid mixing symbols from system HarfBuzz and
  192. -             # our own through the indirect dependency to harfbuzz-ng here.
  193. -             "//third_party:freetype_harfbuzz",
  194. +             # GTK pulls pangoft2, which requires HarfBuzz symbols. Since we
  195. +             # link our own HarfBuzz, avoid mixing symbols from system HarfBuzz
  196. +             # and own ones, hence the dependency to harfbuzz-ng here.
  197. +             "//third_party/harfbuzz-ng",
  198.               "//ui/aura",
  199.               "//ui/base",
  200.               "//ui/base/ime",
  201. diff --git i/content/browser/gpu/gpu_process_host.cc w/content/browser/gpu/gpu_process_host.cc
  202. index 029fc58f0e..7a17b52157 100644
  203. --- i/content/browser/gpu/gpu_process_host.cc
  204. +++ w/content/browser/gpu/gpu_process_host.cc
  205. @@ -120,7 +120,7 @@ static const char* const kSwitchNames[] = {
  206.      switches::kDisableGLExtensions,
  207.      switches::kDisableLogging,
  208.      switches::kDisableShaderNameHashing,
  209. -#if BUILDFLAG(ENABLE_WEBRTC)
  210. +#if BUILDFLAG(ENABLE_WEBRTC) && !defined(OS_LINUX)
  211.      switches::kDisableWebRtcHWEncoding,
  212.  #endif
  213.  #if defined(OS_WIN)
  214. diff --git i/content/browser/renderer_host/media/video_capture_browsertest.cc w/content/browser/renderer_host/media/video_capture_browsertest.cc
  215. index 40529f778a..1fe3fa53f6 100644
  216. --- i/content/browser/renderer_host/media/video_capture_browsertest.cc
  217. +++ w/content/browser/renderer_host/media/video_capture_browsertest.cc
  218. @@ -164,8 +164,13 @@ class VideoCaptureBrowserTest : public ContentBrowserTest,
  219.        base::CommandLine::ForCurrentProcess()->AppendSwitch(
  220.            switches::kUseFakeJpegDecodeAccelerator);
  221.      } else {
  222. +#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
  223. +      base::CommandLine::ForCurrentProcess()->AppendSwitch(
  224. +          switches::kEnableAcceleratedMjpegDecode);
  225. +#else
  226.        base::CommandLine::ForCurrentProcess()->AppendSwitch(
  227.            switches::kDisableAcceleratedMjpegDecode);
  228. +#endif
  229.      }
  230.    }
  231.  
  232. diff --git i/content/browser/renderer_host/media/video_capture_gpu_jpeg_decoder.cc w/content/browser/renderer_host/media/video_capture_gpu_jpeg_decoder.cc
  233. index 2be279b50e..c96432b97e 100644
  234. --- i/content/browser/renderer_host/media/video_capture_gpu_jpeg_decoder.cc
  235. +++ w/content/browser/renderer_host/media/video_capture_gpu_jpeg_decoder.cc
  236. @@ -65,15 +65,21 @@ void VideoCaptureGpuJpegDecoder::Initialize() {
  237.    bool is_platform_supported =
  238.        base::CommandLine::ForCurrentProcess()->HasSwitch(
  239.            switches::kUseFakeJpegDecodeAccelerator);
  240. -#if defined(OS_CHROMEOS)
  241. -  // Non-ChromeOS platforms do not support HW JPEG decode now. Do not establish
  242. -  // gpu channel to avoid introducing overhead.
  243. +#if !defined(OS_ANDROID) && defined(OS_LINUX)
  244. +  // Non-ChromeOS or Non-Linux platforms do not support HW JPEG decode now. Do
  245. +  // not establish gpu channel to avoid introducing overhead.
  246.    is_platform_supported = true;
  247.  #endif
  248.  
  249.    if (!is_platform_supported ||
  250. +#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
  251. +      !base::CommandLine::ForCurrentProcess()->HasSwitch(
  252. +          switches::kEnableAcceleratedMjpegDecode)
  253. +#else
  254.        base::CommandLine::ForCurrentProcess()->HasSwitch(
  255. -          switches::kDisableAcceleratedMjpegDecode)) {
  256. +          switches::kDisableAcceleratedMjpegDecode)
  257. +#endif
  258. +          ) {
  259.      decoder_status_ = FAILED;
  260.      RecordInitDecodeUMA_Locked();
  261.      return;
  262. diff --git i/content/browser/renderer_host/render_process_host_impl.cc w/content/browser/renderer_host/render_process_host_impl.cc
  263. index 62d007c253..4eb04ecfdb 100644
  264. --- i/content/browser/renderer_host/render_process_host_impl.cc
  265. +++ w/content/browser/renderer_host/render_process_host_impl.cc
  266. @@ -2531,7 +2531,11 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
  267.      switches::kDefaultTileHeight,
  268.      switches::kDisable2dCanvasImageChromium,
  269.      switches::kDisableAcceleratedJpegDecoding,
  270. +#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
  271. +    switches::kEnableAcceleratedVideo,
  272. +#else
  273.      switches::kDisableAcceleratedVideoDecode,
  274. +#endif
  275.      switches::kDisableBackgroundTimerThrottling,
  276.      switches::kDisableBreakpad,
  277.      switches::kDisableCompositorUkmForTests,
  278. @@ -2664,8 +2668,10 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
  279.      switches::kDisableMojoRenderer,
  280.  #endif
  281.  #if BUILDFLAG(ENABLE_WEBRTC)
  282. +#if !defined(OS_LINUX) || defined(OS_CHROMEOS)
  283.      switches::kDisableWebRtcHWDecoding,
  284.      switches::kDisableWebRtcHWEncoding,
  285. +#endif
  286.      switches::kEnableWebRtcSrtpAesGcm,
  287.      switches::kEnableWebRtcSrtpEncryptedHeaders,
  288.      switches::kEnableWebRtcStunOrigin,
  289. diff --git i/content/browser/webrtc/webrtc_media_recorder_browsertest.cc w/content/browser/webrtc/webrtc_media_recorder_browsertest.cc
  290. index a92e78aec1..66a186d5f9 100644
  291. --- i/content/browser/webrtc/webrtc_media_recorder_browsertest.cc
  292. +++ w/content/browser/webrtc/webrtc_media_recorder_browsertest.cc
  293. @@ -58,7 +58,12 @@ class WebRtcMediaRecorderTest
  294.        return;
  295.      // This flag is also used for encoding, https://crbug.com/616640.
  296.      base::CommandLine::ForCurrentProcess()->AppendSwitch(
  297. -        switches::kDisableAcceleratedVideoDecode);
  298. +#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
  299. +        switches::kEnableAcceleratedVideo
  300. +#else
  301. +        switches::kDisableAcceleratedVideoDecode
  302. +#endif
  303. +        );
  304.    }
  305.  
  306.   private:
  307. diff --git i/content/gpu/BUILD.gn w/content/gpu/BUILD.gn
  308. index 4c50c53718..11727c98af 100644
  309. --- i/content/gpu/BUILD.gn
  310. +++ w/content/gpu/BUILD.gn
  311. @@ -8,6 +8,16 @@ import("//gpu/vulkan/features.gni")
  312.  import("//media/media_options.gni")
  313.  import("//ui/ozone/ozone.gni")
  314.  
  315. +# Unfortunately, using public_configs from media/gpu breaks unbundling
  316. +import("//media/gpu/args.gni")
  317. +if (is_desktop_linux && use_vaapi) {
  318. +  import("//build/config/linux/pkg_config.gni")
  319. +
  320. +  pkg_config("libva_config") {
  321. +    packages = [ "libva" ]
  322. +  }
  323. +}
  324. +
  325.  # See //content/BUILD.gn for how this works.
  326.  group("gpu") {
  327.    visibility = [ "//content/*" ]  # This is an internal content API.
  328. @@ -49,7 +59,6 @@ target(link_target_type, "gpu_sources") {
  329.    ]
  330.  
  331.    configs += [ "//content:content_implementation" ]
  332. -
  333.    deps = [
  334.      "//base",
  335.      "//base/third_party/dynamic_annotations",
  336. @@ -125,4 +134,8 @@ target(link_target_type, "gpu_sources") {
  337.    if (is_desktop_linux && (!is_chromecast || is_cast_desktop_build)) {
  338.      configs += [ "//build/config/linux/dri" ]
  339.    }
  340. +
  341. +  if (is_desktop_linux) {
  342. +    public_configs = [ ":libva_config" ]
  343. +  }
  344.  }
  345. diff --git i/content/gpu/gpu_main.cc w/content/gpu/gpu_main.cc
  346. index 7385416b66..615adf5d9a 100644
  347. --- i/content/gpu/gpu_main.cc
  348. +++ w/content/gpu/gpu_main.cc
  349. @@ -274,7 +274,7 @@ int GpuMain(const MainFunctionParams& parameters) {
  350.  
  351.    base::PlatformThread::SetName("CrGpuMain");
  352.  
  353. -#if defined(OS_ANDROID) || defined(OS_CHROMEOS)
  354. +#if defined(OS_LINUX)
  355.    // Set thread priority before sandbox initialization.
  356.    base::PlatformThread::SetCurrentThreadPriority(base::ThreadPriority::DISPLAY);
  357.  #endif
  358. @@ -306,7 +306,7 @@ int GpuMain(const MainFunctionParams& parameters) {
  359.    GetContentClient()->SetGpuInfo(gpu_init->gpu_info());
  360.  
  361.    base::ThreadPriority io_thread_priority = base::ThreadPriority::NORMAL;
  362. -#if defined(OS_ANDROID) || defined(OS_CHROMEOS)
  363. +#if defined(OS_LINUX)
  364.    io_thread_priority = base::ThreadPriority::DISPLAY;
  365.  #endif
  366.  
  367. diff --git i/content/public/browser/gpu_utils.cc w/content/public/browser/gpu_utils.cc
  368. index bb72dffb57..517c277c74 100644
  369. --- i/content/public/browser/gpu_utils.cc
  370. +++ w/content/public/browser/gpu_utils.cc
  371. @@ -7,6 +7,7 @@
  372.  #include "base/command_line.h"
  373.  #include "base/single_thread_task_runner.h"
  374.  #include "base/strings/string_number_conversions.h"
  375. +#include "build/build_config.h"
  376.  #include "content/browser/gpu/gpu_process_host.h"
  377.  #include "content/public/common/content_features.h"
  378.  #include "content/public/common/content_switches.h"
  379. @@ -55,10 +56,10 @@ const gpu::GpuPreferences GetGpuPreferencesFromCommandLine() {
  380.    gpu_preferences.in_process_gpu =
  381.        command_line->HasSwitch(switches::kInProcessGPU);
  382.    gpu_preferences.disable_accelerated_video_decode =
  383. -      command_line->HasSwitch(switches::kDisableAcceleratedVideoDecode);
  384. +      !command_line->HasSwitch(switches::kEnableAcceleratedVideo);
  385.    gpu_preferences.disable_accelerated_video_encode =
  386. -      command_line->HasSwitch(switches::kDisableAcceleratedVideoEncode);
  387. -#if BUILDFLAG(ENABLE_WEBRTC)
  388. +      !command_line->HasSwitch(switches::kEnableAcceleratedVideo);
  389. +#if BUILDFLAG(ENABLE_WEBRTC) && (!defined(OS_LINUX) || defined(OS_CHROMEOS))
  390.    gpu_preferences.disable_web_rtc_hw_encoding =
  391.        command_line->HasSwitch(switches::kDisableWebRtcHWEncoding);
  392.  #endif
  393. diff --git i/content/public/common/content_switches.cc w/content/public/common/content_switches.cc
  394. index 9493605f6b..5f0069462a 100644
  395. --- i/content/public/common/content_switches.cc
  396. +++ w/content/public/common/content_switches.cc
  397. @@ -78,12 +78,21 @@ const char kDisable3DAPIs[]                 = "disable-3d-apis";
  398.  
  399.  // Disable gpu-accelerated 2d canvas.
  400.  const char kDisableAccelerated2dCanvas[]    = "disable-accelerated-2d-canvas";
  401. -
  402. +#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
  403. +// Enable hardware accelerated mjpeg decode on linux
  404. +const char kEnableAcceleratedMjpegDecode[] = "enable-accelerated-mjpeg-decode";
  405. +#else
  406.  // Disable hardware acceleration of mjpeg decode for captured frame, where
  407.  // available.
  408.  const char kDisableAcceleratedMjpegDecode[] =
  409.      "disable-accelerated-mjpeg-decode";
  410. +#endif
  411.  
  412. +#if defined(OS_LINUX)
  413. +// Enables hardware acceleration of video for Linux only. VA-API driver
  414. +// is required to be present on the system installation.
  415. +const char kEnableAcceleratedVideo[] = "enable-accelerated-video";
  416. +#endif
  417.  // Disables hardware acceleration of video decode, where available.
  418.  const char kDisableAcceleratedVideoDecode[] =
  419.      "disable-accelerated-video-decode";
  420. @@ -869,11 +878,13 @@ const char kZygoteProcess[]                 = "zygote";
  421.  // ignores this switch on its stable and beta channels.
  422.  const char kDisableWebRtcEncryption[]      = "disable-webrtc-encryption";
  423.  
  424. +#if defined(OS_CHROMEOS)
  425.  // Disables HW decode acceleration for WebRTC.
  426.  const char kDisableWebRtcHWDecoding[]       = "disable-webrtc-hw-decoding";
  427.  
  428.  // Disables HW encode acceleration for WebRTC.
  429.  const char kDisableWebRtcHWEncoding[] = "disable-webrtc-hw-encoding";
  430. +#endif
  431.  
  432.  // Enables negotiation of GCM cipher suites from RFC 7714 for SRTP in WebRTC.
  433.  // See https://tools.ietf.org/html/rfc7714 for further information.
  434. diff --git i/content/public/common/content_switches.h w/content/public/common/content_switches.h
  435. index 4444504fe8..4eb49cc2bf 100644
  436. --- i/content/public/common/content_switches.h
  437. +++ w/content/public/common/content_switches.h
  438. @@ -33,7 +33,11 @@ CONTENT_EXPORT extern const char kDisable2dCanvasImageChromium[];
  439.  CONTENT_EXPORT extern const char kDisable3DAPIs[];
  440.  CONTENT_EXPORT extern const char kDisableAccelerated2dCanvas[];
  441.  CONTENT_EXPORT extern const char kDisableAcceleratedJpegDecoding[];
  442. +#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
  443. +CONTENT_EXPORT extern const char kEnableAcceleratedMjpegDecode[];
  444. +#else
  445.  CONTENT_EXPORT extern const char kDisableAcceleratedMjpegDecode[];
  446. +#endif
  447.  CONTENT_EXPORT extern const char kDisableAcceleratedVideoDecode[];
  448.  CONTENT_EXPORT extern const char kDisableAcceleratedVideoEncode[];
  449.  CONTENT_EXPORT extern const char kDisableAudioSupportForDesktopShare[];
  450. @@ -107,6 +111,9 @@ CONTENT_EXPORT extern const char kDisableZeroCopyDxgiVideo[];
  451.  CONTENT_EXPORT extern const char kDomAutomationController[];
  452.  extern const char kDisable2dCanvasClipAntialiasing[];
  453.  CONTENT_EXPORT extern const char kDumpBlinkRuntimeCallStats[];
  454. +#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
  455. +CONTENT_EXPORT extern const char kEnableAcceleratedVideo[];
  456. +#endif
  457.  CONTENT_EXPORT extern const char kEnableAggressiveDOMStorageFlushing[];
  458.  CONTENT_EXPORT extern const char kEnableAutomation[];
  459.  CONTENT_EXPORT extern const char kEnablePreferCompositingToLCDText[];
  460. @@ -240,8 +247,10 @@ CONTENT_EXPORT extern const char kZygoteProcess[];
  461.  
  462.  #if BUILDFLAG(ENABLE_WEBRTC)
  463.  CONTENT_EXPORT extern const char kDisableWebRtcEncryption[];
  464. +#if defined(OS_CHROMEOS)
  465.  CONTENT_EXPORT extern const char kDisableWebRtcHWDecoding[];
  466.  CONTENT_EXPORT extern const char kDisableWebRtcHWEncoding[];
  467. +#endif
  468.  CONTENT_EXPORT extern const char kEnableWebRtcSrtpAesGcm[];
  469.  CONTENT_EXPORT extern const char kEnableWebRtcSrtpEncryptedHeaders[];
  470.  CONTENT_EXPORT extern const char kEnableWebRtcStunOrigin[];
  471. diff --git i/content/renderer/media/webrtc/peer_connection_dependency_factory.cc w/content/renderer/media/webrtc/peer_connection_dependency_factory.cc
  472. index 7a77385849..a7a37cd8ec 100644
  473. --- i/content/renderer/media/webrtc/peer_connection_dependency_factory.cc
  474. +++ w/content/renderer/media/webrtc/peer_connection_dependency_factory.cc
  475. @@ -245,10 +245,14 @@ void PeerConnectionDependencyFactory::InitializeSignalingThread(
  476.  
  477.    const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
  478.    if (gpu_factories && gpu_factories->IsGpuVideoAcceleratorEnabled()) {
  479. +#if BUILDFLAG(ENABLE_WEBRTC) && (!defined(OS_LINUX) || defined(OS_CHROMEOS))
  480.      if (!cmd_line->HasSwitch(switches::kDisableWebRtcHWDecoding))
  481. +#endif
  482.        decoder_factory.reset(new RTCVideoDecoderFactory(gpu_factories));
  483. -
  484. -    if (!cmd_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) {
  485. +#if BUILDFLAG(ENABLE_WEBRTC) && (!defined(OS_LINUX) || defined(OS_CHROMEOS))
  486. +    if (!cmd_line->HasSwitch(switches::kDisableWebRtcHWEncoding))
  487. +#endif
  488. +    {
  489.        encoder_factory.reset(new RTCVideoEncoderFactory(gpu_factories));
  490.      }
  491.    }
  492. diff --git i/content/renderer/render_thread_impl.cc w/content/renderer/render_thread_impl.cc
  493. index 683d97a898..e2d91ac104 100644
  494. --- i/content/renderer/render_thread_impl.cc
  495. +++ w/content/renderer/render_thread_impl.cc
  496. @@ -1466,7 +1466,7 @@ media::GpuVideoAcceleratorFactories* RenderThreadImpl::GetGpuFactories() {
  497.    scoped_refptr<base::SingleThreadTaskRunner> media_task_runner =
  498.        GetMediaThreadTaskRunner();
  499.    const bool enable_video_accelerator =
  500. -      !cmd_line->HasSwitch(switches::kDisableAcceleratedVideoDecode) &&
  501. +      (cmd_line->HasSwitch(switches::kEnableAcceleratedVideo)) &&
  502.        (gpu_channel_host->gpu_feature_info()
  503.             .status_values[gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE] ==
  504.         gpu::kGpuFeatureStatusEnabled);
  505. diff --git i/gpu/config/software_rendering_list.json w/gpu/config/software_rendering_list.json
  506. index b1679dcf4e..563b3ebb87 100644
  507. --- i/gpu/config/software_rendering_list.json
  508. +++ w/gpu/config/software_rendering_list.json
  509. @@ -372,17 +372,6 @@
  510.          "all"
  511.        ]
  512.      },
  513. -    {
  514. -      "id": 48,
  515. -      "description": "Accelerated video decode is unavailable on Linux",
  516. -      "cr_bugs": [137247],
  517. -      "os": {
  518. -        "type": "linux"
  519. -      },
  520. -      "features": [
  521. -        "accelerated_video_decode"
  522. -      ]
  523. -    },
  524.      {
  525.        "id": 50,
  526.        "description": "Disable VMware software renderer on older Mesa",
  527. diff --git i/media/gpu/BUILD.gn w/media/gpu/BUILD.gn
  528. index ecd72bd147..e2c2bc3d24 100644
  529. --- i/media/gpu/BUILD.gn
  530. +++ w/media/gpu/BUILD.gn
  531. @@ -24,6 +24,14 @@ if (is_mac) {
  532.    import("//build/config/mac/mac_sdk.gni")
  533.  }
  534.  
  535. +if (is_desktop_linux && use_vaapi) {
  536. +  import("//build/config/linux/pkg_config.gni")
  537. +
  538. +  pkg_config("libva_config") {
  539. +    packages = [ "libva" ]
  540. +  }
  541. +}
  542. +
  543.  if (use_vaapi) {
  544.    action("libva_generate_stubs") {
  545.      extra_header = "vaapi/va_stub_header.fragment"
  546. @@ -303,6 +311,9 @@ component("gpu") {
  547.          "v4l2/tegra_v4l2_device.h",
  548.        ]
  549.      }
  550. +    if (is_desktop_linux) {
  551. +      public_configs = [ ":libva_config" ]
  552. +    }
  553.    }
  554.  
  555.    if (use_vaapi) {
  556. diff --git i/media/gpu/gpu_video_decode_accelerator_factory.cc w/media/gpu/gpu_video_decode_accelerator_factory.cc
  557. index 0a84cf39c8..03cc927728 100644
  558. --- i/media/gpu/gpu_video_decode_accelerator_factory.cc
  559. +++ w/media/gpu/gpu_video_decode_accelerator_factory.cc
  560. @@ -88,6 +88,7 @@ GpuVideoDecodeAcceleratorFactory::GetDecoderCapabilities(
  561.  // profile (instead of calculating a superset).
  562.  // TODO(posciak,henryhsu): improve this so that we choose a superset of
  563.  // resolutions and other supported profile parameters.
  564. +  DVLOG(1) << "Get Supported profiles";
  565.  #if defined(OS_WIN)
  566.    capabilities.supported_profiles =
  567.        DXVAVideoDecodeAccelerator::GetSupportedProfiles(gpu_preferences,
  568. diff --git i/media/gpu/vaapi/vaapi_wrapper.cc w/media/gpu/vaapi/vaapi_wrapper.cc
  569. index bc3d735e78..d72cede9db 100644
  570. --- i/media/gpu/vaapi/vaapi_wrapper.cc
  571. +++ w/media/gpu/vaapi/vaapi_wrapper.cc
  572. @@ -1169,6 +1169,7 @@ bool VaapiWrapper::BlitSurface(
  573.  // static
  574.  void VaapiWrapper::PreSandboxInitialization() {
  575.    VADisplayState::PreSandboxInitialization();
  576. +  VASupportedProfiles::Get();  // dlopen all necessary libraries
  577.  }
  578.  
  579.  VaapiWrapper::VaapiWrapper()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement