Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_BASE_OZONE_SURFACE_LNUX_FACTORY_OZONE_H_ | 5 #ifndef UI_BASE_OZONE_SURFACE_LNUX_FACTORY_OZONE_H_ |
| 6 #define UI_BASE_OZONE_SURFACE_LNUX_FACTORY_OZONE_H_ | 6 #define UI_BASE_OZONE_SURFACE_LNUX_FACTORY_OZONE_H_ |
| 7 | 7 |
| 8 #include <EGL/egl.h> | |
|
rjkroege
2013/08/26 21:48:08
this is not a good idea.
| |
| 9 | |
| 8 #include "ui/base/ui_export.h" | 10 #include "ui/base/ui_export.h" |
| 9 #include "ui/gfx/native_widget_types.h" | 11 #include "ui/gfx/native_widget_types.h" |
| 10 #include "ui/gfx/rect.h" | 12 #include "ui/gfx/rect.h" |
| 11 | 13 |
| 14 class SkBitmap; | |
|
rjkroege
2013/08/26 21:48:08
SKia isn't in a name space? interesting. I learn s
| |
| 15 | |
| 12 namespace gfx { | 16 namespace gfx { |
| 13 class Screen; | 17 class Screen; |
| 14 class VSyncProvider; | 18 class VSyncProvider; |
| 15 } // namespace gfx | 19 } // namespace gfx |
| 16 | 20 |
| 17 namespace ui { | 21 namespace ui { |
| 18 | 22 |
| 19 class UI_EXPORT SurfaceFactoryOzone { | 23 class UI_EXPORT SurfaceFactoryOzone { |
| 20 public: | 24 public: |
| 21 SurfaceFactoryOzone(); | 25 SurfaceFactoryOzone(); |
| 22 virtual ~SurfaceFactoryOzone(); | 26 virtual ~SurfaceFactoryOzone(); |
| 23 | 27 |
| 24 // Returns the instance | 28 // Returns the instance |
| 25 static SurfaceFactoryOzone* GetInstance(); | 29 static SurfaceFactoryOzone* GetInstance(); |
| 26 | 30 |
| 27 // Returns a display spec as in |CreateDisplayFromSpec| for the default | 31 // Returns a display spec as in |CreateDisplayFromSpec| for the default |
| 28 // native surface. | 32 // native surface. |
| 29 virtual const char* DefaultDisplaySpec(); | 33 virtual const char* DefaultDisplaySpec(); |
| 30 | 34 |
| 31 // Sets the implementation delegate. Ownership is retained by the caller. | 35 // Sets the implementation delegate. Ownership is retained by the caller. |
| 32 static void SetInstance(SurfaceFactoryOzone* impl); | 36 static void SetInstance(SurfaceFactoryOzone* impl); |
| 33 | 37 |
| 34 // TODO(rjkroege): decide how to separate screen/display stuff from SFOz | 38 // TODO(rjkroege): decide how to separate screen/display stuff from SFOz |
| 35 // This method implements gfx::Screen, particularly useful in Desktop Aura. | 39 // This method implements gfx::Screen, particularly useful in Desktop Aura. |
| 36 virtual gfx::Screen* CreateDesktopScreen(); | 40 virtual gfx::Screen* CreateDesktopScreen(); |
| 37 | 41 |
| 38 // TODO(rjkroege): Add a status code if necessary. | |
| 39 // Configures the display hardware. Must be called from within the GPU | 42 // Configures the display hardware. Must be called from within the GPU |
| 40 // process before the sandbox has been activated. | 43 // process before the sandbox has been activated. |
| 41 virtual void InitializeHardware() = 0; | 44 virtual bool InitializeHardware() = 0; |
|
rjkroege
2013/08/26 21:48:08
an enum would be preferable? And what does the sta
dnicoara
2013/08/27 14:41:41
I'm not sure what the status would be. I'm seeing
| |
| 42 | 45 |
| 43 // Cleans up display hardware state. Call this from within the GPU process. | 46 // Cleans up display hardware state. Call this from within the GPU process. |
| 44 // This method must be safe to run inside of the sandbox. | 47 // This method must be safe to run inside of the sandbox. |
| 45 virtual void ShutdownHardware() = 0; | 48 virtual void ShutdownHardware() = 0; |
| 46 | 49 |
| 50 // Returns the native EGL display. This is generally needed in creating | |
| 51 // EGL windows. | |
| 52 virtual EGLNativeDisplayType GetNativeDisplay() = 0; | |
|
rjkroege
2013/08/26 21:48:08
return an int. Or we need to modify some of the df
dnicoara
2013/08/27 14:41:41
Wouldn't this be platform dependent? I'm not sure
| |
| 53 | |
| 47 // Obtains an AcceleratedWidget backed by a native Linux framebuffer. | 54 // Obtains an AcceleratedWidget backed by a native Linux framebuffer. |
| 48 // The returned AcceleratedWidget is an opaque token that must realized | 55 // The returned AcceleratedWidget is an opaque token that must realized |
| 49 // before it can be used to create a GL surface. | 56 // before it can be used to create a GL surface. |
| 50 virtual gfx::AcceleratedWidget GetAcceleratedWidget() = 0; | 57 virtual gfx::AcceleratedWidget GetAcceleratedWidget() = 0; |
| 51 | 58 |
| 52 // Realizes an AcceleratedWidget so that the returned AcceleratedWidget | 59 // Realizes an AcceleratedWidget so that the returned AcceleratedWidget |
| 53 // can be used to to create a GLSurface. This method may only be called in | 60 // can be used to to create a GLSurface. This method may only be called in |
| 54 // a process that has a valid GL context. | 61 // a process that has a valid GL context. |
| 55 virtual gfx::AcceleratedWidget RealizeAcceleratedWidget( | 62 virtual gfx::AcceleratedWidget RealizeAcceleratedWidget( |
| 56 gfx::AcceleratedWidget w) = 0; | 63 gfx::AcceleratedWidget w) = 0; |
| 57 | 64 |
| 58 // Sets up GL bindings for the native surface. | 65 // Sets up GL bindings for the native surface. |
| 59 virtual bool LoadEGLGLES2Bindings() = 0; | 66 virtual bool LoadEGLGLES2Bindings() = 0; |
| 60 | 67 |
| 61 // If possible attempts to resize the given AcceleratedWidget instance and if | 68 // If possible attempts to resize the given AcceleratedWidget instance and if |
| 62 // a resize action was performed returns true, otherwise false (native | 69 // a resize action was performed returns true, otherwise false (native |
| 63 // hardware may only support a single fixed size). | 70 // hardware may only support a single fixed size). |
| 64 virtual bool AttemptToResizeAcceleratedWidget( | 71 virtual bool AttemptToResizeAcceleratedWidget( |
| 65 gfx::AcceleratedWidget w, | 72 gfx::AcceleratedWidget w, |
| 66 const gfx::Rect& bounds) = 0; | 73 const gfx::Rect& bounds) = 0; |
| 67 | 74 |
| 75 // Called after the appropriate GL swap buffers command. Used if extra work | |
| 76 // is needed to perform the actual buffer swap. | |
| 77 virtual bool SwapBuffers() = 0; | |
|
rjkroege
2013/08/26 21:48:08
this should take the accelerated widget as an argu
dnicoara
2013/08/27 14:41:41
Done.
| |
| 78 | |
| 68 // Returns a gfx::VsyncProvider for the provided AcceleratedWidget. Note | 79 // Returns a gfx::VsyncProvider for the provided AcceleratedWidget. Note |
| 69 // that this may be called after we have entered the sandbox so if there are | 80 // that this may be called after we have entered the sandbox so if there are |
| 70 // operations (e.g. opening a file descriptor providing vsync events) that | 81 // operations (e.g. opening a file descriptor providing vsync events) that |
| 71 // must be done outside of the sandbox, they must have been completed | 82 // must be done outside of the sandbox, they must have been completed |
| 72 // in InitializeHardware. Returns NULL on error. | 83 // in InitializeHardware. Returns NULL on error. |
| 73 virtual gfx::VSyncProvider* GetVSyncProvider(gfx::AcceleratedWidget w) = 0; | 84 virtual gfx::VSyncProvider* GetVSyncProvider(gfx::AcceleratedWidget w) = 0; |
| 74 | 85 |
| 86 // Used to paint a bitmap directly to the surface. | |
|
rjkroege
2013/08/26 21:48:08
You are not using this method in this CL yes? Perh
dnicoara
2013/08/27 14:41:41
Sure, I was thinking of having it in here to discu
| |
| 87 virtual void Paint(const SkBitmap& bitmap, const gfx::Rect& rect) = 0; | |
| 88 | |
| 75 // Create a default SufaceFactoryOzone implementation useful for tests. | 89 // Create a default SufaceFactoryOzone implementation useful for tests. |
| 76 static SurfaceFactoryOzone* CreateTestHelper(); | 90 static SurfaceFactoryOzone* CreateTestHelper(); |
| 77 | 91 |
| 78 private: | 92 private: |
| 79 static SurfaceFactoryOzone* impl_; // not owned | 93 static SurfaceFactoryOzone* impl_; // not owned |
| 80 }; | 94 }; |
| 81 | 95 |
| 82 } // namespace ui | 96 } // namespace ui |
| 83 | 97 |
| 84 | |
| 85 #endif // UI_BASE_OZONE_SURFACE_LNUX_FACTORY_OZONE_H_ | 98 #endif // UI_BASE_OZONE_SURFACE_LNUX_FACTORY_OZONE_H_ |
| OLD | NEW |