Skip to content

Commit

Permalink
Enable mojo video decoders by default on Linux desktop if use_vaapi i…
Browse files Browse the repository at this point in the history
…s true

Already the case for ChromeOS, Mac and Win. And run the service
in the GPU process too. Except that here the gn arg use_vaapi
has to be true as well.

Note that this CL does not change the following:
  - the gn arg 'use_vaapi' is still false by default on Linux,
    see media/gpu/args.gni
  - 'accelerated_video_decode' is still black listed on Linux,
    see entry 48 in gpu/config/software_rendering_list.json
  - it is still not possible to enable hw video decode from
    about:flags, see chrome/browser/about_flags.cc

Also note that with this CL the ffmpeg and libvpx video decoders
are still selected thanks to media::DecoderSelector::SelectDecoder
in case vaapi fails to initialize.

Also see https://chromium-review.googlesource.com/c/chromium/src/+/1225275/
which was very similar but for ChromeOS.

Tested on Linux desktop with gn args:
  - use_vaapi = true (default is false)
  ./out/release/chrome --ignore-gpu-blacklist --use-gl=desktop url_to_vp9_video
  ./out/release/chrome --ignore-gpu-blacklist --use-gl=egl url_to_vp9_video
   -> MojoVideoDecoder was in use and VaapiVideoDecodeAccelerator runing in the
      GPU process, through MojoVideoDecoderService


Bug: 522298
Change-Id: Ia19f9f3edc0af488a477a16001b7de4f4818b3b2
Reviewed-on: https://chromium-review.googlesource.com/c/1370717
Reviewed-by: Dan Sanders <sandersd@chromium.org>
Commit-Queue: Julien Isorce <julien.isorce@chromium.org>
Cr-Commit-Position: refs/heads/master@{#616901}
  • Loading branch information
Julien Isorce authored and Commit Bot committed Dec 15, 2018
1 parent 101d767 commit 31225b9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
9 changes: 6 additions & 3 deletions media/media_options.gni
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import("//build/config/chrome_build.gni")
import("//build/config/chromecast_build.gni")
import("//build/config/features.gni")
import("//media/gpu/args.gni")
import("//testing/libfuzzer/fuzzer_test.gni")

# Do not expand this list without double-checking with OWNERS, this is a list of
Expand Down Expand Up @@ -129,8 +130,9 @@ declare_args() {
# |mojo_media_services|). When enabled, selected mojo paths will be enabled in
# the media pipeline and corresponding services will hosted in the selected
# remote process (e.g. "utility" process, see |mojo_media_host|).
enable_mojo_media = is_android || is_chromecast || is_chromeos || is_mac ||
is_win || enable_library_cdms
enable_mojo_media =
is_android || is_chromecast || is_chromeos || is_mac || is_win ||
enable_library_cdms || (is_desktop_linux && use_vaapi)

# Enable the TestMojoMediaClient to be used in mojo MediaService. This is for
# testing only and will override the default platform MojoMediaClient, if any.
Expand Down Expand Up @@ -200,7 +202,8 @@ if (enable_mojo_media) {
]
_default_mojo_media_host = "gpu"
}
} else if (is_chromeos || is_mac || is_win) {
} else if (is_chromeos || is_mac || is_win ||
(is_desktop_linux && use_vaapi)) {
_default_mojo_media_services = [ "video_decoder" ]
_default_mojo_media_host = "gpu"
}
Expand Down
5 changes: 3 additions & 2 deletions media/mojo/services/gpu_mojo_media_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ namespace media {
namespace {

#if defined(OS_ANDROID) || defined(OS_CHROMEOS) || defined(OS_MACOSX) || \
defined(OS_WIN)
defined(OS_WIN) || defined(OS_LINUX)
gpu::CommandBufferStub* GetCommandBufferStub(
base::WeakPtr<MediaGpuChannelManager> media_gpu_channel_manager,
base::UnguessableToken channel_token,
Expand Down Expand Up @@ -148,7 +148,8 @@ std::unique_ptr<VideoDecoder> GpuMojoMediaClient::CreateVideoDecoder(
android_overlay_factory_cb_, std::move(request_overlay_info_cb),
std::make_unique<VideoFrameFactoryImpl>(gpu_task_runner_,
std::move(get_stub_cb)));
#elif defined(OS_CHROMEOS) || defined(OS_MACOSX) || defined(OS_WIN)
#elif defined(OS_CHROMEOS) || defined(OS_MACOSX) || defined(OS_WIN) || \
defined(OS_LINUX)
std::unique_ptr<VideoDecoder> vda_video_decoder = VdaVideoDecoder::Create(
task_runner, gpu_task_runner_, media_log->Clone(), target_color_space,
gpu_preferences_, gpu_workarounds_,
Expand Down

0 comments on commit 31225b9

Please sign in to comment.