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_GFX_OZONE_SURFACE_LNUX_FACTORY_OZONE_H_ | 5 #ifndef UI_GFX_OZONE_SURFACE_LNUX_FACTORY_OZONE_H_ |
6 #define UI_GFX_OZONE_SURFACE_LNUX_FACTORY_OZONE_H_ | 6 #define UI_GFX_OZONE_SURFACE_LNUX_FACTORY_OZONE_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/native_library.h" | 10 #include "base/native_library.h" |
11 #include "ui/gfx/geometry/point.h" | 11 #include "ui/gfx/geometry/point.h" |
12 #include "ui/gfx/geometry/rect.h" | 12 #include "ui/gfx/geometry/rect.h" |
13 #include "ui/gfx/gfx_export.h" | 13 #include "ui/gfx/gfx_export.h" |
14 #include "ui/gfx/native_widget_types.h" | 14 #include "ui/gfx/native_widget_types.h" |
15 #include "ui/gfx/rect.h" | 15 #include "ui/gfx/rect.h" |
16 | 16 |
17 class SkBitmap; | 17 class SkBitmap; |
18 class SkCanvas; | 18 class SkCanvas; |
19 | 19 |
20 namespace gfx { | 20 namespace gfx { |
21 class VSyncProvider; | 21 class VSyncProvider; |
22 class OverlayCandidatesOzone; | 22 class OverlayCandidatesOzone; |
23 class SurfaceOzone; | |
23 typedef intptr_t NativeBufferOzone; | 24 typedef intptr_t NativeBufferOzone; |
24 | 25 |
25 // The Ozone interface allows external implementations to hook into Chromium to | 26 // The Ozone interface allows external implementations to hook into Chromium to |
26 // provide a system specific implementation. The Ozone interface supports two | 27 // provide a system specific implementation. The Ozone interface supports two |
27 // drawing modes: 1) accelerated drawing through EGL and 2) software drawing | 28 // drawing modes: 1) accelerated drawing through EGL and 2) software drawing |
28 // through Skia. | 29 // through Skia. |
29 // | 30 // |
30 // The following functionality is specific to the drawing mode and may not have | 31 // The following functionality is specific to the drawing mode and may not have |
31 // any meaningful implementation in the other mode. An implementation must | 32 // any meaningful implementation in the other mode. An implementation must |
32 // provide functionality for at least one mode. | 33 // provide functionality for at least one mode. |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
102 | 103 |
103 // Returns native platform display handle. This is used to obtain the EGL | 104 // Returns native platform display handle. This is used to obtain the EGL |
104 // display connection for the native display. | 105 // display connection for the native display. |
105 virtual intptr_t GetNativeDisplay(); | 106 virtual intptr_t GetNativeDisplay(); |
106 | 107 |
107 // Obtains an AcceleratedWidget backed by a native Linux framebuffer. | 108 // Obtains an AcceleratedWidget backed by a native Linux framebuffer. |
108 // The returned AcceleratedWidget is an opaque token that must realized | 109 // The returned AcceleratedWidget is an opaque token that must realized |
109 // before it can be used to create a GL surface. | 110 // before it can be used to create a GL surface. |
110 virtual gfx::AcceleratedWidget GetAcceleratedWidget() = 0; | 111 virtual gfx::AcceleratedWidget GetAcceleratedWidget() = 0; |
111 | 112 |
112 // Realizes an AcceleratedWidget so that the returned AcceleratedWidget | 113 // Create a surface for the specified gfx::AcceleratedWidget. |
rjkroege
2014/03/24 16:07:04
you removed the text about needing a valid graphic
spang
2014/03/24 16:42:11
The language was wrong. SoftwareOutputDeviceOzone
rjkroege
2014/03/24 20:23:15
OK. The point that I wanted captured in the docume
spang
2014/03/24 21:58:28
Yeah, can't be passed between processes. That's wh
| |
113 // can be used to to create a GLSurface. This method may only be called in | 114 virtual scoped_ptr<SurfaceOzone> CreateSurfaceForWidget( |
114 // a process that has a valid GL context. | 115 gfx::AcceleratedWidget widget); |
115 virtual gfx::AcceleratedWidget RealizeAcceleratedWidget( | |
116 gfx::AcceleratedWidget w) = 0; | |
117 | 116 |
118 // Sets up GL bindings for the native surface. Takes two callback parameters | 117 // Sets up GL bindings for the native surface. Takes two callback parameters |
119 // that allow Ozone to register the GL bindings. | 118 // that allow Ozone to register the GL bindings. |
120 virtual bool LoadEGLGLES2Bindings( | 119 virtual bool LoadEGLGLES2Bindings( |
121 AddGLLibraryCallback add_gl_library, | 120 AddGLLibraryCallback add_gl_library, |
122 SetGLGetProcAddressProcCallback set_gl_get_proc_address) = 0; | 121 SetGLGetProcAddressProcCallback set_gl_get_proc_address) = 0; |
123 | 122 |
124 // If possible attempts to resize the given AcceleratedWidget instance and if | |
125 // a resize action was performed returns true, otherwise false (native | |
126 // hardware may only support a single fixed size). | |
127 virtual bool AttemptToResizeAcceleratedWidget( | |
128 gfx::AcceleratedWidget w, | |
129 const gfx::Rect& bounds) = 0; | |
130 | |
131 // Called after the appropriate GL swap buffers command. Used if extra work | |
132 // is needed to perform the actual buffer swap. | |
133 virtual bool SchedulePageFlip(gfx::AcceleratedWidget w); | |
134 | |
135 // Returns a SkCanvas for the backing buffers. Drawing to the canvas will draw | |
136 // to the native surface. The canvas is intended for use when no EGL | |
137 // acceleration is possible. Its implementation is optional when an EGL | |
138 // backend is provided for rendering. | |
139 virtual SkCanvas* GetCanvasForWidget(gfx::AcceleratedWidget w); | |
140 | |
141 // Returns a gfx::VsyncProvider for the provided AcceleratedWidget. Note | |
142 // that this may be called after we have entered the sandbox so if there are | |
143 // operations (e.g. opening a file descriptor providing vsync events) that | |
144 // must be done outside of the sandbox, they must have been completed | |
145 // in InitializeHardware. Returns an empty scoped_ptr on error. | |
146 virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider( | |
147 gfx::AcceleratedWidget w) = 0; | |
148 | |
149 // Returns an array of EGL properties, which can be used in any EGL function | 123 // Returns an array of EGL properties, which can be used in any EGL function |
150 // used to select a display configuration. Note that all properties should be | 124 // used to select a display configuration. Note that all properties should be |
151 // immediately followed by the corresponding desired value and array should be | 125 // immediately followed by the corresponding desired value and array should be |
152 // terminated with EGL_NONE. Ownership of the array is not transferred to | 126 // terminated with EGL_NONE. Ownership of the array is not transferred to |
153 // caller. desired_list contains list of desired EGL properties and values. | 127 // caller. desired_list contains list of desired EGL properties and values. |
154 virtual const int32* GetEGLSurfaceProperties(const int32* desired_list); | 128 virtual const int32* GetEGLSurfaceProperties(const int32* desired_list); |
155 | 129 |
156 // Get the hal struct to check for overlay support. | 130 // Get the hal struct to check for overlay support. |
157 virtual gfx::OverlayCandidatesOzone* GetOverlayCandidates( | 131 virtual gfx::OverlayCandidatesOzone* GetOverlayCandidates( |
158 gfx::AcceleratedWidget w); | 132 gfx::AcceleratedWidget w); |
(...skipping 18 matching lines...) Expand all Loading... | |
177 virtual gfx::NativeBufferOzone CreateNativeBuffer(gfx::Size size, | 151 virtual gfx::NativeBufferOzone CreateNativeBuffer(gfx::Size size, |
178 BufferFormat format); | 152 BufferFormat format); |
179 | 153 |
180 private: | 154 private: |
181 static SurfaceFactoryOzone* impl_; // not owned | 155 static SurfaceFactoryOzone* impl_; // not owned |
182 }; | 156 }; |
183 | 157 |
184 } // namespace gfx | 158 } // namespace gfx |
185 | 159 |
186 #endif // UI_GFX_OZONE_SURFACE_LNUX_FACTORY_OZONE_H_ | 160 #endif // UI_GFX_OZONE_SURFACE_LNUX_FACTORY_OZONE_H_ |
OLD | NEW |