Commit 6541f861 authored by James Cook's avatar James Cook Committed by Commit Bot

OopAsh: Fix startup crash on ozone/drm

OopAsh mode (enabled with --enable-features=OopAsh) on CrOS was
crashing at start because the Ozone/Drm DRM and cursor services
were not accessible to the Ash/WS2 host. In this change, the WS2
service is extended to add and bind these interfaces.

Tested by hand by running on device (chell):

	sudo -u chronos ./chrome  --enable-features=OopAsh \
		--user-data-dir=/home/chronos --homedir=/ --login-manager

BUG=850168
TBR=tsepez@chromium.org

Change-Id: I9b6a195f1f5fcce64174eb8e851561c70861dc81
Reviewed-on: https://chromium-review.googlesource.com/1121830
Commit-Queue: James Cook <jamescook@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#573408}
parent b5e53a4f
......@@ -18,6 +18,9 @@ assert(is_chromeos)
assert(use_aura)
assert(enable_hidpi)
# Chromebooks use ozone/DRM. linux-chromeos uses ozone/X11.
assert(use_ozone)
component("ash") {
sources = [
"accelerators/accelerator_commands.cc",
......
......@@ -92,10 +92,6 @@ include_rules = [
# InputMethodManager lives in the browser process. Use ImeController.
"-ui/base/ime/chromeos/input_method_manager.h"
# Ozone does not run in process in mus/mash.
"-ui/events/ozone",
"-ui/ozone",
# ui/events/devices is tied with ozone, which is controlled by mus, and
# shouldn't be used by ash.
"-ui/events/devices",
......
......@@ -79,4 +79,12 @@ void ContentGpuInterfaceProvider::RegisterGpuInterfaces(
gpu_task_runner);
}
void ContentGpuInterfaceProvider::RegisterOzoneGpuInterfaces(
service_manager::BinderRegistryWithArgs<
const service_manager::BindSourceInfo&>* registry) {
// Registers the gpu-related interfaces needed by Ozone.
// TODO(rjkroege): Adjust when Ozone/DRM/Mojo is complete.
NOTIMPLEMENTED();
}
} // namespace ash
......@@ -5,9 +5,6 @@
#ifndef ASH_CONTENT_CONTENT_GPU_INTERFACE_PROVIDER_H_
#define ASH_CONTENT_CONTENT_GPU_INTERFACE_PROVIDER_H_
#include <memory>
#include <vector>
#include "ash/content/ash_with_content_export.h"
#include "base/macros.h"
#include "base/memory/scoped_refptr.h"
......@@ -26,6 +23,9 @@ class ASH_WITH_CONTENT_EXPORT ContentGpuInterfaceProvider
// ui::ws2::GpuInterfaceProvider:
void RegisterGpuInterfaces(
service_manager::BinderRegistry* registry) override;
void RegisterOzoneGpuInterfaces(
service_manager::BinderRegistryWithArgs<
const service_manager::BindSourceInfo&>* registry) override;
private:
class InterfaceBinderImpl;
......
......@@ -6,9 +6,9 @@
#include <utility>
#include "ash/public/cpp/config.h"
#include "ash/shell.h"
#include "base/bind.h"
#include "base/feature_list.h"
#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
......@@ -19,6 +19,7 @@
#include "base/threading/thread_restrictions.h"
#include "components/quirks/quirks_manager.h"
#include "third_party/qcms/src/qcms.h"
#include "ui/base/ui_base_features.h"
#include "ui/display/display.h"
#include "ui/display/types/display_constants.h"
#include "ui/display/types/display_snapshot.h"
......@@ -326,8 +327,11 @@ bool DisplayColorManager::LoadCalibrationForDisplay(
// TODO: enable QuirksManager for mash. http://crbug.com/728748. Some tests
// don't create the Shell when running this code, hence the
// Shell::HasInstance() conditional.
if (Shell::HasInstance() && Shell::GetAshConfig() == Config::MASH)
if (Shell::HasInstance() &&
(base::FeatureList::IsEnabled(::features::kMash) ||
base::FeatureList::IsEnabled(::features::kOopAsh))) {
return false;
}
const bool valid_product_code =
display->product_code() != display::DisplaySnapshot::kInvalidProductCode;
......
......@@ -71,7 +71,12 @@
"multidevice_setup": [ "multidevice_setup" ],
"quick_launch_app": [ "mash:launchable" ],
"service_manager": [ "service_manager:singleton" ],
"ui": [ "display_dev", "window_manager", "video_detector" ],
"ui": [
"display_dev",
"ozone",
"video_detector",
"window_manager"
],
"data_decoder": [ "image_decoder" ]
}
}
......
......@@ -9,6 +9,7 @@
#include "services/service_manager/public/cpp/bind_source_info.h"
#include "services/service_manager/public/cpp/binder_registry.h"
#include "services/ui/gpu_host/gpu_host.h"
#include "ui/ozone/public/ozone_platform.h"
namespace ash {
......@@ -35,6 +36,12 @@ void AshGpuInterfaceProvider::RegisterGpuInterfaces(
&AshGpuInterfaceProvider::BindGpuRequest, base::Unretained(this)));
}
void AshGpuInterfaceProvider::RegisterOzoneGpuInterfaces(
service_manager::BinderRegistryWithArgs<
const service_manager::BindSourceInfo&>* registry) {
ui::OzonePlatform::GetInstance()->AddInterfaces(registry);
}
void AshGpuInterfaceProvider::BindArcRequest(ui::mojom::ArcRequest request) {
gpu_host_->AddArc(std::move(request));
}
......
......@@ -33,6 +33,9 @@ class AshGpuInterfaceProvider : public ui::ws2::GpuInterfaceProvider {
// ui::ws2::GpuInterfaceProvider:
void RegisterGpuInterfaces(
service_manager::BinderRegistry* registry) override;
void RegisterOzoneGpuInterfaces(
service_manager::BinderRegistryWithArgs<
const service_manager::BindSourceInfo&>* registry) override;
private:
void BindArcRequest(ui::mojom::ArcRequest request);
......
......@@ -8,6 +8,10 @@
#include "base/component_export.h"
#include "services/service_manager/public/cpp/binder_registry.h"
namespace service_manager {
struct BindSourceInfo;
}
namespace ui {
namespace ws2 {
......@@ -23,6 +27,13 @@ class COMPONENT_EXPORT(WINDOW_SERVICE) GpuInterfaceProvider {
// ui::mojom::GpuRequest.
virtual void RegisterGpuInterfaces(
service_manager::BinderRegistry* registry) = 0;
#if defined(USE_OZONE)
// Registers the gpu-related interfaces needed by Ozone.
virtual void RegisterOzoneGpuInterfaces(
service_manager::BinderRegistryWithArgs<
const service_manager::BindSourceInfo&>* registry) = 0;
#endif
};
} // namespace ws2
......
......@@ -114,15 +114,24 @@ void WindowService::OnStart() {
&WindowService::BindWindowTreeFactoryRequest, base::Unretained(this)));
// |gpu_interface_provider_| may be null in tests.
if (gpu_interface_provider_)
if (gpu_interface_provider_) {
gpu_interface_provider_->RegisterGpuInterfaces(&registry_);
#if defined(USE_OZONE)
gpu_interface_provider_->RegisterOzoneGpuInterfaces(
&registry_with_source_info_);
#endif
}
}
void WindowService::OnBindInterface(
const service_manager::BindSourceInfo& remote_info,
const std::string& interface_name,
mojo::ScopedMessagePipeHandle handle) {
registry_.BindInterface(interface_name, std::move(handle));
if (!registry_with_source_info_.TryBindInterface(interface_name, &handle,
remote_info)) {
registry_.BindInterface(interface_name, std::move(handle));
}
}
void WindowService::BindClipboardHostRequest(
......
......@@ -123,6 +123,10 @@ class COMPONENT_EXPORT(WINDOW_SERVICE) WindowService
service_manager::BinderRegistry registry_;
service_manager::BinderRegistryWithArgs<
const service_manager::BindSourceInfo&>
registry_with_source_info_;
std::unique_ptr<UserActivityMonitor> user_activity_monitor_;
std::unique_ptr<WindowTreeFactory> window_tree_factory_;
......
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