Commit 417f0cf7 authored by Peng Huang's avatar Peng Huang Committed by Commit Bot

mus: Enable arc video accelerators in viz

For Classic Ash, ArcVideo*Accelerator and ProtectedBufferManager interfaces
are implemented in GPU process and requested from browser process. And the
the message pipes for ArcVideo*Accelerators interfaces can be forward from
the browser process into ARC container.

This CL adds CreateArcVideo*Accelerator() and CreateProtectedBufferManager()
methods in viz::mojom::GpuService. Those methods can only be used by the
ui(window server) process via the viz::mojo::VizMain interface.

This CL also adds a new ui::mojom::Arc interface. It is exposed from ui
process, and can only be used by browser process.

For mushrome, the workflow is, ARC requests ArcVideo*Accelerator interfaces
from browser process, and then browser process requests ui::mojom::Arc
interface exposed by ui process and then uses the ui::mojom::Arc to create the
ArcVideo*Accelerators interfaces implemented in viz process, and then forwards
the message handle for ArcVideo*Accelerator interface to ARC. The workflow looks
like:

[ARC]<--arc.mojom.ArcBridgeHost-->[browser]<--ui.mojom.Arc-->[ui]<--viz.mojom.GpuService-->[viz]


Test: Test ARC youtube on device
Bug: 769755
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: If8ff4aeeffc378d12bd86161bf705497bcfc28e5
Reviewed-on: https://chromium-review.googlesource.com/759092Reviewed-by: default avatarTom Sepez <tsepez@chromium.org>
Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
Reviewed-by: default avatarSadrul Chowdhury <sadrul@chromium.org>
Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Reviewed-by: default avatarYusuke Sato <yusukes@chromium.org>
Reviewed-by: default avatarMichael Wasserman <msw@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#517898}
parent a6d3776a
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "base/memory/singleton.h" #include "base/memory/singleton.h"
#include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop.h"
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "chrome/browser/chromeos/ash_config.h"
#include "components/arc/arc_bridge_service.h" #include "components/arc/arc_bridge_service.h"
#include "components/arc/arc_browser_context_keyed_service_factory_base.h" #include "components/arc/arc_browser_context_keyed_service_factory_base.h"
#include "components/arc/common/video_decode_accelerator.mojom.h" #include "components/arc/common/video_decode_accelerator.mojom.h"
...@@ -23,21 +24,13 @@ ...@@ -23,21 +24,13 @@
#include "mojo/edk/embedder/platform_channel_pair.h" #include "mojo/edk/embedder/platform_channel_pair.h"
#include "mojo/public/cpp/bindings/strong_binding.h" #include "mojo/public/cpp/bindings/strong_binding.h"
#include "services/service_manager/public/cpp/interface_provider.h" #include "services/service_manager/public/cpp/interface_provider.h"
#include "services/ui/public/cpp/gpu/gpu.h"
#include "ui/aura/env.h"
namespace arc { namespace arc {
namespace { namespace {
void ConnectToVideoDecodeAcceleratorOnIOThread(
mojom::VideoDecodeAcceleratorRequest request) {
content::BindInterfaceInGpuProcess(std::move(request));
}
void ConnectToVideoEncodeAcceleratorOnIOThread(
mojom::VideoEncodeAcceleratorRequest request) {
content::BindInterfaceInGpuProcess(std::move(request));
}
// Singleton factory for GpuArcVideoServiceHost. // Singleton factory for GpuArcVideoServiceHost.
class GpuArcVideoServiceHostFactory class GpuArcVideoServiceHostFactory
: public internal::ArcBrowserContextKeyedServiceFactoryBase< : public internal::ArcBrowserContextKeyedServiceFactoryBase<
...@@ -65,18 +58,32 @@ class VideoAcceleratorFactoryService : public mojom::VideoAcceleratorFactory { ...@@ -65,18 +58,32 @@ class VideoAcceleratorFactoryService : public mojom::VideoAcceleratorFactory {
void CreateDecodeAccelerator( void CreateDecodeAccelerator(
mojom::VideoDecodeAcceleratorRequest request) override { mojom::VideoDecodeAcceleratorRequest request) override {
content::BrowserThread::PostTask( if (chromeos::GetAshConfig() != ash::Config::CLASSIC) {
content::BrowserThread::IO, FROM_HERE, aura::Env::GetInstance()
base::BindOnce(&ConnectToVideoDecodeAcceleratorOnIOThread, ->GetGpuConnection()
base::Passed(&request))); ->CreateArcVideoDecodeAccelerator(std::move(request));
} else {
content::BrowserThread::PostTask(
content::BrowserThread::IO, FROM_HERE,
base::BindOnce(&content::BindInterfaceInGpuProcess<
mojom::VideoDecodeAccelerator>,
base::Passed(&request)));
}
} }
void CreateEncodeAccelerator( void CreateEncodeAccelerator(
mojom::VideoEncodeAcceleratorRequest request) override { mojom::VideoEncodeAcceleratorRequest request) override {
content::BrowserThread::PostTask( if (chromeos::GetAshConfig() != ash::Config::CLASSIC) {
content::BrowserThread::IO, FROM_HERE, aura::Env::GetInstance()
base::BindOnce(&ConnectToVideoEncodeAcceleratorOnIOThread, ->GetGpuConnection()
base::Passed(&request))); ->CreateArcVideoEncodeAccelerator(std::move(request));
} else {
content::BrowserThread::PostTask(
content::BrowserThread::IO, FROM_HERE,
base::BindOnce(&content::BindInterfaceInGpuProcess<
mojom::VideoEncodeAccelerator>,
base::Passed(&request)));
}
} }
private: private:
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle.h" #include "chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle.h"
#include "chrome/browser/ui/views/intent_picker_bubble_view.h" #include "chrome/browser/ui/views/intent_picker_bubble_view.h"
#include "components/arc/common/intent_helper.mojom.h" #include "components/arc/common/intent_helper.mojom.h" // nogncheck https://crbug.com/784179
#include "components/arc/intent_helper/arc_intent_helper_bridge.h" #include "components/arc/intent_helper/arc_intent_helper_bridge.h"
#endif // defined(OS_CHROMEOS) #endif // defined(OS_CHROMEOS)
......
...@@ -16,7 +16,7 @@ static_library("gpu") { ...@@ -16,7 +16,7 @@ static_library("gpu") {
if (is_chromeos) { if (is_chromeos) {
deps += [ deps += [
"//components/arc:arc_bindings", "//components/arc/common:media",
"//components/arc/video_accelerator", "//components/arc/video_accelerator",
"//gpu/command_buffer/service", "//gpu/command_buffer/service",
"//services/service_manager/public/cpp", "//services/service_manager/public/cpp",
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import("//mojo/public/tools/bindings/mojom.gni")
import("//testing/test.gni") import("//testing/test.gni")
static_library("arc") { static_library("arc") {
...@@ -150,63 +149,8 @@ static_library("arc_base") { ...@@ -150,63 +149,8 @@ static_library("arc_base") {
] ]
public_deps = [ public_deps = [
":arc_bindings",
":prefs", ":prefs",
] "//components/arc/common",
}
mojom("arc_bindings") {
sources = [
"common/accessibility_helper.mojom",
"common/app.mojom",
"common/arc_bridge.mojom",
"common/audio.mojom",
"common/auth.mojom",
"common/backup_settings.mojom",
"common/bitmap.mojom",
"common/bluetooth.mojom",
"common/boot_phase_monitor.mojom",
"common/cast_receiver.mojom",
"common/cert_store.mojom",
"common/clipboard.mojom",
"common/crash_collector.mojom",
"common/enterprise_reporting.mojom",
"common/file_system.mojom",
"common/gfx.mojom",
"common/ime.mojom",
"common/intent_helper.mojom",
"common/kiosk.mojom",
"common/lock_screen.mojom",
"common/metrics.mojom",
"common/midis.mojom",
"common/net.mojom",
"common/notifications.mojom",
"common/obb_mounter.mojom",
"common/oemcrypto.mojom",
"common/oemcrypto_daemon.mojom",
"common/policy.mojom",
"common/power.mojom",
"common/print.mojom",
"common/process.mojom",
"common/protected_buffer_manager.mojom",
"common/rotation_lock.mojom",
"common/scale_factor.mojom",
"common/storage_manager.mojom",
"common/tracing.mojom",
"common/tts.mojom",
"common/video.mojom",
"common/video_common.mojom",
"common/video_decode_accelerator.mojom",
"common/video_encode_accelerator.mojom",
"common/voice_interaction_arc_home.mojom",
"common/voice_interaction_framework.mojom",
"common/volume_mounter.mojom",
"common/wallpaper.mojom",
]
public_deps = [
"//mojo/common:common_custom_types",
"//ui/gfx/geometry/mojo",
] ]
} }
......
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//mojo/public/tools/bindings/mojom.gni")
if (is_chromeos) {
mojom("common") {
sources = [
"accessibility_helper.mojom",
"app.mojom",
"arc_bridge.mojom",
"audio.mojom",
"auth.mojom",
"backup_settings.mojom",
"bitmap.mojom",
"bluetooth.mojom",
"boot_phase_monitor.mojom",
"cast_receiver.mojom",
"cert_store.mojom",
"clipboard.mojom",
"crash_collector.mojom",
"enterprise_reporting.mojom",
"file_system.mojom",
"gfx.mojom",
"ime.mojom",
"intent_helper.mojom",
"kiosk.mojom",
"lock_screen.mojom",
"metrics.mojom",
"midis.mojom",
"net.mojom",
"notifications.mojom",
"obb_mounter.mojom",
"oemcrypto.mojom",
"oemcrypto_daemon.mojom",
"policy.mojom",
"power.mojom",
"print.mojom",
"process.mojom",
"rotation_lock.mojom",
"scale_factor.mojom",
"storage_manager.mojom",
"tracing.mojom",
"tts.mojom",
"voice_interaction_arc_home.mojom",
"voice_interaction_framework.mojom",
"volume_mounter.mojom",
"wallpaper.mojom",
]
public_deps = [
":media",
"//mojo/common:common_custom_types",
"//ui/gfx/geometry/mojo",
]
}
}
# Media related mojo interfaces. There are used by
# //services/ui/public/interfaces. We have this separate mojom target to avoid
# pulling in unnecessary interfaces,
mojom("media") {
sources = [
"protected_buffer_manager.mojom",
"video.mojom",
"video_common.mojom",
"video_decode_accelerator.mojom",
"video_encode_accelerator.mojom",
]
public_deps = [
"//mojo/common:common_custom_types",
"//ui/gfx/geometry/mojo",
]
}
...@@ -11,6 +11,9 @@ traits_headers = [ "//components/arc/common/video_accelerator_struct_traits.h" ] ...@@ -11,6 +11,9 @@ traits_headers = [ "//components/arc/common/video_accelerator_struct_traits.h" ]
sources = [ sources = [
"//components/arc/common/video_accelerator_struct_traits.cc", "//components/arc/common/video_accelerator_struct_traits.cc",
] ]
deps = [
"//ui/gfx/geometry",
]
type_mappings = [ type_mappings = [
"arc.mojom.VideoFramePlane=arc::VideoFramePlane[move_only]", "arc.mojom.VideoFramePlane=arc::VideoFramePlane[move_only]",
"arc.mojom.Size=gfx::Size", "arc.mojom.Size=gfx::Size",
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
mojom = "//components/arc/common/video_encode_accelerator.mojom" mojom = "//components/arc/common/video_encode_accelerator.mojom"
public_headers = [ "//media/video/video_encode_accelerator.h" ] public_headers = [ "//media/video/video_encode_accelerator.h" ]
public_deps = [ public_deps = [
"//media", "//media/gpu",
] ]
traits_headers = traits_headers =
[ "//components/arc/common/video_encode_accelerator_struct_traits.h" ] [ "//components/arc/common/video_encode_accelerator_struct_traits.h" ]
......
...@@ -3,14 +3,16 @@ ...@@ -3,14 +3,16 @@
# found in the LICENSE file. # found in the LICENSE file.
mojom = "//components/arc/common/volume_mounter.mojom" mojom = "//components/arc/common/volume_mounter.mojom"
public_headers = [ "//chromeos/disks/disk_mount_manager.h" ] public_headers = [
"//chromeos/chromeos_export.h",
"//chromeos/dbus/cros_disks_client.h",
"//chromeos/dbus/dbus_client_implementation_type.h",
"//chromeos/disks/disk_mount_manager.h",
]
traits_headers = [ "//components/arc/volume_mounter/volume_mounter_traits.h" ] traits_headers = [ "//components/arc/volume_mounter/volume_mounter_traits.h" ]
sources = [ sources = [
"//components/arc/volume_mounter/volume_mounter_traits.cc", "//components/arc/volume_mounter/volume_mounter_traits.cc",
] ]
deps = [
"//chromeos",
]
type_mappings = [ type_mappings = [
"arc.mojom.DeviceType=chromeos::DeviceType", "arc.mojom.DeviceType=chromeos::DeviceType",
"arc.mojom.MountEvent=chromeos::disks::DiskMountManager::MountEvent", "arc.mojom.MountEvent=chromeos::disks::DiskMountManager::MountEvent",
......
...@@ -18,7 +18,7 @@ static_library("video_accelerator") { ...@@ -18,7 +18,7 @@ static_library("video_accelerator") {
] ]
deps = [ deps = [
"//components/arc:arc_bindings", "//components/arc/common:media",
"//media/gpu", "//media/gpu",
"//ui/ozone", "//ui/ozone",
] ]
......
...@@ -59,6 +59,15 @@ class TestGpuService : public mojom::GpuService { ...@@ -59,6 +59,15 @@ class TestGpuService : public mojom::GpuService {
void CloseChannel(int32_t client_id) override {} void CloseChannel(int32_t client_id) override {}
void CreateArcVideoDecodeAccelerator(
arc::mojom::VideoDecodeAcceleratorRequest vda_request) override {}
void CreateArcVideoEncodeAccelerator(
arc::mojom::VideoEncodeAcceleratorRequest vea_request) override {}
void CreateArcProtectedBufferManager(
arc::mojom::ProtectedBufferManagerRequest pbm_request) override {}
void CreateJpegDecodeAccelerator( void CreateJpegDecodeAccelerator(
media::mojom::GpuJpegDecodeAcceleratorRequest jda_request) override {} media::mojom::GpuJpegDecodeAcceleratorRequest jda_request) override {}
......
...@@ -192,6 +192,10 @@ viz_component("service") { ...@@ -192,6 +192,10 @@ viz_component("service") {
deps += [ "//ui/gfx/x" ] deps += [ "//ui/gfx/x" ]
} }
if (is_chromeos) {
deps += [ "//components/arc/video_accelerator" ]
}
if (is_mac) { if (is_mac) {
sources += [ sources += [
"display_embedder/compositor_overlay_candidate_validator_mac.h", "display_embedder/compositor_overlay_candidate_validator_mac.h",
......
include_rules = [ include_rules = [
"+components/arc/video_accelerator",
"+gpu/command_buffer", "+gpu/command_buffer",
"+gpu/config", "+gpu/config",
"+gpu/ipc", "+gpu/ipc",
......
...@@ -51,6 +51,13 @@ ...@@ -51,6 +51,13 @@
#include "media/gpu/android/content_video_view_overlay_allocator.h" #include "media/gpu/android/content_video_view_overlay_allocator.h"
#endif #endif
#if defined(OS_CHROMEOS)
#include "components/arc/video_accelerator/gpu_arc_video_decode_accelerator.h"
#include "components/arc/video_accelerator/gpu_arc_video_encode_accelerator.h"
#include "components/arc/video_accelerator/protected_buffer_manager.h"
#include "components/arc/video_accelerator/protected_buffer_manager_proxy.h"
#endif // defined(OS_CHROMEOS)
#if defined(OS_WIN) #if defined(OS_WIN)
#include "gpu/ipc/service/direct_composition_surface_win.h" #include "gpu/ipc/service/direct_composition_surface_win.h"
#endif #endif
...@@ -111,6 +118,9 @@ GpuServiceImpl::GpuServiceImpl( ...@@ -111,6 +118,9 @@ GpuServiceImpl::GpuServiceImpl(
bindings_(base::MakeUnique<mojo::BindingSet<mojom::GpuService>>()), bindings_(base::MakeUnique<mojo::BindingSet<mojom::GpuService>>()),
weak_ptr_factory_(this) { weak_ptr_factory_(this) {
DCHECK(!io_runner_->BelongsToCurrentThread()); DCHECK(!io_runner_->BelongsToCurrentThread());
#if defined(OS_CHROMEOS)
protected_buffer_manager_ = std::make_unique<arc::ProtectedBufferManager>();
#endif // defined(OS_CHROMEOS)
weak_ptr_ = weak_ptr_factory_.GetWeakPtr(); weak_ptr_ = weak_ptr_factory_.GetWeakPtr();
} }
...@@ -231,6 +241,76 @@ void GpuServiceImpl::RecordLogMessage(int severity, ...@@ -231,6 +241,76 @@ void GpuServiceImpl::RecordLogMessage(int severity,
(*gpu_host_)->RecordLogMessage(severity, header, message); (*gpu_host_)->RecordLogMessage(severity, header, message);
} }
void GpuServiceImpl::CreateArcVideoDecodeAccelerator(
arc::mojom::VideoDecodeAcceleratorRequest vda_request) {
#if defined(OS_CHROMEOS)
DCHECK(io_runner_->BelongsToCurrentThread());
main_runner_->PostTask(
FROM_HERE,
base::BindOnce(
&GpuServiceImpl::CreateArcVideoDecodeAcceleratorOnMainThread,
weak_ptr_, std::move(vda_request)));
#else
NOTREACHED();
#endif // defined(OS_CHROMEOS)
}
void GpuServiceImpl::CreateArcVideoEncodeAccelerator(
arc::mojom::VideoEncodeAcceleratorRequest vea_request) {
#if defined(OS_CHROMEOS)
DCHECK(io_runner_->BelongsToCurrentThread());
main_runner_->PostTask(
FROM_HERE,
base::BindOnce(
&GpuServiceImpl::CreateArcVideoEncodeAcceleratorOnMainThread,
weak_ptr_, std::move(vea_request)));
#else
NOTREACHED();
#endif // defined(OS_CHROMEOS)
}
void GpuServiceImpl::CreateArcProtectedBufferManager(
arc::mojom::ProtectedBufferManagerRequest pbm_request) {
#if defined(OS_CHROMEOS)
DCHECK(io_runner_->BelongsToCurrentThread());
main_runner_->PostTask(
FROM_HERE,
base::BindOnce(
&GpuServiceImpl::CreateArcProtectedBufferManagerOnMainThread,
weak_ptr_, std::move(pbm_request)));
#else
NOTREACHED();
#endif // defined(OS)CHROMEOS)
}
#if defined(OS_CHROMEOS)
void GpuServiceImpl::CreateArcVideoDecodeAcceleratorOnMainThread(
arc::mojom::VideoDecodeAcceleratorRequest vda_request) {
DCHECK(main_runner_->BelongsToCurrentThread());
mojo::MakeStrongBinding(
std::make_unique<arc::GpuArcVideoDecodeAccelerator>(
gpu_preferences_, protected_buffer_manager_.get()),
std::move(vda_request));
}
void GpuServiceImpl::CreateArcVideoEncodeAcceleratorOnMainThread(
arc::mojom::VideoEncodeAcceleratorRequest vea_request) {
DCHECK(main_runner_->BelongsToCurrentThread());
mojo::MakeStrongBinding(
std::make_unique<arc::GpuArcVideoEncodeAccelerator>(gpu_preferences_),
std::move(vea_request));
}
void GpuServiceImpl::CreateArcProtectedBufferManagerOnMainThread(
arc::mojom::ProtectedBufferManagerRequest pbm_request) {
DCHECK(main_runner_->BelongsToCurrentThread());
mojo::MakeStrongBinding(
std::make_unique<arc::GpuArcProtectedBufferManagerProxy>(
protected_buffer_manager_.get()),
std::move(pbm_request));
}
#endif // defined(OS_CHROMEOS)
void GpuServiceImpl::CreateJpegDecodeAccelerator( void GpuServiceImpl::CreateJpegDecodeAccelerator(
media::mojom::GpuJpegDecodeAcceleratorRequest jda_request) { media::mojom::GpuJpegDecodeAcceleratorRequest jda_request) {
DCHECK(io_runner_->BelongsToCurrentThread()); DCHECK(io_runner_->BelongsToCurrentThread());
......
...@@ -28,6 +28,12 @@ ...@@ -28,6 +28,12 @@
#include "services/viz/privileged/interfaces/gl/gpu_service.mojom.h" #include "services/viz/privileged/interfaces/gl/gpu_service.mojom.h"
#include "ui/gfx/native_widget_types.h" #include "ui/gfx/native_widget_types.h"
#if defined(OS_CHROMEOS)
namespace arc {
class ProtectedBufferManager;
}
#endif // OS_CHROMEOS
namespace gpu { namespace gpu {
class GpuMemoryBufferFactory; class GpuMemoryBufferFactory;
class GpuWatchdogThread; class GpuWatchdogThread;
...@@ -133,6 +139,12 @@ class VIZ_SERVICE_EXPORT GpuServiceImpl : public gpu::GpuChannelManagerDelegate, ...@@ -133,6 +139,12 @@ class VIZ_SERVICE_EXPORT GpuServiceImpl : public gpu::GpuChannelManagerDelegate,
bool is_gpu_host, bool is_gpu_host,
EstablishGpuChannelCallback callback) override; EstablishGpuChannelCallback callback) override;
void CloseChannel(int32_t client_id) override; void CloseChannel(int32_t client_id) override;
void CreateArcVideoDecodeAccelerator(
arc::mojom::VideoDecodeAcceleratorRequest vda_request) override;
void CreateArcVideoEncodeAccelerator(
arc::mojom::VideoEncodeAcceleratorRequest vea_request) override;
void CreateArcProtectedBufferManager(
arc::mojom::ProtectedBufferManagerRequest pbm_request) override;
void CreateJpegDecodeAccelerator( void CreateJpegDecodeAccelerator(
media::mojom::GpuJpegDecodeAcceleratorRequest jda_request) override; media::mojom::GpuJpegDecodeAcceleratorRequest jda_request) override;
void CreateVideoEncodeAcceleratorProvider( void CreateVideoEncodeAcceleratorProvider(
...@@ -163,6 +175,15 @@ class VIZ_SERVICE_EXPORT GpuServiceImpl : public gpu::GpuChannelManagerDelegate, ...@@ -163,6 +175,15 @@ class VIZ_SERVICE_EXPORT GpuServiceImpl : public gpu::GpuChannelManagerDelegate,
void ThrowJavaException() override; void ThrowJavaException() override;
void Stop(StopCallback callback) override; void Stop(StopCallback callback) override;
#if defined(OS_CHROMEOS)
void CreateArcVideoDecodeAcceleratorOnMainThread(
arc::mojom::VideoDecodeAcceleratorRequest vda_request);
void CreateArcVideoEncodeAcceleratorOnMainThread(
arc::mojom::VideoEncodeAcceleratorRequest vea_request);
void CreateArcProtectedBufferManagerOnMainThread(
arc::mojom::ProtectedBufferManagerRequest pbm_request);
#endif // defined(OS_CHROMEOS)
void RequestHDRStatusOnMainThread(RequestHDRStatusCallback callback); void RequestHDRStatusOnMainThread(RequestHDRStatusCallback callback);
scoped_refptr<base::SingleThreadTaskRunner> main_runner_; scoped_refptr<base::SingleThreadTaskRunner> main_runner_;
...@@ -172,7 +193,7 @@ class VIZ_SERVICE_EXPORT GpuServiceImpl : public gpu::GpuChannelManagerDelegate, ...@@ -172,7 +193,7 @@ class VIZ_SERVICE_EXPORT GpuServiceImpl : public gpu::GpuChannelManagerDelegate,
std::unique_ptr<gpu::GpuMemoryBufferFactory> gpu_memory_buffer_factory_; std::unique_ptr<gpu::GpuMemoryBufferFactory> gpu_memory_buffer_factory_;
gpu::GpuPreferences gpu_preferences_; const gpu::GpuPreferences gpu_preferences_;
// Information about the GPU, such as device and vendor ID. // Information about the GPU, such as device and vendor ID.
gpu::GPUInfo gpu_info_; gpu::GPUInfo gpu_info_;
...@@ -202,6 +223,10 @@ class VIZ_SERVICE_EXPORT GpuServiceImpl : public gpu::GpuChannelManagerDelegate, ...@@ -202,6 +223,10 @@ class VIZ_SERVICE_EXPORT GpuServiceImpl : public gpu::GpuChannelManagerDelegate,
base::CancelableTaskTracker bind_task_tracker_; base::CancelableTaskTracker bind_task_tracker_;
std::unique_ptr<mojo::BindingSet<mojom::GpuService>> bindings_; std::unique_ptr<mojo::BindingSet<mojom::GpuService>> bindings_;
#if defined(OS_CHROMEOS)
std::unique_ptr<arc::ProtectedBufferManager> protected_buffer_manager_;
#endif // defined(OS_CHROMEOS)
base::WeakPtr<GpuServiceImpl> weak_ptr_; base::WeakPtr<GpuServiceImpl> weak_ptr_;
base::WeakPtrFactory<GpuServiceImpl> weak_ptr_factory_; base::WeakPtrFactory<GpuServiceImpl> weak_ptr_factory_;
......
...@@ -35,4 +35,8 @@ source_set("main") { ...@@ -35,4 +35,8 @@ source_set("main") {
if (use_ozone) { if (use_ozone) {
deps += [ "//ui/ozone:ozone" ] deps += [ "//ui/ozone:ozone" ]
} }
if (is_chromeos) {
deps += [ "//media/gpu" ]
}
} }
...@@ -5,6 +5,7 @@ include_rules = [ ...@@ -5,6 +5,7 @@ include_rules = [
"+gpu/ipc", "+gpu/ipc",
"+gpu/ipc/common", "+gpu/ipc/common",
"+gpu/ipc/service", "+gpu/ipc/service",
"+media/gpu",
"+mojo/public/cpp", "+mojo/public/cpp",
"+services/metrics/public", "+services/metrics/public",
"+services/service_manager/public/cpp", "+services/service_manager/public/cpp",
......
...@@ -21,11 +21,16 @@ ...@@ -21,11 +21,16 @@
#include "gpu/ipc/gpu_in_process_thread_service.h" #include "gpu/ipc/gpu_in_process_thread_service.h"
#include "gpu/ipc/service/gpu_memory_buffer_factory.h" #include "gpu/ipc/service/gpu_memory_buffer_factory.h"
#include "gpu/ipc/service/gpu_watchdog_thread.h" #include "gpu/ipc/service/gpu_watchdog_thread.h"
#include "media/gpu/features.h"
#include "services/metrics/public/cpp/delegating_ukm_recorder.h" #include "services/metrics/public/cpp/delegating_ukm_recorder.h"
#include "services/metrics/public/cpp/mojo_ukm_recorder.h" #include "services/metrics/public/cpp/mojo_ukm_recorder.h"
#include "services/metrics/public/interfaces/constants.mojom.h" #include "services/metrics/public/interfaces/constants.mojom.h"
#include "services/service_manager/public/cpp/connector.h" #include "services/service_manager/public/cpp/connector.h"
#if defined(OS_CHROMEOS) && BUILDFLAG(USE_VAAPI)
#include "media/gpu/vaapi_wrapper.h"
#endif
namespace { namespace {
std::unique_ptr<base::Thread> CreateAndStartCompositorThread() { std::unique_ptr<base::Thread> CreateAndStartCompositorThread() {
...@@ -94,6 +99,14 @@ VizMainImpl::VizMainImpl(Delegate* delegate, ...@@ -94,6 +99,14 @@ VizMainImpl::VizMainImpl(Delegate* delegate,
bool success = gpu::SwitchValueToGpuPreferences(value, &gpu_preferences); bool success = gpu::SwitchValueToGpuPreferences(value, &gpu_preferences);
CHECK(success); CHECK(success);
} }
#if defined(OS_CHROMEOS) && BUILDFLAG(USE_VAAPI)
// Initialize media codec. The UI service is running in a priviliged
// process. We don't need care when to initialize media codec. When we have
// a separate GPU (or VIZ) service process, we should initialize them
// before sandboxing
media::VaapiWrapper::PreSandboxInitialization();
#endif
// Initialize GpuInit before starting the IO or compositor threads. // Initialize GpuInit before starting the IO or compositor threads.
gpu_init_ = std::make_unique<gpu::GpuInit>(); gpu_init_ = std::make_unique<gpu::GpuInit>();
gpu_init_->set_sandbox_helper(this); gpu_init_->set_sandbox_helper(this);
......
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
"url_loader" "url_loader"
], ],
"patch_service": [ "patch_file" ], "patch_service": [ "patch_file" ],
"ui": [ "display_output_protection", "video_detector" ], "ui": [ "arc_manager", "display_output_protection", "video_detector" ],
"service_manager": [ "service_manager": [
"service_manager:client_process", "service_manager:client_process",
"service_manager:instance_name", "service_manager:instance_name",
......
...@@ -109,7 +109,9 @@ component("gpu") { ...@@ -109,7 +109,9 @@ component("gpu") {
# Only local test code, GPU-related IPC code in the media layer, and # Only local test code, GPU-related IPC code in the media layer, and
# media-related content code should access //media/gpu. # media-related content code should access //media/gpu.
visibility = [ visibility = [
"//components/arc/common:media",
"//components/arc/video_accelerator", "//components/arc/video_accelerator",
"//components/viz/service/main",
"//content/gpu:*", "//content/gpu:*",
"//content/renderer:*", "//content/renderer:*",
"//media/gpu/ipc/*", "//media/gpu/ipc/*",
......
...@@ -18,9 +18,12 @@ ...@@ -18,9 +18,12 @@
"ui::mojom::InputDeviceServer", "ui::mojom::InputDeviceServer",
"ui::mojom::WindowTreeFactory" "ui::mojom::WindowTreeFactory"
], ],
"video_detector": [ "arc_manager" : [
"ui::mojom::VideoDetector" "ui::mojom::Arc"
], ],
"video_detector": [
"ui::mojom::VideoDetector"
],
// Interfaces provided by mus-gpu for mus-ws. // Interfaces provided by mus-gpu for mus-ws.
"ozone": [ "ozone": [
"ui::ozone::mojom::DeviceCursor", "ui::ozone::mojom::DeviceCursor",
......
include_rules = [ include_rules = [
"+components/arc/common",
"-services/ui/common", "-services/ui/common",
] ]
...@@ -182,7 +182,12 @@ std::unique_ptr<Gpu> Gpu::Create( ...@@ -182,7 +182,12 @@ std::unique_ptr<Gpu> Gpu::Create(
scoped_refptr<base::SingleThreadTaskRunner> task_runner) { scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
GpuPtrFactory factory = GpuPtrFactory factory =
base::BindRepeating(&DefaultFactory, connector, service_name); base::BindRepeating(&DefaultFactory, connector, service_name);
return base::WrapUnique(new Gpu(std::move(factory), std::move(task_runner))); auto gpu =
base::WrapUnique(new Gpu(std::move(factory), std::move(task_runner)));
#if defined(OS_CHROMEOS)
gpu->InitializeArc(connector, service_name);
#endif // defined(OS_CHROMEOS)
return gpu;
} }
scoped_refptr<viz::ContextProvider> Gpu::CreateContextProvider( scoped_refptr<viz::ContextProvider> Gpu::CreateContextProvider(
...@@ -209,6 +214,26 @@ scoped_refptr<viz::ContextProvider> Gpu::CreateContextProvider( ...@@ -209,6 +214,26 @@ scoped_refptr<viz::ContextProvider> Gpu::CreateContextProvider(
shared_context_provider, command_buffer_metrics::MUS_CLIENT_CONTEXT); shared_context_provider, command_buffer_metrics::MUS_CLIENT_CONTEXT);
} }
#if defined(OS_CHROMEOS)
void Gpu::CreateArcVideoDecodeAccelerator(
arc::mojom::VideoDecodeAcceleratorRequest vda_request) {
DCHECK(main_task_runner_->BelongsToCurrentThread());
arc_->CreateVideoDecodeAccelerator(std::move(vda_request));
}
void Gpu::CreateArcVideoEncodeAccelerator(
arc::mojom::VideoEncodeAcceleratorRequest vea_request) {
DCHECK(main_task_runner_->BelongsToCurrentThread());
arc_->CreateVideoEncodeAccelerator(std::move(vea_request));
}
void Gpu::CreateArcProtectedBufferManager(
arc::mojom::ProtectedBufferManagerRequest pbm_request) {
DCHECK(main_task_runner_->BelongsToCurrentThread());
arc_->CreateProtectedBufferManager(std::move(pbm_request));
}
#endif // OS_CHROMEOS
void Gpu::CreateJpegDecodeAccelerator( void Gpu::CreateJpegDecodeAccelerator(
media::mojom::GpuJpegDecodeAcceleratorRequest jda_request) { media::mojom::GpuJpegDecodeAcceleratorRequest jda_request) {
DCHECK(main_task_runner_->BelongsToCurrentThread()); DCHECK(main_task_runner_->BelongsToCurrentThread());
...@@ -331,4 +356,12 @@ std::unique_ptr<base::SharedMemory> Gpu::AllocateSharedMemory(size_t size) { ...@@ -331,4 +356,12 @@ std::unique_ptr<base::SharedMemory> Gpu::AllocateSharedMemory(size_t size) {
return std::make_unique<base::SharedMemory>(platform_handle, readonly); return std::make_unique<base::SharedMemory>(platform_handle, readonly);
} }
#if defined(OS_CHROMEOS)
void Gpu::InitializeArc(service_manager::Connector* connector,
const std::string& service_name) {
DCHECK(main_task_runner_->BelongsToCurrentThread());
connector->BindInterface(service_name, &arc_);
}
#endif // defined(OS_CHROMEOS)
} // namespace ui } // namespace ui
...@@ -11,11 +11,19 @@ ...@@ -11,11 +11,19 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/single_thread_task_runner.h" #include "base/single_thread_task_runner.h"
#include "build/build_config.h"
#include "components/viz/common/gpu/context_provider.h" #include "components/viz/common/gpu/context_provider.h"
#include "gpu/ipc/client/gpu_channel_host.h" #include "gpu/ipc/client/gpu_channel_host.h"
#include "services/ui/public/cpp/gpu/client_gpu_memory_buffer_manager.h" #include "services/ui/public/cpp/gpu/client_gpu_memory_buffer_manager.h"
#include "services/ui/public/interfaces/gpu.mojom.h" #include "services/ui/public/interfaces/gpu.mojom.h"
#if defined(OS_CHROMEOS)
#include "components/arc/common/protected_buffer_manager.mojom.h" // nogncheck https://crbug.com/784179
#include "components/arc/common/video_decode_accelerator.mojom.h" // nogncheck https://crbug.com/784179
#include "components/arc/common/video_encode_accelerator.mojom.h" // nogncheck https://crbug.com/784179
#include "services/ui/public/interfaces/arc.mojom.h"
#endif // defined(OS_CHROMEOS)
namespace service_manager { namespace service_manager {
class Connector; class Connector;
} }
...@@ -40,7 +48,14 @@ class Gpu : public gpu::GpuChannelHostFactory, ...@@ -40,7 +48,14 @@ class Gpu : public gpu::GpuChannelHostFactory,
scoped_refptr<viz::ContextProvider> CreateContextProvider( scoped_refptr<viz::ContextProvider> CreateContextProvider(
scoped_refptr<gpu::GpuChannelHost> gpu_channel); scoped_refptr<gpu::GpuChannelHost> gpu_channel);
#if defined(OS_CHROMEOS)
void CreateArcVideoDecodeAccelerator(
arc::mojom::VideoDecodeAcceleratorRequest vda_request);
void CreateArcVideoEncodeAccelerator(
arc::mojom::VideoEncodeAcceleratorRequest vea_request);
void CreateArcProtectedBufferManager(
arc::mojom::ProtectedBufferManagerRequest pbm_request);
#endif
void CreateJpegDecodeAccelerator( void CreateJpegDecodeAccelerator(
media::mojom::GpuJpegDecodeAcceleratorRequest jda_request); media::mojom::GpuJpegDecodeAcceleratorRequest jda_request);
void CreateVideoEncodeAcceleratorProvider( void CreateVideoEncodeAcceleratorProvider(
...@@ -78,6 +93,11 @@ class Gpu : public gpu::GpuChannelHostFactory, ...@@ -78,6 +93,11 @@ class Gpu : public gpu::GpuChannelHostFactory,
std::unique_ptr<base::SharedMemory> AllocateSharedMemory( std::unique_ptr<base::SharedMemory> AllocateSharedMemory(
size_t size) override; size_t size) override;
#if defined(OS_CHROMEOS)
void InitializeArc(service_manager::Connector* connector,
const std::string& service_name);
#endif // defined(OS_CHROMEOS)
scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
std::unique_ptr<ClientGpuMemoryBufferManager> gpu_memory_buffer_manager_; std::unique_ptr<ClientGpuMemoryBufferManager> gpu_memory_buffer_manager_;
...@@ -87,6 +107,10 @@ class Gpu : public gpu::GpuChannelHostFactory, ...@@ -87,6 +107,10 @@ class Gpu : public gpu::GpuChannelHostFactory,
scoped_refptr<gpu::GpuChannelHost> gpu_channel_; scoped_refptr<gpu::GpuChannelHost> gpu_channel_;
std::vector<gpu::GpuChannelEstablishedCallback> establish_callbacks_; std::vector<gpu::GpuChannelEstablishedCallback> establish_callbacks_;
#if defined(OS_CHROMEOS)
ui::mojom::ArcPtr arc_;
#endif // defined(OS_CHROMEOS)
DISALLOW_COPY_AND_ASSIGN(Gpu); DISALLOW_COPY_AND_ASSIGN(Gpu);
}; };
......
...@@ -51,6 +51,11 @@ mojom("interfaces") { ...@@ -51,6 +51,11 @@ mojom("interfaces") {
"//ui/platform_window/mojo:interfaces", "//ui/platform_window/mojo:interfaces",
] ]
if (is_chromeos) {
sources += [ "arc.mojom" ]
public_deps += [ "//components/arc/common:media" ]
}
# TODO(crbug.com/714018): Convert the implementation to use OnceCallback. # TODO(crbug.com/714018): Convert the implementation to use OnceCallback.
use_once_callback = false use_once_callback = false
} }
......
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module ui.mojom;
import "components/arc/common/protected_buffer_manager.mojom";
import "components/arc/common/video_decode_accelerator.mojom";
import "components/arc/common/video_encode_accelerator.mojom";
interface Arc {
// Create a new VideoDecodeAccelerator and binds it to |vda|.
CreateVideoDecodeAccelerator(arc.mojom.VideoDecodeAccelerator& vda);
// Create a new VideoEncodeAccelerator and binds it to |vea|.
CreateVideoEncodeAccelerator(arc.mojom.VideoEncodeAccelerator& vea);
// Create a new ProtectedBufferManager and binds it to |pbm|.
CreateProtectedBufferManager(arc.mojom.ProtectedBufferManager& pbm);
};
...@@ -327,6 +327,10 @@ void Service::OnStart() { ...@@ -327,6 +327,10 @@ void Service::OnStart() {
&Service::BindRemoteEventDispatcherRequest, base::Unretained(this))); &Service::BindRemoteEventDispatcherRequest, base::Unretained(this)));
registry_.AddInterface<mojom::VideoDetector>( registry_.AddInterface<mojom::VideoDetector>(
base::Bind(&Service::BindVideoDetectorRequest, base::Unretained(this))); base::Bind(&Service::BindVideoDetectorRequest, base::Unretained(this)));
#if defined(OS_CHROMEOS)
registry_.AddInterface<mojom::Arc>(
base::Bind(&Service::BindArcRequest, base::Unretained(this)));
#endif // defined(OS_CHROMEOS)
// On non-Linux platforms there will be no DeviceDataManager instance and no // On non-Linux platforms there will be no DeviceDataManager instance and no
// purpose in adding the Mojo interface to connect to. // purpose in adding the Mojo interface to connect to.
...@@ -548,4 +552,10 @@ void Service::BindVideoDetectorRequest(mojom::VideoDetectorRequest request) { ...@@ -548,4 +552,10 @@ void Service::BindVideoDetectorRequest(mojom::VideoDetectorRequest request) {
window_server_->video_detector()->AddBinding(std::move(request)); window_server_->video_detector()->AddBinding(std::move(request));
} }
#if defined(OS_CHROMEOS)
void Service::BindArcRequest(mojom::ArcRequest request) {
window_server_->gpu_host()->AddArc(std::move(request));
}
#endif // defined(OS_CHROMEOS)
} // namespace ui } // namespace ui
...@@ -43,6 +43,10 @@ ...@@ -43,6 +43,10 @@
#include "ui/ozone/public/client_native_pixmap_factory_ozone.h" #include "ui/ozone/public/client_native_pixmap_factory_ozone.h"
#endif #endif
#if defined(OS_CHROMEOS)
#include "services/ui/public/interfaces/arc.mojom.h"
#endif // defined(OS_CHROMEOS)
namespace discardable_memory { namespace discardable_memory {
class DiscardableSharedMemoryManager; class DiscardableSharedMemoryManager;
} }
...@@ -181,6 +185,10 @@ class Service : public service_manager::Service, ...@@ -181,6 +185,10 @@ class Service : public service_manager::Service,
void BindVideoDetectorRequest(mojom::VideoDetectorRequest request); void BindVideoDetectorRequest(mojom::VideoDetectorRequest request);
#if defined(OS_CHROMEOS)
void BindArcRequest(mojom::ArcRequest request);
#endif // defined(OS_CHROMEOS)
std::unique_ptr<ws::WindowServer> window_server_; std::unique_ptr<ws::WindowServer> window_server_;
std::unique_ptr<PlatformEventSource> event_source_; std::unique_ptr<PlatformEventSource> event_source_;
using PendingRequests = std::vector<std::unique_ptr<PendingRequest>>; using PendingRequests = std::vector<std::unique_ptr<PendingRequest>>;
......
...@@ -167,6 +167,10 @@ static_library("lib") { ...@@ -167,6 +167,10 @@ static_library("lib") {
public_deps += [ "//ui/ozone" ] public_deps += [ "//ui/ozone" ]
} }
if (is_chromeos) { if (is_chromeos) {
sources += [
"arc_client.cc",
"arc_client.h",
]
public_deps += [ "//ui/chromeos/events" ] public_deps += [ "//ui/chromeos/events" ]
if (use_ozone) { if (use_ozone) {
public_deps += [ "//ui/events/ozone:events_ozone" ] public_deps += [ "//ui/events/ozone:events_ozone" ]
......
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "services/ui/ws/arc_client.h"
#include "services/viz/privileged/interfaces/gl/gpu_service.mojom.h"
namespace ui {
namespace ws {
ArcClient::ArcClient(viz::mojom::GpuService* gpu_service)
: gpu_service_(gpu_service) {}
ArcClient::~ArcClient() {}
// mojom::Arc overrides:
void ArcClient::CreateVideoDecodeAccelerator(
arc::mojom::VideoDecodeAcceleratorRequest vda_request) {
gpu_service_->CreateArcVideoDecodeAccelerator(std::move(vda_request));
}
void ArcClient::CreateVideoEncodeAccelerator(
arc::mojom::VideoEncodeAcceleratorRequest vea_request) {
gpu_service_->CreateArcVideoEncodeAccelerator(std::move(vea_request));
}
void ArcClient::CreateProtectedBufferManager(
arc::mojom::ProtectedBufferManagerRequest pbm_request) {
gpu_service_->CreateArcProtectedBufferManager(std::move(pbm_request));
}
} // namespace ws
} // namespace ui
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SERVICES_UI_WS_ARC_CLIENT_H_
#define SERVICES_UI_WS_ARC_CLIENT_H_
#include "services/ui/public/interfaces/arc.mojom.h"
namespace viz {
namespace mojom {
class GpuService;
} // namespace mojom
} // namespace viz
namespace ui {
namespace ws {
// The implementation that relays requests from clients to the real
// service implementation in the GPU process over mojom.GpuService.
class ArcClient : public mojom::Arc {
public:
explicit ArcClient(viz::mojom::GpuService* gpu_service);
~ArcClient() override;
private:
// mojom::Arc overrides:
void CreateVideoDecodeAccelerator(
arc::mojom::VideoDecodeAcceleratorRequest vda_request) override;
void CreateVideoEncodeAccelerator(
arc::mojom::VideoEncodeAcceleratorRequest vea_request) override;
void CreateProtectedBufferManager(
arc::mojom::ProtectedBufferManagerRequest pbm_request) override;
// The objects these pointers refer to are owned by the GpuHost object.
viz::mojom::GpuService* gpu_service_;
DISALLOW_COPY_AND_ASSIGN(ArcClient);
};
} // namespace ws
} // namespace ui
#endif // SERVICES_UI_WS_ARC_CLIENT_H_
...@@ -26,6 +26,10 @@ ...@@ -26,6 +26,10 @@
#include "ui/gfx/win/rendering_window_manager.h" #include "ui/gfx/win/rendering_window_manager.h"
#endif #endif
#if defined(OS_CHROMEOS)
#include "services/ui/ws/arc_client.h"
#endif
namespace ui { namespace ui {
namespace ws { namespace ws {
...@@ -108,6 +112,13 @@ void DefaultGpuHost::CreateFrameSinkManager( ...@@ -108,6 +112,13 @@ void DefaultGpuHost::CreateFrameSinkManager(
viz_main_->CreateFrameSinkManager(std::move(params)); viz_main_->CreateFrameSinkManager(std::move(params));
} }
#if defined(OS_CHROMEOS)
void DefaultGpuHost::AddArc(mojom::ArcRequest request) {
arc_bindings_.AddBinding(std::make_unique<ArcClient>(gpu_service_.get()),
std::move(request));
}
#endif // defined(OS_CHROMEOS)
GpuClient* DefaultGpuHost::AddInternal(mojom::GpuRequest request) { GpuClient* DefaultGpuHost::AddInternal(mojom::GpuRequest request) {
auto client(std::make_unique<GpuClient>( auto client(std::make_unique<GpuClient>(
next_client_id_++, &gpu_info_, &gpu_feature_info_, next_client_id_++, &gpu_info_, &gpu_feature_info_,
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "base/single_thread_task_runner.h" #include "base/single_thread_task_runner.h"
#include "base/synchronization/waitable_event.h" #include "base/synchronization/waitable_event.h"
#include "base/threading/thread.h" #include "base/threading/thread.h"
#include "build/build_config.h"
#include "components/viz/service/main/viz_main_impl.h" #include "components/viz/service/main/viz_main_impl.h"
#include "gpu/config/gpu_feature_info.h" #include "gpu/config/gpu_feature_info.h"
#include "gpu/config/gpu_info.h" #include "gpu/config/gpu_info.h"
...@@ -19,6 +20,10 @@ ...@@ -19,6 +20,10 @@
#include "services/viz/privileged/interfaces/gl/gpu_host.mojom.h" #include "services/viz/privileged/interfaces/gl/gpu_host.mojom.h"
#include "services/viz/privileged/interfaces/gl/gpu_service.mojom.h" #include "services/viz/privileged/interfaces/gl/gpu_service.mojom.h"
#if defined(OS_CHROMEOS)
#include "services/ui/public/interfaces/arc.mojom.h"
#endif // defined(OS_CHROMEOS)
namespace service_manager { namespace service_manager {
class Connector; class Connector;
} }
...@@ -53,6 +58,10 @@ class GpuHost { ...@@ -53,6 +58,10 @@ class GpuHost {
// Requests a viz::mojom::FrameSinkManager interface from viz. // Requests a viz::mojom::FrameSinkManager interface from viz.
virtual void CreateFrameSinkManager( virtual void CreateFrameSinkManager(
viz::mojom::FrameSinkManagerParamsPtr params) = 0; viz::mojom::FrameSinkManagerParamsPtr params) = 0;
#if defined(OS_CHROMEOS)
virtual void AddArc(mojom::ArcRequest request) = 0;
#endif // defined(OS_CHROMEOS)
}; };
class DefaultGpuHost : public GpuHost, public viz::mojom::GpuHost { class DefaultGpuHost : public GpuHost, public viz::mojom::GpuHost {
...@@ -76,6 +85,9 @@ class DefaultGpuHost : public GpuHost, public viz::mojom::GpuHost { ...@@ -76,6 +85,9 @@ class DefaultGpuHost : public GpuHost, public viz::mojom::GpuHost {
void OnAcceleratedWidgetDestroyed(gfx::AcceleratedWidget widget) override; void OnAcceleratedWidgetDestroyed(gfx::AcceleratedWidget widget) override;
void CreateFrameSinkManager( void CreateFrameSinkManager(
viz::mojom::FrameSinkManagerParamsPtr params) override; viz::mojom::FrameSinkManagerParamsPtr params) override;
#if defined(OS_CHROMEOS)
void AddArc(mojom::ArcRequest request) override;
#endif // defined(OS_CHROMEOS)
// viz::mojom::GpuHost: // viz::mojom::GpuHost:
void DidInitialize(const gpu::GPUInfo& gpu_info, void DidInitialize(const gpu::GPUInfo& gpu_info,
...@@ -115,6 +127,9 @@ class DefaultGpuHost : public GpuHost, public viz::mojom::GpuHost { ...@@ -115,6 +127,9 @@ class DefaultGpuHost : public GpuHost, public viz::mojom::GpuHost {
base::WaitableEvent viz_main_wait_; base::WaitableEvent viz_main_wait_;
mojo::StrongBindingSet<mojom::Gpu> gpu_bindings_; mojo::StrongBindingSet<mojom::Gpu> gpu_bindings_;
#if defined(OS_CHROMEOS)
mojo::StrongBindingSet<mojom::Arc> arc_bindings_;
#endif // defined(OS_CHROMEOS)
DISALLOW_COPY_AND_ASSIGN(DefaultGpuHost); DISALLOW_COPY_AND_ASSIGN(DefaultGpuHost);
}; };
......
...@@ -23,6 +23,9 @@ class TestGpuHost : public GpuHost { ...@@ -23,6 +23,9 @@ class TestGpuHost : public GpuHost {
void OnAcceleratedWidgetDestroyed(gfx::AcceleratedWidget widget) override {} void OnAcceleratedWidgetDestroyed(gfx::AcceleratedWidget widget) override {}
void CreateFrameSinkManager( void CreateFrameSinkManager(
viz::mojom::FrameSinkManagerParamsPtr params) override; viz::mojom::FrameSinkManagerParamsPtr params) override;
#if defined(OS_CHROMEOS)
void AddArc(mojom::ArcRequest request) override {}
#endif // defined(OS_CHROMEOS)
std::unique_ptr<viz::TestFrameSinkManagerImpl> frame_sink_manager_; std::unique_ptr<viz::TestFrameSinkManagerImpl> frame_sink_manager_;
......
...@@ -12,6 +12,7 @@ mojom("gl") { ...@@ -12,6 +12,7 @@ mojom("gl") {
] ]
public_deps = [ public_deps = [
"//components/arc/common:media",
"//gpu/ipc/common:interfaces", "//gpu/ipc/common:interfaces",
"//media/gpu/mojo:jpeg_decoder", "//media/gpu/mojo:jpeg_decoder",
"//media/mojo/interfaces", "//media/mojo/interfaces",
......
...@@ -4,6 +4,9 @@ ...@@ -4,6 +4,9 @@
module viz.mojom; module viz.mojom;
import "components/arc/common/protected_buffer_manager.mojom";
import "components/arc/common/video_decode_accelerator.mojom";
import "components/arc/common/video_encode_accelerator.mojom";
import "gpu/ipc/common/gpu_info.mojom"; import "gpu/ipc/common/gpu_info.mojom";
import "gpu/ipc/common/memory_stats.mojom"; import "gpu/ipc/common/memory_stats.mojom";
import "gpu/ipc/common/surface_handle.mojom"; import "gpu/ipc/common/surface_handle.mojom";
...@@ -25,6 +28,15 @@ interface GpuService { ...@@ -25,6 +28,15 @@ interface GpuService {
// If no channel can be identified, do nothing. // If no channel can be identified, do nothing.
CloseChannel(int32 client_id); CloseChannel(int32 client_id);
// Create a new ARC VideoDecodeAccelerator and binds it to |vda|.
CreateArcVideoDecodeAccelerator(arc.mojom.VideoDecodeAccelerator& vda);
// Create a new ARC VideoEncodeAccelerator and binds it to |vea|.
CreateArcVideoEncodeAccelerator(arc.mojom.VideoEncodeAccelerator& vea);
// Create a new ARC ProtectedBufferManager and binds it to |pbm|.
CreateArcProtectedBufferManager(arc.mojom.ProtectedBufferManager& pbm);
// Creates a new JpegDecodeAccelerator and binds it to |jda|. // Creates a new JpegDecodeAccelerator and binds it to |jda|.
CreateJpegDecodeAccelerator(media.mojom.GpuJpegDecodeAccelerator& jda); CreateJpegDecodeAccelerator(media.mojom.GpuJpegDecodeAccelerator& jda);
......
...@@ -145,6 +145,11 @@ void Env::SetWindowTreeClient(WindowTreeClient* window_tree_client) { ...@@ -145,6 +145,11 @@ void Env::SetWindowTreeClient(WindowTreeClient* window_tree_client) {
window_tree_client_ = window_tree_client; window_tree_client_ = window_tree_client;
} }
ui::Gpu* Env::GetGpuConnection() {
DCHECK(window_tree_client_);
return window_tree_client_->gpu();
}
void Env::ScheduleEmbed( void Env::ScheduleEmbed(
ui::mojom::WindowTreeClientPtr client, ui::mojom::WindowTreeClientPtr client,
base::OnceCallback<void(const base::UnguessableToken&)> callback) { base::OnceCallback<void(const base::UnguessableToken&)> callback) {
......
...@@ -40,6 +40,7 @@ class InterfacePtr; ...@@ -40,6 +40,7 @@ class InterfacePtr;
namespace ui { namespace ui {
class ContextFactory; class ContextFactory;
class ContextFactoryPrivate; class ContextFactoryPrivate;
class Gpu;
class PlatformEventSource; class PlatformEventSource;
namespace mojom { namespace mojom {
class WindowTreeClient; class WindowTreeClient;
...@@ -129,6 +130,8 @@ class AURA_EXPORT Env : public ui::EventTarget, ...@@ -129,6 +130,8 @@ class AURA_EXPORT Env : public ui::EventTarget,
void SetWindowTreeClient(WindowTreeClient* window_tree_client); void SetWindowTreeClient(WindowTreeClient* window_tree_client);
bool HasWindowTreeClient() const { return window_tree_client_ != nullptr; } bool HasWindowTreeClient() const { return window_tree_client_ != nullptr; }
ui::Gpu* GetGpuConnection();
// Schedules an embed of a client. See // Schedules an embed of a client. See
// mojom::WindowTreeClient::ScheduleEmbed() for details. // mojom::WindowTreeClient::ScheduleEmbed() for details.
void ScheduleEmbed( void ScheduleEmbed(
......
...@@ -191,6 +191,8 @@ class AURA_EXPORT WindowTreeClient ...@@ -191,6 +191,8 @@ class AURA_EXPORT WindowTreeClient
void AddTestObserver(WindowTreeClientTestObserver* observer); void AddTestObserver(WindowTreeClientTestObserver* observer);
void RemoveTestObserver(WindowTreeClientTestObserver* observer); void RemoveTestObserver(WindowTreeClientTestObserver* observer);
ui::Gpu* gpu() { return gpu_.get(); }
private: private:
friend class InFlightBoundsChange; friend class InFlightBoundsChange;
friend class InFlightFocusChange; friend class InFlightFocusChange;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment