Commit 062531a9 authored by Dan Erat's avatar Dan Erat Committed by Commit Bot

Revert "[ozone/drm]: support content and service manager launching"

This reverts commit 7faa3b0c.

Reason for revert: This appears to cause Chrome crashes in the
desktopui_MashLogin Autotest, resulting in failures in the
informational Chrome PFQ builders: https://crbug.com/804052

Original change's description:
> [ozone/drm]: support content and service manager launching
> 
> The existing in-progress implementation of ozone/drm over mojo IPC
> assumed that the ozone host would use a mojo ServiceManager provided
> at initialization that it could use to launch and connect to the DRM
> and cursor services. However, when used in a src/content context (such
> as would be the case in Chrome), there is no service manager available
> at ozone initialization time. Instead, content::GpuProcessHost
> notifies the ozone host later from the browser I/O thread when the GPU
> process containing the DRM and cursor services is running.
> 
> This CL refactors the ozone/drm/mojo implementation to isolate the
> acquisition of mojo pipes into a separate class that supports both
> styles of pipe acquistion: either by the use of a ServiceManager or
> via an asynchronously injected dependency on content.
> 
> This CL also restructures the launch of the DRM thread itself so that
> it can be deferred until after the GPU sandbox is initialized in a way
> that does not depend on the use of legacy IPC message filters.
> 
> BUG=620927
> 
> 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: Icfb2261326cd1d5d6e2769d9801c02a744e1102a
> Reviewed-on: https://chromium-review.googlesource.com/861749
> Commit-Queue: Robert Kroeger <rjkroege@chromium.org>
> Reviewed-by: Daniel Nicoara <dnicoara@chromium.org>
> Reviewed-by: Yuzhu Shen <yzshen@chromium.org>
> Reviewed-by: Antoine Labour <piman@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#530562}

TBR=rjkroege@chromium.org,yzshen@chromium.org,dnicoara@chromium.org,piman@chromium.org

