diff options
author | dnicoara@chromium.org <dnicoara@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-30 19:46:17 +0000 |
---|---|---|
committer | dnicoara@chromium.org <dnicoara@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-30 19:46:17 +0000 |
commit | b41afb53636d4d2b734e91084fdfa9b0ae1363f8 (patch) | |
tree | 273398194aa1cb75c32719b3c4a7f2806be48386 | |
parent | a0e73db0048a7c2a18e3c07e88a4bb4761e8b25d (diff) | |
download | chromium_src-b41afb53636d4d2b734e91084fdfa9b0ae1363f8.zip chromium_src-b41afb53636d4d2b734e91084fdfa9b0ae1363f8.tar.gz chromium_src-b41afb53636d4d2b734e91084fdfa9b0ae1363f8.tar.bz2 |
Adding functionality to paint and signal buffer swap for ozone surface factory.
OZONE event factory should be a bit more verbose on error.
BUG=
Review URL: https://chromiumcodereview.appspot.com/23438002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@220632 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | third_party/khronos/EGL/eglplatform.h | 2 | ||||
-rw-r--r-- | ui/base/ozone/event_factory_ozone.cc | 5 | ||||
-rw-r--r-- | ui/base/ozone/surface_factory_ozone.cc | 10 | ||||
-rw-r--r-- | ui/base/ozone/surface_factory_ozone.h | 18 | ||||
-rw-r--r-- | ui/gl/gl_surface_egl.cc | 14 |
5 files changed, 39 insertions, 10 deletions
diff --git a/third_party/khronos/EGL/eglplatform.h b/third_party/khronos/EGL/eglplatform.h index c7d3d7b..ed5aab2 100644 --- a/third_party/khronos/EGL/eglplatform.h +++ b/third_party/khronos/EGL/eglplatform.h @@ -96,7 +96,7 @@ typedef void* EGLNativeDisplayType; #elif defined(USE_OZONE) -typedef int EGLNativeDisplayType; +typedef intptr_t EGLNativeDisplayType; typedef intptr_t EGLNativeWindowType; typedef intptr_t EGLNativePixmapType; diff --git a/ui/base/ozone/event_factory_ozone.cc b/ui/base/ozone/event_factory_ozone.cc index afeff2b..d008047 100644 --- a/ui/base/ozone/event_factory_ozone.cc +++ b/ui/base/ozone/event_factory_ozone.cc @@ -4,6 +4,7 @@ #include "ui/base/ozone/event_factory_ozone.h" +#include <errno.h> #include <fcntl.h> #include <linux/input.h> #include <poll.h> @@ -45,8 +46,10 @@ void EventFactoryOzone::CreateStartupEventConverters() { for (int id = 0; true; id++) { std::string path = base::StringPrintf("/dev/input/event%d", id); int fd = open(path.c_str(), O_RDONLY | O_NONBLOCK); - if (fd < 0) + if (fd < 0) { + DLOG(ERROR) << "Cannot open '" << path << "': " << strerror(errno); break; + } size_t evtype = 0; COMPILE_ASSERT(sizeof(evtype) * 8 >= EV_MAX, evtype_wide_enough); if (ioctl(fd, EVIOCGBIT(0, sizeof(evtype)), &evtype) == -1) { diff --git a/ui/base/ozone/surface_factory_ozone.cc b/ui/base/ozone/surface_factory_ozone.cc index 7d8d64b..c80d70c 100644 --- a/ui/base/ozone/surface_factory_ozone.cc +++ b/ui/base/ozone/surface_factory_ozone.cc @@ -16,7 +16,7 @@ class SurfaceFactoryOzoneStub : public SurfaceFactoryOzone { SurfaceFactoryOzoneStub() {} virtual ~SurfaceFactoryOzoneStub() {} - virtual void InitializeHardware() OVERRIDE {} + virtual HardwareState InitializeHardware() OVERRIDE { return INITIALIZED; } virtual void ShutdownHardware() OVERRIDE {} virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE { return 0; } virtual gfx::AcceleratedWidget RealizeAcceleratedWidget( @@ -61,6 +61,14 @@ gfx::Screen* SurfaceFactoryOzone::CreateDesktopScreen() { return NULL; } +intptr_t SurfaceFactoryOzone::GetNativeDisplay() { + return 0; +} + +bool SurfaceFactoryOzone::SchedulePageFlip(gfx::AcceleratedWidget) { + return true; +} + // static SurfaceFactoryOzone* SurfaceFactoryOzone::CreateTestHelper() { return new SurfaceFactoryOzoneStub; diff --git a/ui/base/ozone/surface_factory_ozone.h b/ui/base/ozone/surface_factory_ozone.h index 0febe36..c51fd7c 100644 --- a/ui/base/ozone/surface_factory_ozone.h +++ b/ui/base/ozone/surface_factory_ozone.h @@ -18,6 +18,12 @@ namespace ui { class UI_EXPORT SurfaceFactoryOzone { public: + // Describes the state of the hardware after initialization. + enum HardwareState { + INITIALIZED, + FAILED, + }; + SurfaceFactoryOzone(); virtual ~SurfaceFactoryOzone(); @@ -35,15 +41,18 @@ class UI_EXPORT SurfaceFactoryOzone { // This method implements gfx::Screen, particularly useful in Desktop Aura. virtual gfx::Screen* CreateDesktopScreen(); - // TODO(rjkroege): Add a status code if necessary. // Configures the display hardware. Must be called from within the GPU // process before the sandbox has been activated. - virtual void InitializeHardware() = 0; + virtual HardwareState InitializeHardware() = 0; // Cleans up display hardware state. Call this from within the GPU process. // This method must be safe to run inside of the sandbox. virtual void ShutdownHardware() = 0; + // Returns the native EGL display. This is generally needed in creating + // EGL windows. + virtual intptr_t GetNativeDisplay(); + // Obtains an AcceleratedWidget backed by a native Linux framebuffer. // The returned AcceleratedWidget is an opaque token that must realized // before it can be used to create a GL surface. @@ -65,6 +74,10 @@ class UI_EXPORT SurfaceFactoryOzone { gfx::AcceleratedWidget w, const gfx::Rect& bounds) = 0; + // Called after the appropriate GL swap buffers command. Used if extra work + // is needed to perform the actual buffer swap. + virtual bool SchedulePageFlip(gfx::AcceleratedWidget w); + // Returns a gfx::VsyncProvider for the provided AcceleratedWidget. Note // that this may be called after we have entered the sandbox so if there are // operations (e.g. opening a file descriptor providing vsync events) that @@ -81,5 +94,4 @@ class UI_EXPORT SurfaceFactoryOzone { } // namespace ui - #endif // UI_BASE_OZONE_SURFACE_LNUX_FACTORY_OZONE_H_ diff --git a/ui/gl/gl_surface_egl.cc b/ui/gl/gl_surface_egl.cc index 8c29342..5f4edf4 100644 --- a/ui/gl/gl_surface_egl.cc +++ b/ui/gl/gl_surface_egl.cc @@ -100,10 +100,6 @@ bool GLSurfaceEGL::InitializeOneOff() { if (initialized) return true; -#if defined (USE_OZONE) - ui::SurfaceFactoryOzone::GetInstance()->InitializeHardware(); -#endif - #if defined(USE_X11) g_native_display = base::MessagePumpForUI::GetDefaultXDisplay(); #elif defined(OS_WIN) @@ -111,6 +107,16 @@ bool GLSurfaceEGL::InitializeOneOff() { if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableD3D11)) { g_native_display = EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE; } +#elif defined(USE_OZONE) + ui::SurfaceFactoryOzone* surface_factory = + ui::SurfaceFactoryOzone::GetInstance(); + if (surface_factory->InitializeHardware() != + ui::SurfaceFactoryOzone::INITIALIZED) { + LOG(ERROR) << "OZONE failed to initialize hardware"; + return false; + } + g_native_display = reinterpret_cast<EGLNativeDisplayType>( + surface_factory->GetNativeDisplay()); #else g_native_display = EGL_DEFAULT_DISPLAY; #endif |