Commit 82d8ee1e authored by Michael Spang's avatar Michael Spang Committed by Commit Bot

ozone: scenic: Enable vulkan VizDisplayCompositor with scenic

This enables GPU process VulkanSurfaces to present to Scenic views. Each
surface sends a message to the browser over mojo asking to export a node
to attach the surface resources to. Once this export occurs, the surface
contents will be visible in the global scene.

Bug: 861853
Test: run_content_shell \
  --enable-features=VizDisplayCompositor,UseSkiaRenderer,UseSkiaDeferredDisplayList,UiGpuRasterization,OzoneDrmMojo
  --enable-oop-rasterization --enable-vulkan --enable-gpu-rasterization \
  --enable-raster-to-sk-image --use-raster-context-provider \
  --force-gpu-rasterization --use-gl=swiftshader --no-sandbox \
  --disable-gpu-sandbox

Change-Id: Ib39c7f2a6bcb833fbd2cd3e0718229efb69ca940

Reviewed-on: https://chromium-review.googlesource.com/c/1343277Reviewed-by: default avatarKen Rockot <rockot@google.com>
Reviewed-by: default avatarKen Buchanan <kenrb@chromium.org>
Reviewed-by: default avatarRobert Kroeger <rjkroege@chromium.org>
Reviewed-by: default avatarSergey Ulanov <sergeyu@chromium.org>
Commit-Queue: Michael Spang <spang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#611883}
parent bde6d04f
......@@ -15,6 +15,7 @@
"ui.ozone.mojom.DeviceCursor",
"ui.ozone.mojom.DrmDevice",
"ui.ozone.mojom.WaylandConnectionClient",
"ui.mojom.ScenicGpuService",
"viz.mojom.CompositingModeReporter",
"viz.mojom.VizMain"
],
......
......@@ -14,6 +14,10 @@ source_set("scenic") {
"client_native_pixmap_factory_scenic.h",
"ozone_platform_scenic.cc",
"ozone_platform_scenic.h",
"scenic_gpu_host.cc",
"scenic_gpu_host.h",
"scenic_gpu_service.cc",
"scenic_gpu_service.h",
"scenic_screen.cc",
"scenic_screen.h",
"scenic_surface_factory.cc",
......@@ -30,6 +34,8 @@ source_set("scenic") {
deps = [
"//base",
"//mojo/public/cpp/system",
"//services/service_manager/public/cpp",
"//skia",
"//third_party/fuchsia-sdk/sdk:gfx",
"//third_party/fuchsia-sdk/sdk:images",
......@@ -45,6 +51,7 @@ source_set("scenic") {
"//ui/gfx/geometry",
"//ui/ozone:ozone_base",
"//ui/ozone/common",
"//ui/ozone/public/interfaces",
"//ui/platform_window",
]
......
include_rules = [
"+mojo/public",
"+third_party/skia/include",
"+ui/base/ime",
]
......@@ -19,6 +19,8 @@
#include "ui/events/platform/platform_event_source.h"
#include "ui/events/system_input_injector.h"
#include "ui/ozone/common/stub_overlay_manager.h"
#include "ui/ozone/platform/scenic/scenic_gpu_host.h"
#include "ui/ozone/platform/scenic/scenic_gpu_service.h"
#include "ui/ozone/platform/scenic/scenic_surface_factory.h"
#include "ui/ozone/platform/scenic/scenic_window.h"
#include "ui/ozone/platform/scenic/scenic_window_manager.h"
......@@ -26,6 +28,7 @@
#include "ui/ozone/public/cursor_factory_ozone.h"
#include "ui/ozone/public/gpu_platform_support_host.h"
#include "ui/ozone/public/input_controller.h"
#include "ui/ozone/public/interfaces/scenic_gpu_service.mojom.h"
#include "ui/ozone/public/ozone_platform.h"
#include "ui/ozone/public/ozone_switches.h"
#include "ui/platform_window/platform_window_init_properties.h"
......@@ -54,14 +57,12 @@ class OzonePlatformScenic
: public OzonePlatform,
public base::MessageLoopCurrent::DestructionObserver {
public:
OzonePlatformScenic()
: window_manager_(std::make_unique<ScenicWindowManager>()),
surface_factory_(window_manager_.get()) {}
OzonePlatformScenic() {}
~OzonePlatformScenic() override = default;
// OzonePlatform implementation.
ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() override {
return &surface_factory_;
return surface_factory_.get();
}
OverlayManagerOzone* GetOverlayManager() override {
......@@ -77,7 +78,7 @@ class OzonePlatformScenic
}
GpuPlatformSupportHost* GetGpuPlatformSupportHost() override {
return gpu_platform_support_host_.get();
return scenic_gpu_host_.get();
}
std::unique_ptr<SystemInputInjector> CreateSystemInputInjector() override {
......@@ -116,21 +117,38 @@ class OzonePlatformScenic
KeyboardLayoutEngineManager::SetKeyboardLayoutEngine(
std::make_unique<StubKeyboardLayoutEngine>());
window_manager_ = std::make_unique<ScenicWindowManager>();
overlay_manager_ = std::make_unique<StubOverlayManager>();
input_controller_ = CreateStubInputController();
cursor_factory_ozone_ = std::make_unique<BitmapCursorFactoryOzone>();
gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost());
base::MessageLoopCurrent::Get()->AddDestructionObserver(this);
surface_factory_ =
std::make_unique<ScenicSurfaceFactory>(window_manager_.get());
scenic_gpu_host_ = std::make_unique<ScenicGpuHost>(window_manager_.get());
}
void InitializeGPU(const InitParams& params) override {}
void InitializeGPU(const InitParams& params) override {
scenic_gpu_service_ = std::make_unique<ScenicGpuService>();
DCHECK(!surface_factory_);
surface_factory_ =
std::make_unique<ScenicSurfaceFactory>(scenic_gpu_service_.get());
}
base::MessageLoop::Type GetMessageLoopTypeForGpu() override {
// Scenic FIDL calls require async dispatcher.
return base::MessageLoop::TYPE_IO;
}
void AddInterfaces(service_manager::BinderRegistry* registry) override {
registry->AddInterface<mojom::ScenicGpuService>(
scenic_gpu_service_->GetBinderCallback(),
base::ThreadTaskRunnerHandle::Get());
}
private:
// Performs graceful cleanup tasks on main message loop teardown.
void Shutdown() { window_manager_.reset(); }
......@@ -139,13 +157,15 @@ class OzonePlatformScenic
void WillDestroyCurrentMessageLoop() override { Shutdown(); }
std::unique_ptr<ScenicWindowManager> window_manager_;
ScenicSurfaceFactory surface_factory_;
std::unique_ptr<PlatformEventSource> platform_event_source_;
std::unique_ptr<CursorFactoryOzone> cursor_factory_ozone_;
std::unique_ptr<InputController> input_controller_;
std::unique_ptr<GpuPlatformSupportHost> gpu_platform_support_host_;
std::unique_ptr<OverlayManagerOzone> overlay_manager_;
std::unique_ptr<ScenicGpuHost> scenic_gpu_host_;
std::unique_ptr<ScenicGpuService> scenic_gpu_service_;
std::unique_ptr<ScenicSurfaceFactory> surface_factory_;
DISALLOW_COPY_AND_ASSIGN(OzonePlatformScenic);
};
......
// Copyright 2018 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 "ui/ozone/platform/scenic/scenic_gpu_host.h"
#include <inttypes.h>
#include "base/callback.h"
#include "base/single_thread_task_runner.h"
#include "base/threading/thread_task_runner_handle.h"
#include "mojo/public/cpp/bindings/interface_request.h"
#include "mojo/public/cpp/system/message_pipe.h"
#include "mojo/public/cpp/system/platform_handle.h"
#include "ui/ozone/platform/scenic/scenic_window.h"
#include "ui/ozone/platform/scenic/scenic_window_manager.h"
#include "ui/ozone/public/interfaces/scenic_gpu_host.mojom.h"
#include "ui/ozone/public/interfaces/scenic_gpu_service.mojom.h"
namespace {
using BinderCallback =
base::RepeatingCallback<void(const std::string&,
mojo::ScopedMessagePipeHandle)>;
template <typename Interface>
void BindInterface(mojo::InterfaceRequest<Interface> request,
const BinderCallback& binder_callback) {
binder_callback.Run(Interface::Name_, request.PassMessagePipe());
}
} // namespace
namespace ui {
ScenicGpuHost::ScenicGpuHost(ScenicWindowManager* scenic_window_manager)
: scenic_window_manager_(scenic_window_manager),
binding_(this),
ui_thread_runner_(base::ThreadTaskRunnerHandle::Get()),
weak_ptr_factory_(this) {
DETACH_FROM_THREAD(io_thread_checker_);
}
ScenicGpuHost::~ScenicGpuHost() {
DCHECK_CALLED_ON_VALID_THREAD(ui_thread_checker_);
}
void ScenicGpuHost::ExportParent(int32_t surface_handle,
mojo::ScopedHandle export_token_mojo) {
DCHECK_CALLED_ON_VALID_THREAD(ui_thread_checker_);
ScenicWindow* scenic_window =
scenic_window_manager_->GetWindow(surface_handle);
if (!scenic_window)
return;
zx::eventpair export_token(
mojo::UnwrapPlatformHandle(std::move(export_token_mojo)).TakeHandle());
scenic_window->ExportRenderingEntity(std::move(export_token));
}
void ScenicGpuHost::OnGpuProcessLaunched(
int host_id,
scoped_refptr<base::SingleThreadTaskRunner> ui_runner,
scoped_refptr<base::SingleThreadTaskRunner> send_runner,
const base::RepeatingCallback<void(IPC::Message*)>& send_callback) {
NOTREACHED();
}
void ScenicGpuHost::OnChannelDestroyed(int host_id) {}
void ScenicGpuHost::OnGpuServiceLaunched(
scoped_refptr<base::SingleThreadTaskRunner> ui_runner,
scoped_refptr<base::SingleThreadTaskRunner> io_runner,
GpuHostBindInterfaceCallback binder,
GpuHostTerminateCallback terminate_callback) {
DCHECK_CALLED_ON_VALID_THREAD(io_thread_checker_);
mojom::ScenicGpuServicePtr scenic_gpu_service;
BindInterface(mojo::MakeRequest(&scenic_gpu_service), binder);
ui_thread_runner_->PostTask(
FROM_HERE, base::BindOnce(&ScenicGpuHost::OnGpuServiceLaunchedOnUI,
weak_ptr_factory_.GetWeakPtr(),
scenic_gpu_service.PassInterface()));
}
void ScenicGpuHost::OnGpuServiceLaunchedOnUI(
mojo::InterfacePtrInfo<mojom::ScenicGpuService> gpu_service_ptr_info) {
DCHECK_CALLED_ON_VALID_THREAD(ui_thread_checker_);
mojom::ScenicGpuHostPtr gpu_host;
binding_.Close();
binding_.Bind(mojo::MakeRequest(&gpu_host));
gpu_service_.Bind(std::move(gpu_service_ptr_info));
gpu_service_->Initialize(std::move(gpu_host));
}
void ScenicGpuHost::OnMessageReceived(const IPC::Message& message) {
NOTREACHED();
}
} // namespace ui
// Copyright 2018 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 UI_OZONE_PLATFORM_SCENIC_SCENIC_GPU_HOST_H_
#define UI_OZONE_PLATFORM_SCENIC_SCENIC_GPU_HOST_H_
#include <inttypes.h>
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/single_thread_task_runner.h"
#include "base/threading/thread_checker.h"
#include "mojo/public/cpp/bindings/binding.h"
#include "ui/ozone/public/gpu_platform_support_host.h"
#include "ui/ozone/public/interfaces/scenic_gpu_host.mojom.h"
#include "ui/ozone/public/interfaces/scenic_gpu_service.mojom.h"
namespace ui {
class ScenicWindowManager;
// Browser process object which supports a GPU process host.
//
// Once a GPU process starts, this objects binds to it over mojo and
// enables exchange of Scenic resources with it. In particular, we must
// exchange export tokens for each view surface, so that the surface can
// present to Scenic views managed by the browser.
class ScenicGpuHost : public mojom::ScenicGpuHost,
public GpuPlatformSupportHost {
public:
ScenicGpuHost(ScenicWindowManager* scenic_window_manager);
~ScenicGpuHost() override;
// mojom::ScenicGpuHost:
void ExportParent(int32_t surface_handle,
mojo::ScopedHandle export_token_mojo) override;
// GpuPlatformSupportHost:
void OnGpuProcessLaunched(
int host_id,
scoped_refptr<base::SingleThreadTaskRunner> ui_runner,
scoped_refptr<base::SingleThreadTaskRunner> send_runner,
const base::RepeatingCallback<void(IPC::Message*)>& send_callback)
override;
void OnChannelDestroyed(int host_id) override;
void OnMessageReceived(const IPC::Message& message) override;
void OnGpuServiceLaunched(
scoped_refptr<base::SingleThreadTaskRunner> ui_runner,
scoped_refptr<base::SingleThreadTaskRunner> io_runner,
GpuHostBindInterfaceCallback binder,
GpuHostTerminateCallback terminate_callback) override;
private:
void OnGpuServiceLaunchedOnUI(
mojo::InterfacePtrInfo<mojom::ScenicGpuService> gpu_service_ptr_info);
void UpdateBinding(uint32_t service_launch_count,
mojom::ScenicGpuHostRequest scenic_gpu_host_request);
ScenicWindowManager* const scenic_window_manager_;
mojo::Binding<mojom::ScenicGpuHost> binding_;
mojom::ScenicGpuServicePtr gpu_service_;
scoped_refptr<base::SingleThreadTaskRunner> ui_thread_runner_;
THREAD_CHECKER(ui_thread_checker_);
THREAD_CHECKER(io_thread_checker_);
base::WeakPtrFactory<ScenicGpuHost> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(ScenicGpuHost);
};
} // namespace ui
#endif // UI_OZONE_PLATFORM_SCENIC_SCENIC_GPU_HOST_H_
// Copyright 2018 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 "ui/ozone/platform/scenic/scenic_gpu_service.h"
#include "mojo/public/c/system/message_pipe.h"
namespace ui {
namespace {
// Fulfills an InterfaceRequest<T> using an InterfacePtr<T>.
//
// Messages queued on the InterfaceRequest's message pipe are preserved and will
// be eventually delivered to the remote end of InterfacePtr<T>'s.
//
// InterfacePtr<T> must be a brand new interface; i.e., it not have been
// previously used to send a message.
template <typename Interface>
void FulfillInterfaceRequest(
mojo::InterfaceRequest<Interface> interface_request,
mojo::InterfacePtr<Interface> interface_ptr) {
MojoResult result =
mojo::FuseMessagePipes(interface_ptr.PassInterface().PassHandle(),
interface_request.PassMessagePipe());
DCHECK_EQ(result, MOJO_RESULT_OK);
}
} // namespace
ScenicGpuService::ScenicGpuService()
: gpu_host_request_(mojo::MakeRequest(&gpu_host_)),
weak_ptr_factory_(this) {}
ScenicGpuService::~ScenicGpuService() {}
base::RepeatingCallback<void(mojom::ScenicGpuServiceRequest)>
ScenicGpuService::GetBinderCallback() {
return base::BindRepeating(&ScenicGpuService::AddBinding,
weak_ptr_factory_.GetWeakPtr());
}
void ScenicGpuService::Initialize(mojom::ScenicGpuHostPtr gpu_host) {
FulfillInterfaceRequest(std::move(gpu_host_request_), std::move(gpu_host));
}
void ScenicGpuService::AddBinding(mojom::ScenicGpuServiceRequest request) {
binding_set_.AddBinding(this, std::move(request));
}
} // namespace ui
// Copyright 2018 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 UI_OZONE_PLATFORM_SCENIC_SCENIC_GPU_SERVICE_H_
#define UI_OZONE_PLATFORM_SCENIC_SCENIC_GPU_SERVICE_H_
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "mojo/public/cpp/bindings/binding_set.h"
#include "ui/ozone/public/interfaces/scenic_gpu_host.mojom.h"
#include "ui/ozone/public/interfaces/scenic_gpu_service.mojom.h"
namespace ui {
// GPU process service that enables presentation to Scenic.
//
// This object exposes a mojo service to the browser process from the GPU
// process. The browser binds it to enable exchange of Scenic resources.
// In particular, we must exchange export tokens for each view surface,
// so that surfaces can present to Scenic views managed by the browser.
class ScenicGpuService : public mojom::ScenicGpuService {
public:
ScenicGpuService();
~ScenicGpuService() override;
mojom::ScenicGpuHost* gpu_host() { return gpu_host_.get(); }
base::RepeatingCallback<void(mojom::ScenicGpuServiceRequest)>
GetBinderCallback();
// mojom::ScenicGpuService:
void Initialize(mojom::ScenicGpuHostPtr gpu_host) override;
private:
void AddBinding(mojom::ScenicGpuServiceRequest request);
mojom::ScenicGpuHostPtr gpu_host_;
mojom::ScenicGpuHostRequest gpu_host_request_;
mojo::BindingSet<mojom::ScenicGpuService> binding_set_;
base::WeakPtrFactory<ScenicGpuService> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(ScenicGpuService);
};
} // namespace ui
#endif // UI_OZONE_PLATFORM_SCENIC_SCENIC_GPU_SERVICE_H_
......@@ -16,6 +16,7 @@
#include "ui/gl/gl_surface_egl.h"
#include "ui/ozone/common/egl_util.h"
#include "ui/ozone/common/gl_ozone_egl.h"
#include "ui/ozone/platform/scenic/scenic_gpu_service.h"
#include "ui/ozone/platform/scenic/scenic_window.h"
#include "ui/ozone/platform/scenic/scenic_window_canvas.h"
#include "ui/ozone/platform/scenic/scenic_window_manager.h"
......@@ -108,6 +109,10 @@ ScenicSurfaceFactory::ScenicSurfaceFactory(ScenicWindowManager* window_manager)
: window_manager_(window_manager),
egl_implementation_(std::make_unique<GLOzoneEGLScenic>()) {}
ScenicSurfaceFactory::ScenicSurfaceFactory(ScenicGpuService* scenic_gpu_service)
: scenic_gpu_service_(scenic_gpu_service),
egl_implementation_(std::make_unique<GLOzoneEGLScenic>()) {}
ScenicSurfaceFactory::~ScenicSurfaceFactory() = default;
fuchsia::ui::scenic::Scenic* ScenicSurfaceFactory::GetScenic() {
......@@ -138,6 +143,8 @@ GLOzone* ScenicSurfaceFactory::GetGLOzone(gl::GLImplementation implementation) {
std::unique_ptr<SurfaceOzoneCanvas> ScenicSurfaceFactory::CreateCanvasForWidget(
gfx::AcceleratedWidget widget) {
if (!window_manager_)
LOG(FATAL) << "Software output not supported from GPU process";
ScenicWindow* window = window_manager_->GetWindow(widget);
if (!window)
return nullptr;
......@@ -155,8 +162,11 @@ scoped_refptr<gfx::NativePixmap> ScenicSurfaceFactory::CreateNativePixmap(
#if BUILDFLAG(ENABLE_VULKAN)
std::unique_ptr<gpu::VulkanImplementation>
ScenicSurfaceFactory::CreateVulkanImplementation() {
return std::make_unique<ui::VulkanImplementationScenic>(window_manager_,
GetScenic());
if (!scenic_gpu_service_)
LOG(FATAL) << "Vulkan implementation requires InitializeForGPU";
return std::make_unique<ui::VulkanImplementationScenic>(
scenic_gpu_service_->gpu_host(), GetScenic());
}
#endif
......
......@@ -17,10 +17,12 @@
namespace ui {
class ScenicWindowManager;
class ScenicGpuService;
class ScenicSurfaceFactory : public SurfaceFactoryOzone {
public:
explicit ScenicSurfaceFactory(ScenicWindowManager* window_manager);
explicit ScenicSurfaceFactory(ScenicGpuService* scenic_gpu_service);
~ScenicSurfaceFactory() override;
// SurfaceFactoryOzone implementation.
......@@ -41,7 +43,8 @@ class ScenicSurfaceFactory : public SurfaceFactoryOzone {
private:
fuchsia::ui::scenic::Scenic* GetScenic();
ScenicWindowManager* const window_manager_;
ScenicWindowManager* const window_manager_ = nullptr;
ScenicGpuService* scenic_gpu_service_ = nullptr;
std::unique_ptr<GLOzone> egl_implementation_;
fuchsia::ui::scenic::ScenicPtr scenic_;
......
......@@ -16,6 +16,7 @@
#include "gpu/vulkan/vulkan_function_pointers.h"
#include "gpu/vulkan/vulkan_instance.h"
#include "gpu/vulkan/vulkan_surface.h"
#include "mojo/public/cpp/system/platform_handle.h"
#include "ui/gfx/gpu_fence.h"
#include "ui/ozone/platform/scenic/scenic_window.h"
#include "ui/ozone/platform/scenic/scenic_window_manager.h"
......@@ -28,11 +29,15 @@ namespace {
// Holds resources necessary for presenting to a View using a VkSurfaceKHR.
class ScenicSurface {
public:
ScenicSurface(fuchsia::ui::scenic::Scenic* scenic)
ScenicSurface(fuchsia::ui::scenic::Scenic* scenic,
mojom::ScenicGpuHost* gpu_host,
gfx::AcceleratedWidget window)
: scenic_(scenic),
parent_(&scenic_),
shape_(&scenic_),
material_(&scenic_) {
material_(&scenic_),
gpu_host_(gpu_host),
window_(window) {
shape_.SetShape(scenic::Rectangle(&scenic_, 1.f, 1.f));
shape_.SetMaterial(material_);
}
......@@ -47,15 +52,17 @@ class ScenicSurface {
scenic_.ReleaseResource(image_pipe_id);
}
// Imports a node to attach the surface to and returns its export token.
// Links the surface to the window in the browser process.
//
// Scenic does not care about order here; it's totally fine for imports to
// cause exports, and that's what's done here.
zx::eventpair Import() {
void LinkToParent() {
zx::eventpair export_token;
parent_.BindAsRequest(&export_token);
parent_.AddChild(shape_);
return export_token;
gpu_host_->ExportParent(window_,
mojo::WrapPlatformHandle(
mojo::PlatformHandle(std::move(export_token))));
}
// Flushes commands to scenic & executes them.
......@@ -70,15 +77,18 @@ class ScenicSurface {
scenic::ShapeNode shape_;
scenic::Material material_;
mojom::ScenicGpuHost* gpu_host_ = nullptr;
gfx::AcceleratedWidget window_ = gfx::kNullAcceleratedWidget;
DISALLOW_COPY_AND_ASSIGN(ScenicSurface);
};
} // namespace
VulkanImplementationScenic::VulkanImplementationScenic(
ScenicWindowManager* scenic_window_manager,
mojom::ScenicGpuHost* scenic_gpu_host,
fuchsia::ui::scenic::Scenic* scenic)
: scenic_window_manager_(scenic_window_manager), scenic_(scenic) {}
: scenic_gpu_host_(scenic_gpu_host), scenic_(scenic) {}
VulkanImplementationScenic::~VulkanImplementationScenic() = default;
......@@ -129,15 +139,11 @@ VkInstance VulkanImplementationScenic::GetVulkanInstance() {
std::unique_ptr<gpu::VulkanSurface>
VulkanImplementationScenic::CreateViewSurface(gfx::AcceleratedWidget window) {
std::unique_ptr<ScenicSurface> scenic_surface =
std::make_unique<ScenicSurface>(scenic_);
auto scenic_surface =
std::make_unique<ScenicSurface>(scenic_, scenic_gpu_host_, window);
// Attach the surface to the window.
// TODO(spang): Use IPC rather than direct call for this step so that it will
// work from the GPU process.
ScenicWindow* scenic_window = scenic_window_manager_->GetWindow(window);
if (scenic_window)
scenic_window->ExportRenderingEntity(scenic_surface->Import());
scenic_surface->LinkToParent();
fuchsia::images::ImagePipePtr image_pipe;
scenic_surface->SetTextureToNewImagePipe(image_pipe.NewRequest());
......
......@@ -10,14 +10,13 @@
#include "gpu/vulkan/vulkan_implementation.h"
#include "gpu/vulkan/vulkan_instance.h"
#include "ui/ozone/public/interfaces/scenic_gpu_host.mojom.h"
namespace ui {
class ScenicWindowManager;
class VulkanImplementationScenic : public gpu::VulkanImplementation {
public:
VulkanImplementationScenic(ScenicWindowManager* scenic_window_manager,
VulkanImplementationScenic(mojom::ScenicGpuHost* scenic_gpu_host,
fuchsia::ui::scenic::Scenic* scenic);
~VulkanImplementationScenic() override;
......@@ -37,7 +36,7 @@ class VulkanImplementationScenic : public gpu::VulkanImplementation {
VkFence vk_fence) override;
private:
ScenicWindowManager* const scenic_window_manager_;
mojom::ScenicGpuHost* const scenic_gpu_host_;
fuchsia::ui::scenic::Scenic* const scenic_;
gpu::VulkanInstance vulkan_instance_;
......
......@@ -9,6 +9,8 @@ mojom("interfaces") {
"device_cursor.mojom",
"drm_device.mojom",
"overlay_surface_candidate.mojom",
"scenic_gpu_host.mojom",
"scenic_gpu_service.mojom",
]
public_deps = [
......
// Copyright 2018 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;
// Browser process interface that enables the GPU process to present to Scenic.
interface ScenicGpuHost {
// Exports the surface's parent node in the scene graph using |export_token|.
ExportParent(int32 surface_handle, handle export_token);
};
// Copyright 2018 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 "ui/ozone/public/interfaces/scenic_gpu_host.mojom";
// GPU process service that enables presentation to Scenic.
interface ScenicGpuService {
// Initializes the GPU service for presenting to scenic.
//
// This looks a bit backward because right now we only expose an API for the
// browser to bind services in the GPU, but we want the opposite here.
//
// TODO(spang): Consider providing a way for GPU to request ScenicGpuHost from
// service manager instead of returning one from a callback.
Initialize(ScenicGpuHost scenic_gpu_host);
};
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