Change-Id: Ieb533a2c3db1634953437fcd4c34200f38e51601
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 620927
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
Reviewed-on: https://chromium-review.googlesource.com/876936Reviewed-by: default avatarDan Erat <derat@chromium.org>
Commit-Queue: Dan Erat <derat@chromium.org>
Cr-Commit-Position: refs/heads/master@{#530712}
parent e29eea14
......@@ -307,9 +307,6 @@ bool GpuInit::InitializeAndStartSandbox(
gles2::PassthroughCommandDecoderSupported();
init_successful_ = true;
#if defined(USE_OZONE)
ui::OzonePlatform::GetInstance()->AfterSandboxEntry();
#endif
return true;
}
......@@ -323,7 +320,6 @@ void GpuInit::InitializeInProcess(base::CommandLine* command_line,
ui::OzonePlatform::InitParams params;
params.single_process = true;
ui::OzonePlatform::InitializeForGPU(params);
ui::OzonePlatform::GetInstance()->AfterSandboxEntry();
#endif
if (gpu_info) {
......
......@@ -36,7 +36,6 @@ class ServiceTestSuite : public base::TestSuite {
ui::OzonePlatform::InitParams params;
params.single_process = true;
ui::OzonePlatform::InitializeForGPU(params);
ui::OzonePlatform::GetInstance()->AfterSandboxEntry();
#endif
// base::TestSuite and ViewsInit both try to load icu. That's ok for tests.
......
......@@ -24,7 +24,6 @@ void GLImageTestSupport::InitializeGL(
#if defined(USE_OZONE)
ui::OzonePlatform::InitParams params;
params.single_process = true;
params.using_mojo = true;
ui::OzonePlatform::InitializeForGPU(params);
#endif
......
......@@ -37,7 +37,6 @@ void InitializeOneOffHelper(bool init_extensions) {
ui::OzonePlatform::InitParams params;
params.single_process = true;
ui::OzonePlatform::InitializeForGPU(params);
ui::OzonePlatform::GetInstance()->AfterSandboxEntry();
#endif
ui::test::EnableTestConfigForPlatformWindows();
......@@ -117,7 +116,6 @@ void GLSurfaceTestSupport::InitializeOneOffWithMockBindings() {
ui::OzonePlatform::InitParams params;
params.single_process = true;
ui::OzonePlatform::InitializeForGPU(params);
ui::OzonePlatform::GetInstance()->AfterSandboxEntry();
#endif
InitializeOneOffImplementation(kGLImplementationMockGL, false);
......@@ -128,7 +126,6 @@ void GLSurfaceTestSupport::InitializeOneOffWithStubBindings() {
ui::OzonePlatform::InitParams params;
params.single_process = true;
ui::OzonePlatform::InitializeForGPU(params);
ui::OzonePlatform::GetInstance()->AfterSandboxEntry();
#endif
InitializeOneOffImplementation(kGLImplementationStubGL, false);
......
......@@ -206,7 +206,6 @@ bool RendererFactory::Initialize() {
ui::OzonePlatform::InitParams params;
params.single_process = true;
ui::OzonePlatform::InitializeForGPU(params);
ui::OzonePlatform::GetInstance()->AfterSandboxEntry();
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
if (!command_line->HasSwitch(kDisableGpu) && gl::init::InitializeGLOneOff() &&
......
......@@ -81,8 +81,6 @@ source_set("gbm") {
"gpu/screen_manager.h",
"host/drm_cursor.cc",
"host/drm_cursor.h",
"host/drm_device_connector.cc",
"host/drm_device_connector.h",
"host/drm_device_handle.cc",
"host/drm_device_handle.h",
"host/drm_display_host.cc",
......
......@@ -78,18 +78,16 @@ class GbmDeviceGenerator : public DrmDeviceGenerator {
} // namespace
DrmThread::DrmThread()
: base::Thread("DrmThread"), drm_binding_(this), weak_ptr_factory_(this) {}
: base::Thread("DrmThread"), binding_(this), weak_ptr_factory_(this) {}
DrmThread::~DrmThread() {
Stop();
}
void DrmThread::Start(base::OnceClosure binding_completer) {
complete_early_binding_requests_ = std::move(binding_completer);
void DrmThread::Start() {
base::Thread::Options thread_options;
thread_options.message_loop_type = base::MessageLoop::TYPE_IO;
thread_options.priority = base::ThreadPriority::DISPLAY;
if (!StartWithOptions(thread_options))
LOG(FATAL) << "Failed to create DRM thread";
}
......@@ -106,13 +104,6 @@ void DrmThread::Init() {
display_manager_.reset(
new DrmGpuDisplayManager(screen_manager_.get(), device_manager_.get()));
DCHECK(task_runner())
<< "DrmThread::Init -- thread doesn't have a task_runner";
// DRM thread is running now so can safely handle binding requests. So drain
// the queue of as-yet unhandled binding requests if there are any.
std::move(complete_early_binding_requests_).Run();
}
void DrmThread::CreateBuffer(gfx::AcceleratedWidget widget,
......@@ -352,12 +343,12 @@ void DrmThread::StartDrmDevice(StartDrmDeviceCallback callback) {
// be used from multiple threads in multiple processes.
void DrmThread::AddBindingCursorDevice(
ozone::mojom::DeviceCursorRequest request) {
cursor_bindings_.AddBinding(this, std::move(request));
bindings_.AddBinding(this, std::move(request));
}
void DrmThread::AddBindingDrmDevice(ozone::mojom::DrmDeviceRequest request) {
TRACE_EVENT0("drm", "DrmThread::AddBindingDrmDevice");
drm_binding_.Bind(std::move(request));
binding_.Bind(std::move(request));
}
} // namespace ui
......@@ -62,7 +62,7 @@ class DrmThread : public base::Thread,
DrmThread();
~DrmThread() override;
void Start(base::OnceClosure binding_completer);
void Start();
// Must be called on the DRM thread. All methods for use from the GPU thread.
// DrmThreadProxy (on GPU)thread) is the client for these methods.
......@@ -150,14 +150,12 @@ class DrmThread : public base::Thread,
std::unique_ptr<ScreenManager> screen_manager_;
std::unique_ptr<DrmGpuDisplayManager> display_manager_;
base::OnceClosure complete_early_binding_requests_;
// The mojo implementation requires a BindingSet because the DrmThread serves
// requests from two different client threads.
mojo::BindingSet<ozone::mojom::DeviceCursor> cursor_bindings_;
mojo::BindingSet<ozone::mojom::DeviceCursor> bindings_;
// The mojo implementation of DrmDevice can use a simple binding.
mojo::Binding<ozone::mojom::DrmDevice> drm_binding_;
mojo::Binding<ozone::mojom::DrmDevice> binding_;
base::WeakPtrFactory<DrmThread> weak_ptr_factory_;
......
......@@ -26,6 +26,10 @@ void DrmThreadMessageProxy::SetDrmThread(DrmThread* thread) {
void DrmThreadMessageProxy::OnFilterAdded(IPC::Channel* channel) {
sender_ = channel;
// The DRM thread needs to be started late since we need to wait for the
// sandbox to start.
drm_thread_->Start();
}
bool DrmThreadMessageProxy::OnMessageReceived(const IPC::Message& message) {
......
......@@ -17,15 +17,13 @@ DrmThreadProxy::DrmThreadProxy() {}
DrmThreadProxy::~DrmThreadProxy() {}
// Used only with the paramtraits implementation.
void DrmThreadProxy::BindThreadIntoMessagingProxy(
InterThreadMessagingProxy* messaging_proxy) {
messaging_proxy->SetDrmThread(&drm_thread_);
}
// Used only for the mojo implementation.
void DrmThreadProxy::StartDrmThread(base::OnceClosure binding_drainer) {
drm_thread_.Start(std::move(binding_drainer));
void DrmThreadProxy::StartDrmThread() {
drm_thread_.Start();
}
std::unique_ptr<DrmWindowProxy> DrmThreadProxy::CreateDrmWindowProxy(
......@@ -38,10 +36,7 @@ scoped_refptr<GbmBuffer> DrmThreadProxy::CreateBuffer(
const gfx::Size& size,
gfx::BufferFormat format,
gfx::BufferUsage usage) {
DCHECK(drm_thread_.task_runner())
<< "no task runner! in DrmThreadProxy::CreateBuffer";
scoped_refptr<GbmBuffer> buffer;
PostSyncTask(
drm_thread_.task_runner(),
base::Bind(&DrmThread::CreateBuffer, base::Unretained(&drm_thread_),
......@@ -82,9 +77,6 @@ void DrmThreadProxy::AddBindingCursorDevice(
void DrmThreadProxy::AddBindingDrmDevice(
ozone::mojom::DrmDeviceRequest request) {
DCHECK(drm_thread_.task_runner()) << "DrmThreadProxy::AddBindingDrmDevice "
"drm_thread_ task runner missing";
drm_thread_.task_runner()->PostTask(
FROM_HERE,
base::Bind(&DrmThread::AddBindingDrmDevice,
......
......@@ -27,7 +27,7 @@ class DrmThreadProxy {
void BindThreadIntoMessagingProxy(InterThreadMessagingProxy* messaging_proxy);
void StartDrmThread(base::OnceClosure binding_drainer);
void StartDrmThread();
std::unique_ptr<DrmWindowProxy> CreateDrmWindowProxy(
gfx::AcceleratedWidget widget);
......
// 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/drm/host/drm_device_connector.h"
#include "mojo/public/cpp/bindings/interface_request.h"
#include "mojo/public/cpp/system/message_pipe.h"
#include "services/service_manager/public/cpp/connector.h"
#include "services/ui/public/interfaces/constants.mojom.h"
#include "ui/ozone/platform/drm/host/host_drm_device.h"
#include "ui/ozone/public/gpu_platform_support_host.h"
namespace {
// TODO(rjkroege): In the future when ozone/drm is always mojo-based, remove
// this utility code.
using BinderCallback = ui::GpuPlatformSupportHost::GpuHostBindInterfaceCallback;
void BindInterfaceInGpuProcess(const std::string& interface_name,
mojo::ScopedMessagePipeHandle interface_pipe,
const BinderCallback& binder_callback) {
return binder_callback.Run(interface_name, std::move(interface_pipe));
}
template <typename Interface>
void BindInterfaceInGpuProcess(mojo::InterfaceRequest<Interface> request,
const BinderCallback& binder_callback) {
BindInterfaceInGpuProcess(
Interface::Name_, std::move(request.PassMessagePipe()), binder_callback);
}
} // namespace
namespace ui {
DrmDeviceConnector::DrmDeviceConnector(
service_manager::Connector* connector,
scoped_refptr<HostDrmDevice> host_drm_device_)
: connector_(connector), host_drm_device_(host_drm_device_) {}
DrmDeviceConnector::~DrmDeviceConnector() {}
void DrmDeviceConnector::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 DrmDeviceConnector::OnChannelDestroyed(int host_id) {
// TODO(rjkroege): Handle Viz restarting.
NOTIMPLEMENTED();
}
void DrmDeviceConnector::OnGpuServiceLaunched(
scoped_refptr<base::SingleThreadTaskRunner> ui_runner,
scoped_refptr<base::SingleThreadTaskRunner> io_runner,
GpuHostBindInterfaceCallback binder) {
// We need to preserve |binder| to let us bind interfaces later.
binder_callback_ = std::move(binder);
ui::ozone::mojom::DrmDevicePtr drm_device_ptr;
BindInterfaceDrmDevice(&drm_device_ptr);
ui::ozone::mojom::DeviceCursorPtr cursor_ptr_ui, cursor_ptr_io;
BindInterfaceDeviceCursor(&cursor_ptr_ui);
BindInterfaceDeviceCursor(&cursor_ptr_io);
ui_runner->PostTask(
FROM_HERE,
base::BindOnce(&HostDrmDevice::OnGpuServiceLaunched, host_drm_device_,
std::move(drm_device_ptr), std::move(cursor_ptr_ui),
std::move(cursor_ptr_io)));
}
void DrmDeviceConnector::OnMessageReceived(const IPC::Message& message) {
NOTREACHED() << "This class should only be used with mojo transport but here "
"we're wrongly getting invoked to handle IPC communication.";
}
void DrmDeviceConnector::BindInterfaceDrmDevice(
ui::ozone::mojom::DrmDevicePtr* drm_device_ptr) const {
if (connector_) {
connector_->BindInterface(ui::mojom::kServiceName, drm_device_ptr);
} else {
auto request = mojo::MakeRequest(drm_device_ptr);
BindInterfaceInGpuProcess(std::move(request), binder_callback_);
}
}
void DrmDeviceConnector::BindInterfaceDeviceCursor(
ui::ozone::mojom::DeviceCursorPtr* cursor_ptr) const {
if (connector_) {
connector_->BindInterface(ui::mojom::kServiceName, cursor_ptr);
} else {
auto request = mojo::MakeRequest(cursor_ptr);
BindInterfaceInGpuProcess(std::move(request), binder_callback_);
}
}
} // namespace ui
\ No newline at end of file
// 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_DRM_HOST_DRM_DEVICE_CONNECTOR_H_
#define UI_OZONE_PLATFORM_DRM_HOST_DRM_DEVICE_CONNECTOR_H_
#include "ui/ozone/public/gpu_platform_support_host.h"
#include "ui/ozone/public/interfaces/device_cursor.mojom.h"
#include "ui/ozone/public/interfaces/drm_device.mojom.h"
namespace service_manager {
class Connector;
}
namespace ui {
class HostDrmDevice;
// DrmDeviceConnector sets up mojo pipes connecting the Viz host to the DRM
// service. It operates in two modes: running on the I/O thread when invoked
// from content and running on the VizHost main thread when operating with a
// service_manager.
class DrmDeviceConnector : public GpuPlatformSupportHost {
public:
DrmDeviceConnector(service_manager::Connector* connector,
scoped_refptr<HostDrmDevice> host_drm_device_);
~DrmDeviceConnector() 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) override;
// BindInterface arranges for the drm_device_ptr to be connected.
void BindInterfaceDrmDevice(
ui::ozone::mojom::DrmDevicePtr* drm_device_ptr) const;
// BindInterface arranges for the cursor_ptr to be wired up.
void BindInterfaceDeviceCursor(
ui::ozone::mojom::DeviceCursorPtr* cursor_ptr) const;
// BindableNow returns true if this DrmDeviceConnector is capable of binding a
// mojo endpoint for the DrmDevice service.
bool BindableNow() const { return !!connector_; }
private:
// This will be present if the Viz host has a service manager.
service_manager::Connector* connector_;
// This will be used if we are operating under content/gpu without a service
// manager.
GpuHostBindInterfaceCallback binder_callback_;
scoped_refptr<HostDrmDevice> host_drm_device_;
DISALLOW_COPY_AND_ASSIGN(DrmDeviceConnector);
};
} // namespace ui
#endif // UI_OZONE_PLATFORM_DRM_HOST_DRM_DEVICE_CONNECTOR_H_
\ No newline at end of file
......@@ -117,14 +117,6 @@ bool DrmGpuPlatformSupportHost::IsConnected() {
return host_id_ >= 0 && channel_established_;
}
void DrmGpuPlatformSupportHost::OnGpuServiceLaunched(
scoped_refptr<base::SingleThreadTaskRunner> ui_runner,
scoped_refptr<base::SingleThreadTaskRunner> io_runner,
GpuHostBindInterfaceCallback binder) {
NOTREACHED() << "DrmGpuPlatformSupportHost::OnGpuServiceLaunched shouldn't "
"be used with pre-mojo IPC";
}
void DrmGpuPlatformSupportHost::OnGpuProcessLaunched(
int host_id,
scoped_refptr<base::SingleThreadTaskRunner> ui_runner,
......
......@@ -41,10 +41,6 @@ class DrmGpuPlatformSupportHost : public GpuPlatformSupportHost,
scoped_refptr<base::SingleThreadTaskRunner> send_runner,
const base::Callback<void(IPC::Message*)>& send_callback) override;
void OnChannelDestroyed(int host_id) override;
void OnGpuServiceLaunched(
scoped_refptr<base::SingleThreadTaskRunner> ui_runner,
scoped_refptr<base::SingleThreadTaskRunner> io_runner,
GpuHostBindInterfaceCallback binder) override;
void OnMessageReceived(const IPC::Message& message) override;
......
......@@ -6,17 +6,15 @@
#include "services/service_manager/public/cpp/connector.h"
#include "services/ui/public/interfaces/constants.mojom.h"
#include "ui/ozone/public/gpu_platform_support_host.h"
namespace ui {
// We assume that this is invoked only on the Mus/UI thread.
HostCursorProxy::HostCursorProxy(
ui::ozone::mojom::DeviceCursorPtr main_cursor_ptr,
ui::ozone::mojom::DeviceCursorPtr evdev_cursor_ptr)
: main_cursor_ptr_(std::move(main_cursor_ptr)),
evdev_cursor_ptr_(std::move(evdev_cursor_ptr)),
ui_thread_ref_(base::PlatformThread::CurrentRef()) {}
// We assume that this is invoked only on the UI thread.
HostCursorProxy::HostCursorProxy(service_manager::Connector* connector)
: connector_(connector->Clone()) {
ui_thread_ref_ = base::PlatformThread::CurrentRef();
connector->BindInterface(ui::mojom::kServiceName, &main_cursor_ptr_);
}
HostCursorProxy::~HostCursorProxy() {}
......@@ -48,14 +46,8 @@ void HostCursorProxy::Move(gfx::AcceleratedWidget widget,
// when the GpuThread/DrmThread pair are once again running), we need to run it
// on cursor motions.
void HostCursorProxy::InitializeOnEvdevIfNecessary() {
// TODO(rjkroege): Rebind on Viz process restart.
if (evdev_bound_)
return;
if (ui_thread_ref_ != base::PlatformThread::CurrentRef()) {
// Rebind the mojo pipe on the current thread. We expect this to be the
// thread running EVDEV.
evdev_cursor_ptr_.Bind(evdev_cursor_ptr_.PassInterface());
connector_->BindInterface(ui::mojom::kServiceName, &evdev_cursor_ptr_);
}
}
......
......@@ -9,6 +9,10 @@
#include "ui/ozone/platform/drm/host/drm_cursor.h"
#include "ui/ozone/public/interfaces/device_cursor.mojom.h"
namespace service_manager {
class Connector;
}
namespace ui {
// Ozone requires a IPC from the browser (or mus-ws) process to the gpu (or
......@@ -18,8 +22,7 @@ namespace ui {
// priviledged process.
class HostCursorProxy : public DrmCursorProxy {
public:
HostCursorProxy(ui::ozone::mojom::DeviceCursorPtr main_cursor_ptr,
ui::ozone::mojom::DeviceCursorPtr evdev_cursor_ptr);
explicit HostCursorProxy(service_manager::Connector* connector);
~HostCursorProxy() override;
private:
......@@ -31,13 +34,13 @@ class HostCursorProxy : public DrmCursorProxy {
void Move(gfx::AcceleratedWidget window, const gfx::Point& point) override;
void InitializeOnEvdevIfNecessary() override;
std::unique_ptr<service_manager::Connector> connector_;
// Mojo implementation of the DrmCursorProxy.
ui::ozone::mojom::DeviceCursorPtr main_cursor_ptr_ = nullptr;
ui::ozone::mojom::DeviceCursorPtr evdev_cursor_ptr_ = nullptr;
ui::ozone::mojom::DeviceCursorPtr main_cursor_ptr_;
ui::ozone::mojom::DeviceCursorPtr evdev_cursor_ptr_;
base::PlatformThreadRef ui_thread_ref_;
bool evdev_bound_ = false;
DISALLOW_COPY_AND_ASSIGN(HostCursorProxy);
};
......
......@@ -14,7 +14,6 @@
#include "ui/gfx/native_widget_types.h"
#include "ui/ozone/platform/drm/host/drm_cursor.h"
#include "ui/ozone/platform/drm/host/gpu_thread_adapter.h"
#include "ui/ozone/public/gpu_platform_support_host.h"
#include "ui/ozone/public/interfaces/device_cursor.mojom.h"
#include "ui/ozone/public/interfaces/drm_device.mojom.h"
......@@ -22,23 +21,25 @@ namespace display {
class DisplaySnapshot;
}
namespace service_manager {
class Connector;
}
namespace ui {
class DrmDisplayHostManager;
class DrmOverlayManager;
class GpuThreadObserver;
class DrmDeviceConnector;
class HostCursorProxy;
// This is the Viz host-side library for the DRM device service provided by the
// viz process.
class HostDrmDevice : public base::RefCountedThreadSafe<HostDrmDevice>,
public GpuThreadAdapter {
class HostDrmDevice : public GpuThreadAdapter {
public:
explicit HostDrmDevice(DrmCursor* cursor);
HostDrmDevice(DrmCursor* cursor, service_manager::Connector* connector);
~HostDrmDevice() override;
// Start the DRM service. Runs the |OnDrmServiceStartedCallback| when the
// service has launched and initiates the remaining startup.
void AsyncStartDrmDevice(const DrmDeviceConnector& connector);
void AsyncStartDrmDevice();
// Blocks until the DRM service has come up. Use this entry point only when
// supporting launch of the service where the ozone UI and GPU
......@@ -48,10 +49,6 @@ class HostDrmDevice : public base::RefCountedThreadSafe<HostDrmDevice>,
void ProvideManagers(DrmDisplayHostManager* display_manager,
DrmOverlayManager* overlay_manager);
void OnGpuServiceLaunched(ui::ozone::mojom::DrmDevicePtr drm_device_ptr,
ui::ozone::mojom::DeviceCursorPtr cursor_ptr_ui,
ui::ozone::mojom::DeviceCursorPtr cursor_ptr_io);
// GpuThreadAdapter
void AddGpuThreadObserver(GpuThreadObserver* observer) override;
void RemoveGpuThreadObserver(GpuThreadObserver* observer) override;
......@@ -96,24 +93,8 @@ class HostDrmDevice : public base::RefCountedThreadSafe<HostDrmDevice>,
const gfx::Rect& bounds) override;
private:
friend class base::RefCountedThreadSafe<HostDrmDevice>;
~HostDrmDevice() override;
void HostOnGpuServiceLaunched();
// BindInterface arranges for the drm_device_ptr to be wired up.
void BindInterfaceDrmDevice(
ui::ozone::mojom::DrmDevicePtr* drm_device_ptr) const;
// BindInterface arranges for the cursor_ptr to be wired up.
void BindInterfaceDeviceCursor(
ui::ozone::mojom::DeviceCursorPtr* cursor_ptr) const;
void OnDrmServiceStartedCallback(bool success);
// TODO(rjkroege): Get rid of the need for this method in a subsequent CL.
void PollForSingleThreadReady(int previous_delay);
void RunObservers();
void GpuCheckOverlayCapabilitiesCallback(
......@@ -134,25 +115,21 @@ class HostDrmDevice : public base::RefCountedThreadSafe<HostDrmDevice>,
display::HDCPState state) const;
void GpuSetHDCPStateCallback(int64_t display_id, bool success) const;
// Mojo implementation of the DrmDevice. Will be bound on the "main" thread.
// Mojo implementation of the DrmDevice.
ui::ozone::mojom::DrmDevicePtr drm_device_ptr_;
DrmDisplayHostManager* display_manager_; // Not owned.
DrmOverlayManager* overlay_manager_; // Not owned.
DrmCursor* cursor_; // Not owned.
std::unique_ptr<HostCursorProxy> cursor_proxy_;
scoped_refptr<base::SingleThreadTaskRunner> ws_runner_;
scoped_refptr<base::SingleThreadTaskRunner> io_runner_;
THREAD_CHECKER(on_io_thread_); // Needs to be rebound as is allocated on the
// window server thread.
service_manager::Connector* connector_;
THREAD_CHECKER(on_window_server_thread_);
bool connected_ = false;
base::ObserverList<GpuThreadObserver> gpu_thread_observers_;
base::WeakPtrFactory<HostDrmDevice> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(HostDrmDevice);
};
......
This diff is collapsed.
......@@ -23,10 +23,6 @@ class StubGpuPlatformSupportHost : public GpuPlatformSupportHost {
void OnChannelDestroyed(int host_id) override {}
void OnMessageReceived(const IPC::Message&) override {}
void OnGpuServiceLaunched(
scoped_refptr<base::SingleThreadTaskRunner> ui_runner,
scoped_refptr<base::SingleThreadTaskRunner> io_runner,
GpuHostBindInterfaceCallback binder) override {}
};
} // namespace
......
......@@ -5,13 +5,10 @@
#ifndef UI_OZONE_PUBLIC_GPU_PLATFORM_SUPPORT_HOST_H_
#define UI_OZONE_PUBLIC_GPU_PLATFORM_SUPPORT_HOST_H_
#include <string>
#include "base/memory/ref_counted.h"
#include "base/single_thread_task_runner.h"
#include "ipc/ipc_listener.h"
#include "ipc/ipc_sender.h"
#include "mojo/public/cpp/bindings/binding.h"
#include "ui/ozone/ozone_base_export.h"
namespace ui {
......@@ -27,10 +24,6 @@ namespace ui {
// to support additional messages needed by specific platforms.
class OZONE_BASE_EXPORT GpuPlatformSupportHost {
public:
using GpuHostBindInterfaceCallback =
base::RepeatingCallback<void(const std::string&,
mojo::ScopedMessagePipeHandle)>;
GpuPlatformSupportHost();
virtual ~GpuPlatformSupportHost();
......@@ -49,13 +42,6 @@ class OZONE_BASE_EXPORT GpuPlatformSupportHost {
// Called to handle an IPC message. Note that this can be called from any
// thread.
virtual void OnMessageReceived(const IPC::Message& message) = 0;
// Called when the GPU service is launched.
// Called from the browser IO thread.
virtual void OnGpuServiceLaunched(
scoped_refptr<base::SingleThreadTaskRunner> host_runner,
scoped_refptr<base::SingleThreadTaskRunner> io_runner,
GpuHostBindInterfaceCallback binder) = 0;
};
// create a stub implementation.
......
......@@ -125,6 +125,4 @@ void OzonePlatform::AddInterfaces(
service_manager::BinderRegistryWithArgs<
const service_manager::BindSourceInfo&>* registry) {}
void OzonePlatform::AfterSandboxEntry() {}
} // namespace ui
......@@ -13,7 +13,6 @@
#include "services/service_manager/public/cpp/binder_registry.h"
#include "ui/events/system_input_injector.h"
#include "ui/ozone/ozone_export.h"
//#include "ui/ozone/public/interfaces/drm_device.mojom.h"
namespace display {
class NativeDisplayDelegate;
......@@ -65,23 +64,14 @@ class OZONE_EXPORT OzonePlatform {
// retain a reference to this structure.
struct InitParams {
// Ozone may retain this pointer for later use. An Ozone platform embedder
// may set this value if operating in the idiomatic mojo fashion with a
// service manager. Mojo transport does not require a service manager but in
// that case ozone will not be able to connect to the DRM and cursor
// services. Instead the host must invoke |OnGpuServiceLaunched| as
// described in ui/ozone/public/gpu_platform_support_host.h to inform the
// ozone host that a process containing these services is running.
// must set this parameter in order for the Ozone platform implementation to
// be able to use Mojo.
service_manager::Connector* connector = nullptr;
// Setting this to true indicates that the platform implementation should
// operate as a single process for platforms (i.e. drm) that are usually
// split between a host and viz specific portion.
// split between a main and gpu specific portion.
bool single_process = false;
// Setting this to true indicates that the platform implementation should
// use mojo. Setting this to true requires calling |AddInterfaces|
// afterwards in the Viz process and providing a connector as part
bool using_mojo = false;
};
// Ensures the OzonePlatform instance without doing any initialization.
......@@ -141,23 +131,11 @@ class OZONE_EXPORT OzonePlatform {
// service_manager::BinderRegistry* pointer to export all Mojo interfaces
// defined within Ozone.
//
// Requests arriving before they can be immediately handled will be queued and
// executed later.
//
// A default do-nothing implementation is provided to permit platform
// implementations to opt out of implementing any Mojo interfaces.
virtual void AddInterfaces(service_manager::BinderRegistryWithArgs<
const service_manager::BindSourceInfo&>* registry);
// The GPU-specific portion of Ozone would typically run in a sandboxed
// process for additional security. Some startup might need to wait until
// after the sandbox has been configured. The embedder should use this method
// to specify that the sandbox is configured and that GPU-side setup should
// complete. A default do-nothing implementation is provided to permit
// platform implementations to ignore sandboxing and any associated launch
// ordering issues.
virtual void AfterSandboxEntry();
private:
virtual void InitializeUI(const InitParams& params) = 0;
virtual void InitializeGPU(const InitParams& params) = 0;
......
......@@ -15,9 +15,4 @@ const char kOzoneDumpFile[] = "ozone-dump-file";
// Try to enable drm atomic. This works only with drm platform.
const char kEnableDrmAtomic[] = "enable-drm-atomic";
// Use mojo communication in the drm platform instead of paramtraits. Remove
// this switch (and associated code) when the drm platform always uses mojo
// communication.
const char kEnableDrmMojo[] = "enable-drm-mojo";
} // namespace switches
......@@ -16,8 +16,6 @@ OZONE_BASE_EXPORT extern const char kOzoneDumpFile[];
OZONE_BASE_EXPORT extern const char kEnableDrmAtomic[];
OZONE_BASE_EXPORT extern const char kEnableDrmMojo[];
} // namespace switches
#endif // UI_OZONE_PUBLIC_OZONE_SWITCHES_H_
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