summaryrefslogtreecommitdiffstats
path: root/ui/ozone
diff options
context:
space:
mode:
authorspang@chromium.org <spang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-19 20:01:01 +0000
committerspang@chromium.org <spang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-19 20:01:01 +0000
commit6269704f7dfa31badc183ac9844ff0ad28615af3 (patch)
tree8ba1e496a14b6645df3261eae42b415596f2ebae /ui/ozone
parent16dacef3b8b97d7760307a87996a651812ffb080 (diff)
downloadchromium_src-6269704f7dfa31badc183ac9844ff0ad28615af3.zip
chromium_src-6269704f7dfa31badc183ac9844ff0ad28615af3.tar.gz
chromium_src-6269704f7dfa31badc183ac9844ff0ad28615af3.tar.bz2
ozone: gpu: Add plumbing for platform-specific gpu messaging
ChromeOS without X11 will do display configuration and cursor movement from the GPU process. This is the conduit for the messages needed to make this work. This plumbing also supports other platforms with similar requirements (e.g. wayland's port). X11 does not need any specific messaging here, since we just call the X server from the browser. BUG=377497 TEST=content_shell --ozone-platform=egltest Review URL: https://codereview.chromium.org/338193003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278465 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/ozone')
-rw-r--r--ui/ozone/gpu/gpu_platform_support.cc34
-rw-r--r--ui/ozone/gpu/gpu_platform_support.h31
-rw-r--r--ui/ozone/gpu/gpu_platform_support_host.cc37
-rw-r--r--ui/ozone/gpu/gpu_platform_support_host.h40
-rw-r--r--ui/ozone/ozone.gyp4
-rw-r--r--ui/ozone/ozone_platform.h4
-rw-r--r--ui/ozone/platform/caca/ozone_platform_caca.cc6
-rw-r--r--ui/ozone/platform/dri/ozone_platform_dri.cc6
-rw-r--r--ui/ozone/platform/dri/ozone_platform_gbm.cc13
-rw-r--r--ui/ozone/platform/egltest/ozone_platform_egltest.cc12
-rw-r--r--ui/ozone/platform/test/ozone_platform_test.cc6
11 files changed, 193 insertions, 0 deletions
diff --git a/ui/ozone/gpu/gpu_platform_support.cc b/ui/ozone/gpu/gpu_platform_support.cc
new file mode 100644
index 0000000..bded318
--- /dev/null
+++ b/ui/ozone/gpu/gpu_platform_support.cc
@@ -0,0 +1,34 @@
+// 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.
+
+#include "ui/ozone/gpu/gpu_platform_support.h"
+
+#include "base/logging.h"
+#include "ui/ozone/ozone_export.h"
+
+namespace ui {
+
+namespace {
+
+// No-op implementation of GpuPlatformSupport.
+class OZONE_EXPORT StubGpuPlatformSupport : public GpuPlatformSupport {
+ public:
+ // GpuPlatformSupport:
+ virtual void OnChannelEstablished(IPC::Sender* sender) {}
+ bool OnMessageReceived(const IPC::Message&) OVERRIDE { return false; }
+};
+
+} // namespace
+
+GpuPlatformSupport::GpuPlatformSupport() {
+}
+
+GpuPlatformSupport::~GpuPlatformSupport() {
+}
+
+GpuPlatformSupport* CreateStubGpuPlatformSupport() {
+ return new StubGpuPlatformSupport;
+}
+
+} // namespace ui
diff --git a/ui/ozone/gpu/gpu_platform_support.h b/ui/ozone/gpu/gpu_platform_support.h
new file mode 100644
index 0000000..c00ac43
--- /dev/null
+++ b/ui/ozone/gpu/gpu_platform_support.h
@@ -0,0 +1,31 @@
+// 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_GPU_GPU_PLATFORM_SUPPORT_H_
+#define UI_OZONE_GPU_GPU_PLATFORM_SUPPORT_H_
+
+#include "ipc/ipc_listener.h"
+#include "ipc/ipc_sender.h"
+#include "ui/ozone/ozone_export.h"
+
+namespace ui {
+
+// Platform-specific object to support a GPU process.
+//
+// See GpuPlatformSupportHost for more context.
+class OZONE_EXPORT GpuPlatformSupport : public IPC::Listener {
+ public:
+ GpuPlatformSupport();
+ virtual ~GpuPlatformSupport();
+
+ // Called when the GPU process is spun up & channel established.
+ virtual void OnChannelEstablished(IPC::Sender* sender) = 0;
+};
+
+// Create a stub implementation.
+OZONE_EXPORT GpuPlatformSupport* CreateStubGpuPlatformSupport();
+
+} // namespace ui
+
+#endif // UI_OZONE_GPU_GPU_PLATFORM_SUPPORT_H_
diff --git a/ui/ozone/gpu/gpu_platform_support_host.cc b/ui/ozone/gpu/gpu_platform_support_host.cc
new file mode 100644
index 0000000..742814d
--- /dev/null
+++ b/ui/ozone/gpu/gpu_platform_support_host.cc
@@ -0,0 +1,37 @@
+// 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.
+
+#include "ui/ozone/gpu/gpu_platform_support_host.h"
+
+#include "base/debug/trace_event.h"
+#include "base/logging.h"
+#include "ui/ozone/ozone_export.h"
+
+namespace ui {
+
+namespace {
+
+// No-op implementations of GpuPlatformSupportHost.
+class OZONE_EXPORT StubGpuPlatformSupportHost : public GpuPlatformSupportHost {
+ public:
+ // GpuPlatformSupportHost:
+ virtual void OnChannelEstablished(int host_id, IPC::Sender* sender) OVERRIDE {
+ }
+ virtual void OnChannelDestroyed(int host_id) OVERRIDE {}
+ virtual bool OnMessageReceived(const IPC::Message&) OVERRIDE { return false; }
+};
+
+} // namespace
+
+GpuPlatformSupportHost::GpuPlatformSupportHost() {
+}
+
+GpuPlatformSupportHost::~GpuPlatformSupportHost() {
+}
+
+GpuPlatformSupportHost* CreateStubGpuPlatformSupportHost() {
+ return new StubGpuPlatformSupportHost;
+}
+
+} // namespace ui
diff --git a/ui/ozone/gpu/gpu_platform_support_host.h b/ui/ozone/gpu/gpu_platform_support_host.h
new file mode 100644
index 0000000..7c73fd6
--- /dev/null
+++ b/ui/ozone/gpu/gpu_platform_support_host.h
@@ -0,0 +1,40 @@
+// 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_GPU_GPU_PLATFORM_SUPPORT_HOST_H_
+#define UI_OZONE_GPU_GPU_PLATFORM_SUPPORT_HOST_H_
+
+#include "ipc/ipc_listener.h"
+#include "ipc/ipc_sender.h"
+#include "ui/ozone/ozone_export.h"
+
+namespace ui {
+
+// Platform-specific object to support a GPU process host.
+//
+// ChromeOS on bare hardware will do display configuration and cursor
+// movement from the GPU process. This provides a conduit for the
+// messages needed to make this work.
+//
+// Under X11, we don't need any GPU messages for display configuration.
+// That's why there's no real functionality here: it's purely mechanism
+// to support additional messages needed by specific platforms.
+class OZONE_EXPORT GpuPlatformSupportHost : public IPC::Listener {
+ public:
+ GpuPlatformSupportHost();
+ virtual ~GpuPlatformSupportHost();
+
+ // Called when the GPU process is spun up & channel established.
+ virtual void OnChannelEstablished(int host_id, IPC::Sender* sender) = 0;
+
+ // Called when the GPU process is destroyed.
+ virtual void OnChannelDestroyed(int host_id) = 0;
+};
+
+// create a stub implementation.
+OZONE_EXPORT GpuPlatformSupportHost* CreateStubGpuPlatformSupportHost();
+
+} // namespace ui
+
+#endif // UI_OZONE_GPU_GPU_PLATFORM_SUPPORT_HOST_H_
diff --git a/ui/ozone/ozone.gyp b/ui/ozone/ozone.gyp
index 0eafee1..612a803 100644
--- a/ui/ozone/ozone.gyp
+++ b/ui/ozone/ozone.gyp
@@ -56,6 +56,10 @@
'common/chromeos/native_display_delegate_ozone.h',
'common/chromeos/touchscreen_device_manager_ozone.cc',
'common/chromeos/touchscreen_device_manager_ozone.h',
+ 'gpu/gpu_platform_support.cc',
+ 'gpu/gpu_platform_support.h',
+ 'gpu/gpu_platform_support_host.cc',
+ 'gpu/gpu_platform_support_host.h',
'ozone_platform.cc',
'ozone_platform.h',
'ozone_switches.cc',
diff --git a/ui/ozone/ozone_platform.h b/ui/ozone/ozone_platform.h
index e6e2e0e..1ada25e 100644
--- a/ui/ozone/ozone_platform.h
+++ b/ui/ozone/ozone_platform.h
@@ -18,6 +18,8 @@ class CursorFactoryOzone;
class EventFactoryOzone;
class NativeDisplayDelegate;
class TouchscreenDeviceManager;
+class GpuPlatformSupport;
+class GpuPlatformSupportHost;
// Base class for Ozone platform implementations.
//
@@ -53,6 +55,8 @@ class OZONE_EXPORT OzonePlatform {
virtual gfx::SurfaceFactoryOzone* GetSurfaceFactoryOzone() = 0;
virtual ui::EventFactoryOzone* GetEventFactoryOzone() = 0;
virtual ui::CursorFactoryOzone* GetCursorFactoryOzone() = 0;
+ virtual ui::GpuPlatformSupport* GetGpuPlatformSupport() = 0;
+ virtual ui::GpuPlatformSupportHost* GetGpuPlatformSupportHost() = 0;
#if defined(OS_CHROMEOS)
virtual scoped_ptr<ui::NativeDisplayDelegate>
CreateNativeDisplayDelegate() = 0;
diff --git a/ui/ozone/platform/caca/ozone_platform_caca.cc b/ui/ozone/platform/caca/ozone_platform_caca.cc
index a74379b..b34f5ca 100644
--- a/ui/ozone/platform/caca/ozone_platform_caca.cc
+++ b/ui/ozone/platform/caca/ozone_platform_caca.cc
@@ -34,6 +34,12 @@ class OzonePlatformCaca : public OzonePlatform {
virtual CursorFactoryOzone* GetCursorFactoryOzone() OVERRIDE {
return cursor_factory_ozone_.get();
}
+ virtual GpuPlatformSupport* GetGpuPlatformSupport() OVERRIDE {
+ return NULL; // no GPU support
+ }
+ virtual GpuPlatformSupportHost* GetGpuPlatformSupportHost() OVERRIDE {
+ return NULL; // no GPU support
+ }
#if defined(OS_CHROMEOS)
virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate()
diff --git a/ui/ozone/platform/dri/ozone_platform_dri.cc b/ui/ozone/platform/dri/ozone_platform_dri.cc
index 4d77c35..ffd4bef 100644
--- a/ui/ozone/platform/dri/ozone_platform_dri.cc
+++ b/ui/ozone/platform/dri/ozone_platform_dri.cc
@@ -71,6 +71,12 @@ class OzonePlatformDri : public OzonePlatform {
virtual CursorFactoryOzone* GetCursorFactoryOzone() OVERRIDE {
return cursor_factory_ozone_.get();
}
+ virtual GpuPlatformSupport* GetGpuPlatformSupport() OVERRIDE {
+ return NULL; // no GPU support
+ }
+ virtual GpuPlatformSupportHost* GetGpuPlatformSupportHost() OVERRIDE {
+ return NULL; // no GPU support
+ }
#if defined(OS_CHROMEOS)
virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate()
OVERRIDE {
diff --git a/ui/ozone/platform/dri/ozone_platform_gbm.cc b/ui/ozone/platform/dri/ozone_platform_gbm.cc
index 4e47a28..ac3f78a 100644
--- a/ui/ozone/platform/dri/ozone_platform_gbm.cc
+++ b/ui/ozone/platform/dri/ozone_platform_gbm.cc
@@ -78,6 +78,12 @@ class OzonePlatformGbm : public OzonePlatform {
virtual CursorFactoryOzone* GetCursorFactoryOzone() OVERRIDE {
return cursor_factory_ozone_.get();
}
+ virtual GpuPlatformSupport* GetGpuPlatformSupport() OVERRIDE {
+ return gpu_platform_support_.get()
+ }
+ virtual GpuPlatformSupportHost* GetGpuPlatformSupportHost() OVERRIDE {
+ return gpu_platform_support_host_.get();
+ }
#if defined(OS_CHROMEOS)
virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate()
OVERRIDE {
@@ -99,6 +105,8 @@ class OzonePlatformGbm : public OzonePlatform {
cursor_factory_ozone_.reset(new CursorFactoryOzone());
event_factory_ozone_.reset(new EventFactoryEvdev(
NULL, device_manager_.get()));
+
+ gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost());
}
virtual void InitializeGPU() OVERRIDE {
@@ -110,6 +118,8 @@ class OzonePlatformGbm : public OzonePlatform {
new GbmSurfaceFactory(dri_.get(),
surface_generator_->device(),
screen_manager_.get()));
+
+ gpu_platform_support_.reset(CreateStubGpuPlatformSupport());
}
private:
@@ -123,6 +133,9 @@ class OzonePlatformGbm : public OzonePlatform {
scoped_ptr<CursorFactoryOzone> cursor_factory_ozone_;
scoped_ptr<EventFactoryEvdev> event_factory_ozone_;
+ scoped_ptr<GpuPlatformSupport> gpu_platform_support_;
+ scoped_ptr<GpuPlatformSupportHost> gpu_platform_support_host_;
+
DISALLOW_COPY_AND_ASSIGN(OzonePlatformGbm);
};
diff --git a/ui/ozone/platform/egltest/ozone_platform_egltest.cc b/ui/ozone/platform/egltest/ozone_platform_egltest.cc
index 1a93997..83ac595 100644
--- a/ui/ozone/platform/egltest/ozone_platform_egltest.cc
+++ b/ui/ozone/platform/egltest/ozone_platform_egltest.cc
@@ -15,6 +15,8 @@
#include "ui/gfx/ozone/impl/file_surface_factory.h"
#include "ui/gfx/ozone/surface_ozone_egl.h"
#include "ui/gfx/vsync_provider.h"
+#include "ui/ozone/gpu/gpu_platform_support.h"
+#include "ui/ozone/gpu/gpu_platform_support_host.h"
#include "ui/ozone/ozone_platform.h"
#include "ui/ozone/ozone_switches.h"
@@ -245,6 +247,12 @@ class OzonePlatformEgltest : public OzonePlatform {
virtual CursorFactoryOzone* GetCursorFactoryOzone() OVERRIDE {
return cursor_factory_ozone_.get();
}
+ virtual GpuPlatformSupport* GetGpuPlatformSupport() OVERRIDE {
+ return gpu_platform_support_.get();
+ }
+ virtual GpuPlatformSupportHost* GetGpuPlatformSupportHost() OVERRIDE {
+ return gpu_platform_support_host_.get();
+ }
#if defined(OS_CHROMEOS)
virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate()
@@ -264,10 +272,12 @@ class OzonePlatformEgltest : public OzonePlatform {
event_factory_ozone_.reset(
new EventFactoryEvdev(NULL, device_manager_.get()));
cursor_factory_ozone_.reset(new CursorFactoryOzone());
+ gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost());
}
virtual void InitializeGPU() OVERRIDE {
surface_factory_ozone_.reset(new SurfaceFactoryEgltest(&eglplatform_shim_));
+ gpu_platform_support_.reset(CreateStubGpuPlatformSupport());
}
private:
@@ -276,6 +286,8 @@ class OzonePlatformEgltest : public OzonePlatform {
scoped_ptr<SurfaceFactoryEgltest> surface_factory_ozone_;
scoped_ptr<EventFactoryEvdev> event_factory_ozone_;
scoped_ptr<CursorFactoryOzone> cursor_factory_ozone_;
+ scoped_ptr<GpuPlatformSupport> gpu_platform_support_;
+ scoped_ptr<GpuPlatformSupportHost> gpu_platform_support_host_;
bool shim_initialized_;
diff --git a/ui/ozone/platform/test/ozone_platform_test.cc b/ui/ozone/platform/test/ozone_platform_test.cc
index d655fa7..27d3d9c 100644
--- a/ui/ozone/platform/test/ozone_platform_test.cc
+++ b/ui/ozone/platform/test/ozone_platform_test.cc
@@ -40,6 +40,12 @@ class OzonePlatformTest : public OzonePlatform {
virtual CursorFactoryOzone* GetCursorFactoryOzone() OVERRIDE {
return cursor_factory_ozone_.get();
}
+ virtual GpuPlatformSupport* GetGpuPlatformSupport() OVERRIDE {
+ return NULL; // no GPU support
+ }
+ virtual GpuPlatformSupportHost* GetGpuPlatformSupportHost() OVERRIDE {
+ return NULL; // no GPU support
+ }
#if defined(OS_CHROMEOS)
virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate()