Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Unified Diff: services/ui/ws/window_server.cc

Issue 2481263002: Introduce Display Compositor mojo interface. Use InProcessContextProvider. (Closed)
Patch Set: Speculative fix for android build issue Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: services/ui/ws/window_server.cc
diff --git a/services/ui/ws/window_server.cc b/services/ui/ws/window_server.cc
index b589f61554d4d335f741ecd7f77f81022a9082f6..f4d960a65c3c858f7f588d525afbef07bb726961 100644
--- a/services/ui/ws/window_server.cc
+++ b/services/ui/ws/window_server.cc
@@ -56,11 +56,10 @@ WindowServer::WindowServer(WindowServerDelegate* delegate)
next_wm_change_id_(0),
gpu_proxy_(new GpuServiceProxy(this)),
window_manager_window_tree_factory_set_(this, &user_id_tracker_),
- display_compositor_client_binding_(this),
- display_compositor_(new DisplayCompositor(
- display_compositor_client_binding_.CreateInterfacePtrAndBind())) {
+ display_compositor_client_binding_(this) {
user_id_tracker_.AddObserver(this);
OnUserIdAdded(user_id_tracker_.active_id());
+ display_compositor_request_ = mojo::GetProxy(&display_compositor_);
}
WindowServer::~WindowServer() {
@@ -496,8 +495,6 @@ WindowTree* WindowServer::GetCurrentDragLoopInitiator() {
}
void WindowServer::OnDisplayReady(Display* display, bool is_first) {
- if (gpu_channel_)
- display->platform_display()->OnGpuChannelEstablished(gpu_channel_);
if (is_first)
delegate_->OnFirstDisplayReady();
}
@@ -512,7 +509,7 @@ WindowManagerState* WindowServer::GetWindowManagerStateForUser(
user_id);
}
-ui::DisplayCompositor* WindowServer::GetDisplayCompositor() {
+cc::mojom::DisplayCompositor* WindowServer::GetDisplayCompositor() {
return display_compositor_.get();
}
@@ -745,12 +742,22 @@ void WindowServer::OnTransientWindowRemoved(ServerWindow* window,
}
}
-void WindowServer::OnGpuChannelEstablished(
- scoped_refptr<gpu::GpuChannelHost> gpu_channel) {
- gpu_channel_ = std::move(gpu_channel);
- const std::set<Display*>& displays = display_manager()->displays();
- for (auto* display : displays)
- display->platform_display()->OnGpuChannelEstablished(gpu_channel_);
+void WindowServer::OnGpuServiceInitialized() {
+ // TODO(fsamuel): Currently we: 1. create the gpu service, 2. we initialize
+ // GL and then 3. we request a display compositor interface after
+ // initialization. A display compositor interface can be created at any time,
+ // even prior to completing initialization. If initialization crashes the GPU
+ // process, then we will still get a connection error on the
+ // |display_compositor_client_binding_| binding. We should investigate doing
+ // this in parallel with initialization in the future.
+ // The display compositor gets its own thread in mus-gpu. The gpu service,
+ // where GL commands are processed resides on its own thread. Various
+ // components of the display compositor such as Display, ResourceProvider,
+ // and GLRenderer block on sync tokens from other command buffers. Thus,
+ // the gpu service must live on a separate thread.
+ gpu_proxy_->CreateDisplayCompositor(
+ std::move(display_compositor_request_),
+ display_compositor_client_binding_.CreateInterfacePtrAndBind());
// TODO(kylechar): When gpu channel is removed, this can instead happen
// earlier, after GpuServiceProxy::OnInitialized().
delegate_->StartDisplayInit();

Powered by Google App Engine
This is Rietveld 408576698