Commit c78fde4e authored by Kramer Ge's avatar Kramer Ge Committed by Commit Bot

Clean up legacy IPC code in OzoneDRM

OzoneDrmMojo is at 100% in M81 and M83 branch cut has passed, feature is by default on in M83. Legacy IPC code should be removed.

Bug: 620927,806092
Change-Id: I40346e50df69515163a7b6e1df92b3a50a101bc1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2142332Reviewed-by: default avatarSadrul Chowdhury <sadrul@chromium.org>
Reviewed-by: default avatarMichael Spang <spang@chromium.org>
Reviewed-by: default avatarSunny Sachanandani <sunnyps@chromium.org>
Reviewed-by: default avatarRobert Kroeger <rjkroege@chromium.org>
Commit-Queue: Kramer Ge <fangzhoug@chromium.org>
Cr-Commit-Position: refs/heads/master@{#760334}
parent da9f3f5c
...@@ -283,36 +283,17 @@ void GpuHostImpl::InitOzone() { ...@@ -283,36 +283,17 @@ void GpuHostImpl::InitOzone() {
// The Ozone/Wayland requires mojo communication to be established to be // The Ozone/Wayland requires mojo communication to be established to be
// functional with a separate gpu process. Thus, using the PlatformProperties, // functional with a separate gpu process. Thus, using the PlatformProperties,
// check if there is such a requirement. // check if there is such a requirement.
if (features::IsOzoneDrmMojo() || auto interface_binder = base::BindRepeating(&GpuHostImpl::BindInterface,
ui::OzonePlatform::GetInstance()->GetPlatformProperties().requires_mojo) { weak_ptr_factory_.GetWeakPtr());
// TODO(rjkroege): Remove the legacy IPC code paths when no longer auto terminate_callback = base::BindOnce(&GpuHostImpl::TerminateGpuProcess,
// necessary. https://crbug.com/806092 weak_ptr_factory_.GetWeakPtr());
auto interface_binder = base::BindRepeating(&GpuHostImpl::BindInterface,
weak_ptr_factory_.GetWeakPtr()); ui::OzonePlatform::GetInstance()
auto terminate_callback = base::BindOnce(&GpuHostImpl::TerminateGpuProcess, ->GetGpuPlatformSupportHost()
weak_ptr_factory_.GetWeakPtr()); ->OnGpuServiceLaunched(params_.restart_id,
params_.main_thread_task_runner,
ui::OzonePlatform::GetInstance() host_thread_task_runner_, interface_binder,
->GetGpuPlatformSupportHost() std::move(terminate_callback));
->OnGpuServiceLaunched(params_.restart_id,
params_.main_thread_task_runner,
host_thread_task_runner_, interface_binder,
std::move(terminate_callback));
} else {
auto send_callback = base::BindRepeating(
[](base::WeakPtr<GpuHostImpl> host, IPC::Message* message) {
if (host)
host->delegate_->SendGpuProcessMessage(message);
else
delete message;
},
weak_ptr_factory_.GetWeakPtr());
ui::OzonePlatform::GetInstance()
->GetGpuPlatformSupportHost()
->OnGpuProcessLaunched(params_.restart_id,
params_.main_thread_task_runner,
host_thread_task_runner_, send_callback);
}
} }
void GpuHostImpl::TerminateGpuProcess(const std::string& message) { void GpuHostImpl::TerminateGpuProcess(const std::string& message) {
......
...@@ -40,7 +40,6 @@ class GlTestsSuite : public base::TestSuite { ...@@ -40,7 +40,6 @@ class GlTestsSuite : public base::TestSuite {
// Make Ozone run in single-process mode. // Make Ozone run in single-process mode.
ui::OzonePlatform::InitParams params; ui::OzonePlatform::InitParams params;
params.single_process = true; params.single_process = true;
params.using_mojo = true;
// This initialization must be done after TaskEnvironment has // This initialization must be done after TaskEnvironment has
// initialized the UI thread. // initialized the UI thread.
......
...@@ -276,7 +276,6 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandLine* command_line, ...@@ -276,7 +276,6 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandLine* command_line,
// may also have started at this point. // may also have started at this point.
ui::OzonePlatform::InitParams params; ui::OzonePlatform::InitParams params;
params.single_process = false; params.single_process = false;
params.using_mojo = features::IsOzoneDrmMojo();
ui::OzonePlatform::InitializeForGPU(params); ui::OzonePlatform::InitializeForGPU(params);
const std::vector<gfx::BufferFormat> supported_buffer_formats_for_texturing = const std::vector<gfx::BufferFormat> supported_buffer_formats_for_texturing =
ui::OzonePlatform::GetInstance() ui::OzonePlatform::GetInstance()
...@@ -560,7 +559,6 @@ void GpuInit::InitializeInProcess(base::CommandLine* command_line, ...@@ -560,7 +559,6 @@ void GpuInit::InitializeInProcess(base::CommandLine* command_line,
#if defined(USE_OZONE) #if defined(USE_OZONE)
ui::OzonePlatform::InitParams params; ui::OzonePlatform::InitParams params;
params.single_process = true; params.single_process = true;
params.using_mojo = features::IsOzoneDrmMojo();
ui::OzonePlatform::InitializeForGPU(params); ui::OzonePlatform::InitializeForGPU(params);
const std::vector<gfx::BufferFormat> supported_buffer_formats_for_texturing = const std::vector<gfx::BufferFormat> supported_buffer_formats_for_texturing =
ui::OzonePlatform::GetInstance() ui::OzonePlatform::GetInstance()
......
...@@ -32,7 +32,6 @@ class VulkanTestSuite : public base::TestSuite { ...@@ -32,7 +32,6 @@ class VulkanTestSuite : public base::TestSuite {
// Make Ozone run in single-process mode. // Make Ozone run in single-process mode.
ui::OzonePlatform::InitParams params; ui::OzonePlatform::InitParams params;
params.single_process = true; params.single_process = true;
params.using_mojo = true;
// This initialization must be done after TaskEnvironment has // This initialization must be done after TaskEnvironment has
// initialized the UI thread. // initialized the UI thread.
......
...@@ -218,7 +218,6 @@ void Env::Init() { ...@@ -218,7 +218,6 @@ void Env::Init() {
// instead of checking flags here. // instead of checking flags here.
params.single_process = command_line->HasSwitch("single-process") || params.single_process = command_line->HasSwitch("single-process") ||
command_line->HasSwitch("in-process-gpu"); command_line->HasSwitch("in-process-gpu");
params.using_mojo = features::IsOzoneDrmMojo();
ui::OzonePlatform::InitializeForUI(params); ui::OzonePlatform::InitializeForUI(params);
#endif #endif
......
...@@ -186,13 +186,6 @@ bool IsUseCommonSelectPopupEnabled() { ...@@ -186,13 +186,6 @@ bool IsUseCommonSelectPopupEnabled() {
const base::Feature kWebUIA11yEnhancements{"WebUIA11yEnhancements", const base::Feature kWebUIA11yEnhancements{"WebUIA11yEnhancements",
base::FEATURE_DISABLED_BY_DEFAULT}; base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kEnableOzoneDrmMojo = {"OzoneDrmMojo",
base::FEATURE_ENABLED_BY_DEFAULT};
bool IsOzoneDrmMojo() {
return base::FeatureList::IsEnabled(kEnableOzoneDrmMojo);
}
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
const base::Feature kHandwritingGesture = {"HandwritingGesture", const base::Feature kHandwritingGesture = {"HandwritingGesture",
base::FEATURE_DISABLED_BY_DEFAULT}; base::FEATURE_DISABLED_BY_DEFAULT};
......
...@@ -83,14 +83,6 @@ COMPONENT_EXPORT(UI_BASE_FEATURES) ...@@ -83,14 +83,6 @@ COMPONENT_EXPORT(UI_BASE_FEATURES)
extern const base::Feature kUseCommonSelectPopup; extern const base::Feature kUseCommonSelectPopup;
COMPONENT_EXPORT(UI_BASE_FEATURES) bool IsUseCommonSelectPopupEnabled(); COMPONENT_EXPORT(UI_BASE_FEATURES) bool IsUseCommonSelectPopupEnabled();
// Use mojo communication in the drm platform instead of paramtraits. Remove
// this switch (and associated code) when the drm platform always uses mojo
// communication.
// TODO(rjkroege): Remove in http://crbug.com/806092.
COMPONENT_EXPORT(UI_BASE_FEATURES)
extern const base::Feature kEnableOzoneDrmMojo;
COMPONENT_EXPORT(UI_BASE_FEATURES) bool IsOzoneDrmMojo();
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
COMPONENT_EXPORT(UI_BASE_FEATURES) COMPONENT_EXPORT(UI_BASE_FEATURES)
extern const base::Feature kHandwritingGesture; extern const base::Feature kHandwritingGesture;
......
...@@ -37,7 +37,6 @@ void GLImageTestSupport::InitializeGL( ...@@ -37,7 +37,6 @@ void GLImageTestSupport::InitializeGL(
#if defined(USE_OZONE) #if defined(USE_OZONE)
ui::OzonePlatform::InitParams params; ui::OzonePlatform::InitParams params;
params.single_process = true; params.single_process = true;
params.using_mojo = true;
ui::OzonePlatform::InitializeForGPU(params); ui::OzonePlatform::InitializeForGPU(params);
#endif #endif
......
...@@ -47,7 +47,6 @@ class GlTestSuite : public base::TestSuite { ...@@ -47,7 +47,6 @@ class GlTestSuite : public base::TestSuite {
// and GPU components. // and GPU components.
ui::OzonePlatform::InitParams params; ui::OzonePlatform::InitParams params;
params.single_process = true; params.single_process = true;
params.using_mojo = true;
// This initialization must be done after TaskEnvironment has // This initialization must be done after TaskEnvironment has
// initialized the UI thread. // initialized the UI thread.
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include "ui/events/ozone/layout/keyboard_layout_engine_manager.h" #include "ui/events/ozone/layout/keyboard_layout_engine_manager.h"
#include "ui/ozone/demo/simple_renderer_factory.h" #include "ui/ozone/demo/simple_renderer_factory.h"
#include "ui/ozone/demo/window_manager.h" #include "ui/ozone/demo/window_manager.h"
#include "ui/ozone/public/ozone_gpu_test_helper.h"
#include "ui/ozone/public/ozone_platform.h" #include "ui/ozone/public/ozone_platform.h"
const char kHelp[] = "help"; const char kHelp[] = "help";
...@@ -82,17 +81,6 @@ int main(int argc, char** argv) { ...@@ -82,17 +81,6 @@ int main(int argc, char** argv) {
ui::OzonePlatform::InitializeForGPU(params); ui::OzonePlatform::InitializeForGPU(params);
std::unique_ptr<ui::OzoneGpuTestHelper> gpu_helper;
if (!ui::OzonePlatform::GetInstance()
->GetPlatformProperties()
.requires_mojo) {
// OzoneGpuTestHelper transports Chrome IPC messages between host & gpu code
// in single process mode. We don't use both Chrome IPC and mojo, so only
// initialize it for non-mojo platforms.
gpu_helper = std::make_unique<ui::OzoneGpuTestHelper>();
gpu_helper->Initialize(base::ThreadTaskRunnerHandle::Get());
}
base::RunLoop run_loop; base::RunLoop run_loop;
ui::WindowManager window_manager( ui::WindowManager window_manager(
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include "ui/events/ozone/layout/keyboard_layout_engine_manager.h" #include "ui/events/ozone/layout/keyboard_layout_engine_manager.h"
#include "ui/ozone/demo/skia/skia_renderer_factory.h" #include "ui/ozone/demo/skia/skia_renderer_factory.h"
#include "ui/ozone/demo/window_manager.h" #include "ui/ozone/demo/window_manager.h"
#include "ui/ozone/public/ozone_gpu_test_helper.h"
#include "ui/ozone/public/ozone_platform.h" #include "ui/ozone/public/ozone_platform.h"
int main(int argc, char** argv) { int main(int argc, char** argv) {
...@@ -57,17 +56,6 @@ int main(int argc, char** argv) { ...@@ -57,17 +56,6 @@ int main(int argc, char** argv) {
ui::OzonePlatform::InitializeForGPU(params); ui::OzonePlatform::InitializeForGPU(params);
std::unique_ptr<ui::OzoneGpuTestHelper> gpu_helper;
if (!ui::OzonePlatform::GetInstance()
->GetPlatformProperties()
.requires_mojo) {
// OzoneGpuTestHelper transports Chrome IPC messages between host & gpu code
// in single process mode. We don't use both Chrome IPC and mojo, so only
// initialize it for non-mojo platforms.
gpu_helper = std::make_unique<ui::OzoneGpuTestHelper>();
gpu_helper->Initialize(base::ThreadTaskRunnerHandle::Get());
}
base::RunLoop run_loop; base::RunLoop run_loop;
ui::WindowManager window_manager(std::make_unique<ui::SkiaRendererFactory>(), ui::WindowManager window_manager(std::make_unique<ui::SkiaRendererFactory>(),
......
...@@ -54,8 +54,6 @@ source_set("gbm") { ...@@ -54,8 +54,6 @@ source_set("gbm") {
"gpu/drm_overlay_validator.h", "gpu/drm_overlay_validator.h",
"gpu/drm_thread.cc", "gpu/drm_thread.cc",
"gpu/drm_thread.h", "gpu/drm_thread.h",
"gpu/drm_thread_message_proxy.cc",
"gpu/drm_thread_message_proxy.h",
"gpu/drm_thread_proxy.cc", "gpu/drm_thread_proxy.cc",
"gpu/drm_thread_proxy.h", "gpu/drm_thread_proxy.h",
"gpu/drm_window.cc", "gpu/drm_window.cc",
...@@ -102,8 +100,6 @@ source_set("gbm") { ...@@ -102,8 +100,6 @@ source_set("gbm") {
"host/drm_display_host.h", "host/drm_display_host.h",
"host/drm_display_host_manager.cc", "host/drm_display_host_manager.cc",
"host/drm_display_host_manager.h", "host/drm_display_host_manager.h",
"host/drm_gpu_platform_support_host.cc",
"host/drm_gpu_platform_support_host.h",
"host/drm_native_display_delegate.cc", "host/drm_native_display_delegate.cc",
"host/drm_native_display_delegate.h", "host/drm_native_display_delegate.h",
"host/drm_window_host.cc", "host/drm_window_host.cc",
......
This diff is collapsed.
// Copyright 2015 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_GPU_DRM_THREAD_MESSAGE_PROXY_H_
#define UI_OZONE_PLATFORM_DRM_GPU_DRM_THREAD_MESSAGE_PROXY_H_
#include <stdint.h>
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "ipc/message_filter.h"
#include "ui/display/types/display_constants.h"
#include "ui/display/types/gamma_ramp_rgb_entry.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/ozone/platform/drm/common/display_types.h"
#include "ui/ozone/platform/drm/gpu/inter_thread_messaging_proxy.h"
namespace base {
struct FileDescriptor;
class FilePath;
}
namespace gfx {
class Point;
class Rect;
}
namespace ui {
class DrmThread;
struct DisplayMode_Params;
class DrmThreadMessageProxy : public IPC::MessageFilter,
public InterThreadMessagingProxy {
public:
DrmThreadMessageProxy();
// InterThreadMessagingProxy.
void SetDrmThread(DrmThread* thread) override;
// IPC::MessageFilter:
void OnFilterAdded(IPC::Channel* channel) override;
bool OnMessageReceived(const IPC::Message& message) override;
private:
~DrmThreadMessageProxy() override;
void OnCreateWindow(gfx::AcceleratedWidget widget,
const gfx::Rect& initial_bounds);
void OnDestroyWindow(gfx::AcceleratedWidget widget);
void OnWindowBoundsChanged(gfx::AcceleratedWidget widget,
const gfx::Rect& bounds);
void OnCursorSet(gfx::AcceleratedWidget widget,
const std::vector<SkBitmap>& bitmaps,
const gfx::Point& location,
int frame_delay_ms);
void OnCursorMove(gfx::AcceleratedWidget widget, const gfx::Point& location);
// Display related IPC handlers.
void OnRefreshNativeDisplays();
void OnConfigureNativeDisplay(int64_t id,
const DisplayMode_Params& mode,
const gfx::Point& origin);
void OnDisableNativeDisplay(int64_t id);
void OnTakeDisplayControl();
void OnRelinquishDisplayControl();
void OnAddGraphicsDevice(const base::FilePath& path,
const base::FileDescriptor& fd);
void OnRemoveGraphicsDevice(const base::FilePath& path);
void OnGetHDCPState(int64_t display_id);
void OnSetHDCPState(int64_t display_id, display::HDCPState state);
void OnSetColorMatrix(int64_t display_id,
const std::vector<float>& color_matrix);
void OnSetGammaCorrection(
int64_t display_id,
const std::vector<display::GammaRampRGBEntry>& degamma_lut,
const std::vector<display::GammaRampRGBEntry>& gamma_lut);
void OnSetPrivacyScreen(int64_t display_id, bool enabled);
void OnRefreshNativeDisplaysCallback(MovableDisplaySnapshots displays) const;
void OnConfigureNativeDisplayCallback(int64_t display_id, bool success) const;
void OnDisableNativeDisplayCallback(int64_t display_id, bool success) const;
void OnTakeDisplayControlCallback(bool success) const;
void OnRelinquishDisplayControlCallback(bool success) const;
void OnGetHDCPStateCallback(int64_t display_id,
bool success,
display::HDCPState state) const;
void OnSetHDCPStateCallback(int64_t display_id, bool success) const;
DrmThread* drm_thread_ = nullptr;
IPC::Sender* sender_ = nullptr;
base::WeakPtrFactory<DrmThreadMessageProxy> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(DrmThreadMessageProxy);
};
} // namespace ui
#endif // UI_OZONE_PLATFORM_DRM_GPU_DRM_THREAD_MESSAGE_PROXY_H_
...@@ -8,10 +8,10 @@ ...@@ -8,10 +8,10 @@
#include <utility> #include <utility>
#include "base/bind.h" #include "base/bind.h"
#include "base/trace_event/trace_event.h"
#include "ui/gfx/linux/gbm_wrapper.h" #include "ui/gfx/linux/gbm_wrapper.h"
#include "ui/ozone/platform/drm/gpu/drm_device.h" #include "ui/ozone/platform/drm/gpu/drm_device.h"
#include "ui/ozone/platform/drm/gpu/drm_device_generator.h" #include "ui/ozone/platform/drm/gpu/drm_device_generator.h"
#include "ui/ozone/platform/drm/gpu/drm_thread_message_proxy.h"
#include "ui/ozone/platform/drm/gpu/drm_window_proxy.h" #include "ui/ozone/platform/drm/gpu/drm_window_proxy.h"
#include "ui/ozone/platform/drm/gpu/gbm_pixmap.h" #include "ui/ozone/platform/drm/gpu/gbm_pixmap.h"
#include "ui/ozone/platform/drm/gpu/proxy_helpers.h" #include "ui/ozone/platform/drm/gpu/proxy_helpers.h"
...@@ -62,12 +62,6 @@ DrmThreadProxy::DrmThreadProxy() = default; ...@@ -62,12 +62,6 @@ DrmThreadProxy::DrmThreadProxy() = default;
DrmThreadProxy::~DrmThreadProxy() = default; DrmThreadProxy::~DrmThreadProxy() = default;
// Used only with the paramtraits implementation.
void DrmThreadProxy::BindThreadIntoMessagingProxy(
InterThreadMessagingProxy* messaging_proxy) {
messaging_proxy->SetDrmThread(&drm_thread_);
}
void DrmThreadProxy::StartDrmThread(base::OnceClosure receiver_drainer) { void DrmThreadProxy::StartDrmThread(base::OnceClosure receiver_drainer) {
drm_thread_.Start(std::move(receiver_drainer), drm_thread_.Start(std::move(receiver_drainer),
std::make_unique<GbmDeviceGenerator>()); std::make_unique<GbmDeviceGenerator>());
......
// Copyright 2014 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_GPU_PLATFORM_SUPPORT_HOST_H_
#define UI_OZONE_PLATFORM_DRM_HOST_DRM_GPU_PLATFORM_SUPPORT_HOST_H_
#include <vector>
#include "base/callback.h"
#include "base/observer_list.h"
#include "base/single_thread_task_runner.h"
#include "ui/display/types/display_constants.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/ozone/common/gpu/ozone_gpu_message_params.h"
#include "ui/ozone/platform/drm/host/gpu_thread_adapter.h"
#include "ui/ozone/public/gpu_platform_support_host.h"
namespace gfx {
class Point;
}
namespace ui {
class DrmCursor;
class DrmDisplayHostMananger;
class GpuThreadObserver;
class DrmGpuPlatformSupportHost : public GpuPlatformSupportHost,
public GpuThreadAdapter,
public IPC::Sender {
public:
explicit DrmGpuPlatformSupportHost(DrmCursor* cursor);
~DrmGpuPlatformSupportHost() override;
// GpuPlatformSupportHost:
void OnGpuProcessLaunched(
int host_id,
scoped_refptr<base::SingleThreadTaskRunner> ui_runner,
scoped_refptr<base::SingleThreadTaskRunner> send_runner,
base::RepeatingCallback<void(IPC::Message*)> send_callback) override;
void OnChannelDestroyed(int host_id) override;
void OnGpuServiceLaunched(
int host_id,
scoped_refptr<base::SingleThreadTaskRunner> ui_runner,
scoped_refptr<base::SingleThreadTaskRunner> io_runner,
GpuHostBindInterfaceCallback binder,
GpuHostTerminateCallback terminate_callback) override;
void OnMessageReceived(const IPC::Message& message) override;
// IPC::Sender:
bool Send(IPC::Message* message) override;
// GpuThreadAdapter.
// Core functionality.
void AddGpuThreadObserver(GpuThreadObserver* observer) override;
void RemoveGpuThreadObserver(GpuThreadObserver* observer) override;
bool IsConnected() override;
// Services needed for DrmDisplayHostMananger.
void RegisterHandlerForDrmDisplayHostManager(
DrmDisplayHostManager* handler) override;
void UnRegisterHandlerForDrmDisplayHostManager() override;
bool GpuTakeDisplayControl() override;
bool GpuRefreshNativeDisplays() override;
bool GpuRelinquishDisplayControl() override;
bool GpuAddGraphicsDeviceOnUIThread(const base::FilePath& path,
base::ScopedFD fd) override;
void GpuAddGraphicsDeviceOnIOThread(const base::FilePath& path,
base::ScopedFD fd) override;
bool GpuRemoveGraphicsDevice(const base::FilePath& path) override;
// Services needed by DrmDisplayHost
bool GpuConfigureNativeDisplay(int64_t display_id,
const ui::DisplayMode_Params& display_mode,
const gfx::Point& point) override;
bool GpuDisableNativeDisplay(int64_t display_id) override;
bool GpuGetHDCPState(int64_t display_id) override;
bool GpuSetHDCPState(int64_t display_id, display::HDCPState state) override;
bool GpuSetColorMatrix(int64_t display_id,
const std::vector<float>& color_matrix) override;
bool GpuSetGammaCorrection(
int64_t display_id,
const std::vector<display::GammaRampRGBEntry>& degamma_lut,
const std::vector<display::GammaRampRGBEntry>& gamma_lut) override;
bool GpuSetPrivacyScreen(int64_t display_id, bool enabled) override;
// Services needed by DrmWindowHost
bool GpuDestroyWindow(gfx::AcceleratedWidget widget) override;
bool GpuCreateWindow(gfx::AcceleratedWidget widget,
const gfx::Rect& initial_bounds) override;
bool GpuWindowBoundsChanged(gfx::AcceleratedWidget widget,
const gfx::Rect& bounds) override;
private:
void OnChannelEstablished();
void OnUpdateNativeDisplays(
const std::vector<DisplaySnapshot_Params>& displays);
void OnDisplayConfigured(int64_t display_id, bool status);
void OnHDCPStateReceived(int64_t display_id,
bool status,
display::HDCPState state);
void OnHDCPStateUpdated(int64_t display_id, bool status);
void OnTakeDisplayControl(bool status);
void OnRelinquishDisplayControl(bool status);
int host_id_ = -1;
bool channel_established_ = false;
scoped_refptr<base::SingleThreadTaskRunner> ui_runner_;
scoped_refptr<base::SingleThreadTaskRunner> send_runner_;
base::RepeatingCallback<void(IPC::Message*)> send_callback_;
DrmDisplayHostManager* display_manager_; // Not owned.
DrmCursor* const cursor_; // Not owned.
base::ObserverList<GpuThreadObserver>::Unchecked gpu_thread_observers_;
base::WeakPtr<DrmGpuPlatformSupportHost> weak_ptr_;
base::WeakPtrFactory<DrmGpuPlatformSupportHost> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(DrmGpuPlatformSupportHost);
};
} // namespace ui
#endif // UI_OZONE_PLATFORM_DRM_HOST_DRM_GPU_PLATFORM_SUPPORT_HOST_H_
...@@ -97,9 +97,6 @@ class HostDrmDevice : public base::RefCountedThreadSafe<HostDrmDevice>, ...@@ -97,9 +97,6 @@ class HostDrmDevice : public base::RefCountedThreadSafe<HostDrmDevice>,
void OnDrmServiceStarted(); void OnDrmServiceStarted();
// TODO(rjkroege): Get rid of the need for this method in a subsequent CL.
void PollForSingleThreadReady(int previous_delay);
void GpuConfigureNativeDisplayCallback(int64_t display_id, void GpuConfigureNativeDisplayCallback(int64_t display_id,
bool success) const; bool success) const;
......
...@@ -32,14 +32,12 @@ ...@@ -32,14 +32,12 @@
#include "ui/ozone/platform/drm/gpu/drm_framebuffer.h" #include "ui/ozone/platform/drm/gpu/drm_framebuffer.h"
#include "ui/ozone/platform/drm/gpu/drm_gpu_display_manager.h" #include "ui/ozone/platform/drm/gpu/drm_gpu_display_manager.h"
#include "ui/ozone/platform/drm/gpu/drm_overlay_manager_gpu.h" #include "ui/ozone/platform/drm/gpu/drm_overlay_manager_gpu.h"
#include "ui/ozone/platform/drm/gpu/drm_thread_message_proxy.h"
#include "ui/ozone/platform/drm/gpu/drm_thread_proxy.h" #include "ui/ozone/platform/drm/gpu/drm_thread_proxy.h"
#include "ui/ozone/platform/drm/gpu/gbm_surface_factory.h" #include "ui/ozone/platform/drm/gpu/gbm_surface_factory.h"
#include "ui/ozone/platform/drm/gpu/proxy_helpers.h" #include "ui/ozone/platform/drm/gpu/proxy_helpers.h"
#include "ui/ozone/platform/drm/host/drm_cursor.h" #include "ui/ozone/platform/drm/host/drm_cursor.h"
#include "ui/ozone/platform/drm/host/drm_device_connector.h" #include "ui/ozone/platform/drm/host/drm_device_connector.h"
#include "ui/ozone/platform/drm/host/drm_display_host_manager.h" #include "ui/ozone/platform/drm/host/drm_display_host_manager.h"
#include "ui/ozone/platform/drm/host/drm_gpu_platform_support_host.h"
#include "ui/ozone/platform/drm/host/drm_native_display_delegate.h" #include "ui/ozone/platform/drm/host/drm_native_display_delegate.h"
#include "ui/ozone/platform/drm/host/drm_window_host.h" #include "ui/ozone/platform/drm/host/drm_window_host.h"
#include "ui/ozone/platform/drm/host/drm_window_host_manager.h" #include "ui/ozone/platform/drm/host/drm_window_host_manager.h"
...@@ -87,13 +85,6 @@ class OzonePlatformGbm : public OzonePlatform { ...@@ -87,13 +85,6 @@ class OzonePlatformGbm : public OzonePlatform {
InputController* GetInputController() override { InputController* GetInputController() override {
return event_factory_ozone_->input_controller(); return event_factory_ozone_->input_controller();
} }
IPC::MessageFilter* GetGpuMessageFilter() override {
if (using_mojo_) {
return nullptr;
} else {
return gpu_message_filter_.get();
}
}
std::unique_ptr<PlatformScreen> CreateScreen() override { std::unique_ptr<PlatformScreen> CreateScreen() override {
NOTREACHED(); NOTREACHED();
...@@ -101,11 +92,7 @@ class OzonePlatformGbm : public OzonePlatform { ...@@ -101,11 +92,7 @@ class OzonePlatformGbm : public OzonePlatform {
} }
GpuPlatformSupportHost* GetGpuPlatformSupportHost() override { GpuPlatformSupportHost* GetGpuPlatformSupportHost() override {
if (using_mojo_) {
return drm_device_connector_.get(); return drm_device_connector_.get();
} else {
return gpu_platform_support_host_.get();
}
} }
std::unique_ptr<SystemInputInjector> CreateSystemInputInjector() override { std::unique_ptr<SystemInputInjector> CreateSystemInputInjector() override {
...@@ -115,14 +102,10 @@ class OzonePlatformGbm : public OzonePlatform { ...@@ -115,14 +102,10 @@ class OzonePlatformGbm : public OzonePlatform {
// In multi-process mode, this function must be executed in Viz as it sets up // In multi-process mode, this function must be executed in Viz as it sets up
// the callbacks needed for Mojo receivers. In single process mode, it may be // the callbacks needed for Mojo receivers. In single process mode, it may be
// called on any thread. It must follow one of |InitializeUI| or // called on any thread. It must follow one of |InitializeUI| or
// |InitializeGPU|. Invocations of this method when not using mojo will be // |InitializeGPU|. While the caller may choose to invoke this method before
// ignored. While the caller may choose to invoke this method before entering // entering the sandbox, the actual interface adding has to happen on the DRM
// the sandbox, the actual interface adding has to happen on the DRM Device // Device thread and so will be deferred until the DRM thread is running.
// thread and so will be deferred until the DRM thread is running.
void AddInterfaces(mojo::BinderMap* binders) override { void AddInterfaces(mojo::BinderMap* binders) override {
if (!using_mojo_)
return;
binders->Add<ozone::mojom::DrmDevice>( binders->Add<ozone::mojom::DrmDevice>(
base::BindRepeating(&OzonePlatformGbm::CreateDrmDeviceReceiver, base::BindRepeating(&OzonePlatformGbm::CreateDrmDeviceReceiver,
weak_factory_.GetWeakPtr()), weak_factory_.GetWeakPtr()),
...@@ -153,10 +136,7 @@ class OzonePlatformGbm : public OzonePlatform { ...@@ -153,10 +136,7 @@ class OzonePlatformGbm : public OzonePlatform {
std::unique_ptr<PlatformWindow> CreatePlatformWindow( std::unique_ptr<PlatformWindow> CreatePlatformWindow(
PlatformWindowDelegate* delegate, PlatformWindowDelegate* delegate,
PlatformWindowInitProperties properties) override { PlatformWindowInitProperties properties) override {
GpuThreadAdapter* adapter = gpu_platform_support_host_.get(); GpuThreadAdapter* adapter = host_drm_device_.get();
if (using_mojo_) {
adapter = host_drm_device_.get();
}
auto platform_window = std::make_unique<DrmWindowHost>( auto platform_window = std::make_unique<DrmWindowHost>(
delegate, properties.bounds, adapter, event_factory_ozone_.get(), delegate, properties.bounds, adapter, event_factory_ozone_.get(),
...@@ -185,16 +165,13 @@ class OzonePlatformGbm : public OzonePlatform { ...@@ -185,16 +165,13 @@ class OzonePlatformGbm : public OzonePlatform {
} }
void InitializeUI(const InitParams& args) override { void InitializeUI(const InitParams& args) override {
// Ozone drm can operate in three modes configured at runtime. // Ozone drm can operate in two modes configured at runtime.
// 1. legacy mode where host and viz components communicate // 1. single-process mode where host and viz components
// via param traits IPC. This will be soon deprecated in favor of 3.
// 2. single-process mode where host and viz components
// communicate via in-process mojo. Single-process mode can be single // communicate via in-process mojo. Single-process mode can be single
// or multi-threaded. // or multi-threaded.
// 3. multi-process mode where host and viz components communicate // 2. multi-process mode where host and viz components communicate
// via mojo IPC. // via mojo IPC.
using_mojo_ = args.using_mojo;
host_thread_ = base::PlatformThread::CurrentRef(); host_thread_ = base::PlatformThread::CurrentRef();
device_manager_ = CreateDeviceManager(); device_manager_ = CreateDeviceManager();
...@@ -216,47 +193,28 @@ class OzonePlatformGbm : public OzonePlatform { ...@@ -216,47 +193,28 @@ class OzonePlatformGbm : public OzonePlatform {
GpuThreadAdapter* adapter; GpuThreadAdapter* adapter;
if (using_mojo_) { host_drm_device_ = base::MakeRefCounted<HostDrmDevice>(cursor_.get());
host_drm_device_ = base::MakeRefCounted<HostDrmDevice>(cursor_.get()); drm_device_connector_ =
drm_device_connector_ = std::make_unique<DrmDeviceConnector>(host_drm_device_);
std::make_unique<DrmDeviceConnector>(host_drm_device_); adapter = host_drm_device_.get();
adapter = host_drm_device_.get();
} else {
gpu_platform_support_host_ =
std::make_unique<DrmGpuPlatformSupportHost>(cursor_.get());
adapter = gpu_platform_support_host_.get();
}
display_manager_ = std::make_unique<DrmDisplayHostManager>( display_manager_ = std::make_unique<DrmDisplayHostManager>(
adapter, device_manager_.get(), &host_properties_, adapter, device_manager_.get(), &host_properties_,
event_factory_ozone_->input_controller()); event_factory_ozone_->input_controller());
cursor_factory_ozone_ = std::make_unique<BitmapCursorFactoryOzone>(); cursor_factory_ozone_ = std::make_unique<BitmapCursorFactoryOzone>();
if (using_mojo_) host_drm_device_->SetDisplayManager(display_manager_.get());
host_drm_device_->SetDisplayManager(display_manager_.get());
} }
void InitializeGPU(const InitParams& args) override { void InitializeGPU(const InitParams& args) override {
using_mojo_ = args.using_mojo;
gpu_task_runner_ = base::ThreadTaskRunnerHandle::Get(); gpu_task_runner_ = base::ThreadTaskRunnerHandle::Get();
InterThreadMessagingProxy* itmp;
if (!using_mojo_) {
scoped_refptr<DrmThreadMessageProxy> message_proxy(
new DrmThreadMessageProxy());
itmp = message_proxy.get();
gpu_message_filter_ = std::move(message_proxy);
}
// NOTE: Can't start the thread here since this is called before sandbox // NOTE: Can't start the thread here since this is called before sandbox
// initialization in multi-process Chrome. // initialization in multi-process Chrome.
drm_thread_proxy_ = std::make_unique<DrmThreadProxy>(); drm_thread_proxy_ = std::make_unique<DrmThreadProxy>();
surface_factory_ = surface_factory_ =
std::make_unique<GbmSurfaceFactory>(drm_thread_proxy_.get()); std::make_unique<GbmSurfaceFactory>(drm_thread_proxy_.get());
if (!using_mojo_) {
drm_thread_proxy_->BindThreadIntoMessagingProxy(itmp);
}
overlay_manager_ = overlay_manager_ =
std::make_unique<DrmOverlayManagerGpu>(drm_thread_proxy_.get()); std::make_unique<DrmOverlayManagerGpu>(drm_thread_proxy_.get());
...@@ -266,12 +224,14 @@ class OzonePlatformGbm : public OzonePlatform { ...@@ -266,12 +224,14 @@ class OzonePlatformGbm : public OzonePlatform {
if (!single_process()) if (!single_process())
return; return;
// In single process/mojo mode we need to make sure DrainReceiverRequest is // Note we exit this code above when running in multiple processes and so
// executed on this thread before we start the drm device. // following code only executes in single process mode. In single process
const bool block_for_drm_thread = using_mojo_; // mode we need to make sure DrainReceiverRequest is executed on this thread
// before we start the drm device.
const bool block_for_drm_thread = true;
StartDrmThread(block_for_drm_thread); StartDrmThread(block_for_drm_thread);
if (using_mojo_ && host_thread_ == base::PlatformThread::CurrentRef()) { if (host_thread_ == base::PlatformThread::CurrentRef()) {
CHECK(has_initialized_ui()) << "Mojo single-thread mode requires " CHECK(has_initialized_ui()) << "Mojo single-thread mode requires "
"InitializeUI to be called first."; "InitializeUI to be called first.";
// Connect host and gpu here since OnGpuServiceLaunched() is not called in // Connect host and gpu here since OnGpuServiceLaunched() is not called in
...@@ -319,12 +279,9 @@ class OzonePlatformGbm : public OzonePlatform { ...@@ -319,12 +279,9 @@ class OzonePlatformGbm : public OzonePlatform {
} }
} }
bool using_mojo_ = false;
// Objects in the GPU process. // Objects in the GPU process.
std::unique_ptr<DrmThreadProxy> drm_thread_proxy_; std::unique_ptr<DrmThreadProxy> drm_thread_proxy_;
std::unique_ptr<GbmSurfaceFactory> surface_factory_; std::unique_ptr<GbmSurfaceFactory> surface_factory_;
scoped_refptr<IPC::MessageFilter> gpu_message_filter_;
scoped_refptr<base::SingleThreadTaskRunner> gpu_task_runner_; scoped_refptr<base::SingleThreadTaskRunner> gpu_task_runner_;
std::unique_ptr<DrmOverlayManager> overlay_manager_; std::unique_ptr<DrmOverlayManager> overlay_manager_;
...@@ -334,16 +291,11 @@ class OzonePlatformGbm : public OzonePlatform { ...@@ -334,16 +291,11 @@ class OzonePlatformGbm : public OzonePlatform {
pending_gpu_adapter_receivers_; pending_gpu_adapter_receivers_;
bool drm_thread_started_ = false; bool drm_thread_started_ = false;
// gpu_platform_support_host_ is the IPC bridge to the GPU process while
// host_drm_device_ is the mojo bridge to the Viz process. Only one can be in // host_drm_device_ is the mojo bridge to the Viz process. Only one can be in
// use at any time. // use at any time.
// TODO(rjkroege): Remove gpu_platform_support_host_ once ozone/drm with mojo // A raw pointer to |host_drm_device_| is passed to |display_manager_| in
// has reached the stable channel. // InitializeUI(). To avoid a use after free, the following two members should
// A raw pointer to either |gpu_platform_support_host_| or |host_drm_device_| // be declared before the two managers, so that they're deleted after them.
// is passed to |display_manager_| in InitializeUI(). To avoid a use after
// free, the following two members should be declared before the two managers,
// so that they're deleted after them.
std::unique_ptr<DrmGpuPlatformSupportHost> gpu_platform_support_host_;
// Objects in the host process. // Objects in the host process.
#if BUILDFLAG(USE_XKBCOMMON) #if BUILDFLAG(USE_XKBCOMMON)
......
...@@ -46,7 +46,6 @@ constexpr OzonePlatform::PlatformProperties kScenicPlatformProperties{ ...@@ -46,7 +46,6 @@ constexpr OzonePlatform::PlatformProperties kScenicPlatformProperties{
/*needs_view_token=*/true, /*needs_view_token=*/true,
/*custom_frame_pref_default=*/false, /*custom_frame_pref_default=*/false,
/*use_system_title_bar=*/false, /*use_system_title_bar=*/false,
/*requires_mojo=*/true,
/*message_pump_type_for_gpu=*/base::MessagePumpType::IO}; /*message_pump_type_for_gpu=*/base::MessagePumpType::IO};
class ScenicPlatformEventSource : public ui::PlatformEventSource { class ScenicPlatformEventSource : public ui::PlatformEventSource {
......
...@@ -71,12 +71,6 @@ constexpr OzonePlatform::PlatformProperties kWaylandPlatformProperties = { ...@@ -71,12 +71,6 @@ constexpr OzonePlatform::PlatformProperties kWaylandPlatformProperties = {
// https://github.com/wayland-project/wayland-protocols/commit/76d1ae8c65739eff3434ef219c58a913ad34e988 // https://github.com/wayland-project/wayland-protocols/commit/76d1ae8c65739eff3434ef219c58a913ad34e988
/*custom_frame_pref_default=*/true, /*custom_frame_pref_default=*/true,
/*use_system_title_bar=*/false, /*use_system_title_bar=*/false,
// Ozone/Wayland relies on the mojo communication when running in
// !single_process.
// TODO(msisov, rjkroege): Remove after http://crbug.com/806092.
/*requires_mojo=*/true,
/*message_pump_type_for_gpu=*/base::MessagePumpType::DEFAULT}; /*message_pump_type_for_gpu=*/base::MessagePumpType::DEFAULT};
class OzonePlatformWayland : public OzonePlatform { class OzonePlatformWayland : public OzonePlatform {
......
...@@ -60,7 +60,6 @@ constexpr OzonePlatform::PlatformProperties kX11PlatformProperties{ ...@@ -60,7 +60,6 @@ constexpr OzonePlatform::PlatformProperties kX11PlatformProperties{
/*needs_view_token=*/false, /*needs_view_token=*/false,
/*custom_frame_pref_default=*/false, /*custom_frame_pref_default=*/false,
/*use_system_title_bar=*/true, /*use_system_title_bar=*/true,
/*requires_mojo=*/false,
// When the Ozone X11 backend is running, use a UI loop to grab Expose // When the Ozone X11 backend is running, use a UI loop to grab Expose
// events. See GLSurfaceGLX and https://crbug.com/326995. // events. See GLSurfaceGLX and https://crbug.com/326995.
......
...@@ -71,14 +71,6 @@ class COMPONENT_EXPORT(OZONE) OzonePlatform { ...@@ -71,14 +71,6 @@ class COMPONENT_EXPORT(OZONE) OzonePlatform {
// operate as a single process for platforms (i.e. drm) that are usually // operate as a single process for platforms (i.e. drm) that are usually
// split between a host and viz specific portion. // split between a host and viz specific portion.
bool single_process = false; 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. Note that this param is only checked in
// Ozone DRM. Other platforms either never use mojo or always use mojo
// regardless of this param.
// TODO(crbug.com/806092): Remove after legacy IPC-based Ozone is removed.
bool using_mojo = false;
}; };
// Struct used to indicate platform properties. // Struct used to indicate platform properties.
...@@ -95,10 +87,6 @@ class COMPONENT_EXPORT(OZONE) OzonePlatform { ...@@ -95,10 +87,6 @@ class COMPONENT_EXPORT(OZONE) OzonePlatform {
// supported. // supported.
bool use_system_title_bar = false; bool use_system_title_bar = false;
// Determines if the platform requires mojo communication for the IPC.
// Currently used only by the Ozone/Wayland platform.
bool requires_mojo = false;
// Determines the type of message pump that should be used for GPU main // Determines the type of message pump that should be used for GPU main
// thread. // thread.
base::MessagePumpType message_pump_type_for_gpu = base::MessagePumpType message_pump_type_for_gpu =
......
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