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_OZONE_PUBLIC_SURFACE_FACTORY_OZONE_H_ | 5 #ifndef UI_OZONE_PUBLIC_SURFACE_FACTORY_OZONE_H_ |
6 #define UI_OZONE_PUBLIC_SURFACE_FACTORY_OZONE_H_ | 6 #define UI_OZONE_PUBLIC_SURFACE_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" |
(...skipping 24 matching lines...) Expand all Loading... |
35 // support software, EGL, or both for painting on the window. | 35 // support software, EGL, or both for painting on the window. |
36 // The following functionality is specific to the drawing mode and may not have | 36 // The following functionality is specific to the drawing mode and may not have |
37 // any meaningful implementation in the other mode. An implementation must | 37 // any meaningful implementation in the other mode. An implementation must |
38 // provide functionality for at least one mode. | 38 // provide functionality for at least one mode. |
39 // | 39 // |
40 // 1) Accelerated Drawing (EGL path): | 40 // 1) Accelerated Drawing (EGL path): |
41 // | 41 // |
42 // The following functions are specific to EGL: | 42 // The following functions are specific to EGL: |
43 // - GetNativeDisplay | 43 // - GetNativeDisplay |
44 // - LoadEGLGLES2Bindings | 44 // - LoadEGLGLES2Bindings |
45 // - GetEGLSurfaceProperties (optional if the properties match the default | 45 // - GetEGLSurfaceConfig (optional if the properties match the default |
46 // Chromium ones). | 46 // Chromium ones). |
47 // - CreateEGLSurfaceForWidget | 47 // - CreateEGLSurfaceForWidget |
48 // | 48 // |
49 // 2) Software Drawing (Skia): | 49 // 2) Software Drawing (Skia): |
50 // | 50 // |
51 // The following function is specific to the software path: | 51 // The following function is specific to the software path: |
52 // - CreateCanvasForWidget | 52 // - CreateCanvasForWidget |
53 // | 53 // |
54 // The accelerated path can optionally provide support for the software drawing | 54 // The accelerated path can optionally provide support for the software drawing |
55 // path. | 55 // path. |
(...skipping 15 matching lines...) Expand all Loading... |
71 enum BufferUsage { | 71 enum BufferUsage { |
72 MAP, | 72 MAP, |
73 SCANOUT, | 73 SCANOUT, |
74 }; | 74 }; |
75 | 75 |
76 typedef void* (*GLGetProcAddressProc)(const char* name); | 76 typedef void* (*GLGetProcAddressProc)(const char* name); |
77 typedef base::Callback<void(base::NativeLibrary)> AddGLLibraryCallback; | 77 typedef base::Callback<void(base::NativeLibrary)> AddGLLibraryCallback; |
78 typedef base::Callback<void(GLGetProcAddressProc)> | 78 typedef base::Callback<void(GLGetProcAddressProc)> |
79 SetGLGetProcAddressProcCallback; | 79 SetGLGetProcAddressProcCallback; |
80 | 80 |
| 81 struct EglConfigInfo { |
| 82 EglConfigInfo(); |
| 83 ~EglConfigInfo(); |
| 84 |
| 85 base::Callback<bool(const int32* attribs, |
| 86 void** /* EGLConfig* */ configs, |
| 87 int32 config_size, |
| 88 int32* num_configs)> choose_config; |
| 89 base::Callback<bool(void* /* EGLConfig */ config, |
| 90 int32 attribute, |
| 91 int32* value)> get_config_attribute; |
| 92 base::Callback<const char*()> get_last_error_string; |
| 93 }; |
| 94 |
81 SurfaceFactoryOzone(); | 95 SurfaceFactoryOzone(); |
82 virtual ~SurfaceFactoryOzone(); | 96 virtual ~SurfaceFactoryOzone(); |
83 | 97 |
84 // Returns the singleton instance. | 98 // Returns the singleton instance. |
85 static SurfaceFactoryOzone* GetInstance(); | 99 static SurfaceFactoryOzone* GetInstance(); |
86 | 100 |
87 // Returns native platform display handle. This is used to obtain the EGL | 101 // Returns native platform display handle. This is used to obtain the EGL |
88 // display connection for the native display. | 102 // display connection for the native display. |
89 virtual intptr_t GetNativeDisplay(); | 103 virtual intptr_t GetNativeDisplay(); |
90 | 104 |
(...skipping 17 matching lines...) Expand all Loading... |
108 // Browser Process using only the handle contained in gfx::AcceleratedWidget. | 122 // Browser Process using only the handle contained in gfx::AcceleratedWidget. |
109 virtual scoped_ptr<SurfaceOzoneCanvas> CreateCanvasForWidget( | 123 virtual scoped_ptr<SurfaceOzoneCanvas> CreateCanvasForWidget( |
110 gfx::AcceleratedWidget widget); | 124 gfx::AcceleratedWidget widget); |
111 | 125 |
112 // Sets up GL bindings for the native surface. Takes two callback parameters | 126 // Sets up GL bindings for the native surface. Takes two callback parameters |
113 // that allow Ozone to register the GL bindings. | 127 // that allow Ozone to register the GL bindings. |
114 virtual bool LoadEGLGLES2Bindings( | 128 virtual bool LoadEGLGLES2Bindings( |
115 AddGLLibraryCallback add_gl_library, | 129 AddGLLibraryCallback add_gl_library, |
116 SetGLGetProcAddressProcCallback set_gl_get_proc_address) = 0; | 130 SetGLGetProcAddressProcCallback set_gl_get_proc_address) = 0; |
117 | 131 |
118 // Returns an array of EGL properties, which can be used in any EGL function | 132 // Returns the EGL configuration to use for |surface|. The default EGL |
119 // used to select a display configuration. Note that all properties should be | 133 // configuration |
120 // immediately followed by the corresponding desired value and array should be | 134 // will be used if this returns NULL. |
121 // terminated with EGL_NONE. Ownership of the array is not transferred to | 135 virtual void* /* EGLConfig */ GetEGLSurfaceConfig(const EglConfigInfo& egl, |
122 // caller. desired_list contains list of desired EGL properties and values. | 136 SurfaceOzoneEGL* surface); |
123 virtual const int32* GetEGLSurfaceProperties(const int32* desired_list); | |
124 | 137 |
125 // Get the hal struct to check for overlay support. | 138 // Get the hal struct to check for overlay support. |
126 virtual OverlayCandidatesOzone* GetOverlayCandidates( | 139 virtual OverlayCandidatesOzone* GetOverlayCandidates( |
127 gfx::AcceleratedWidget w); | 140 gfx::AcceleratedWidget w); |
128 | 141 |
129 // Create a single native buffer to be used for overlay planes or zero copy | 142 // Create a single native buffer to be used for overlay planes or zero copy |
130 // for |widget| representing a particular display controller or default | 143 // for |widget| representing a particular display controller or default |
131 // display controller for kNullAcceleratedWidget. | 144 // display controller for kNullAcceleratedWidget. |
132 virtual scoped_refptr<NativePixmap> CreateNativePixmap( | 145 virtual scoped_refptr<NativePixmap> CreateNativePixmap( |
133 gfx::AcceleratedWidget widget, | 146 gfx::AcceleratedWidget widget, |
(...skipping 28 matching lines...) Expand all Loading... |
162 // such as MAP for zero copy or SCANOUT for display controller. | 175 // such as MAP for zero copy or SCANOUT for display controller. |
163 virtual bool CanCreateNativePixmap(BufferUsage usage); | 176 virtual bool CanCreateNativePixmap(BufferUsage usage); |
164 | 177 |
165 private: | 178 private: |
166 static SurfaceFactoryOzone* impl_; // not owned | 179 static SurfaceFactoryOzone* impl_; // not owned |
167 }; | 180 }; |
168 | 181 |
169 } // namespace ui | 182 } // namespace ui |
170 | 183 |
171 #endif // UI_OZONE_PUBLIC_SURFACE_FACTORY_OZONE_H_ | 184 #endif // UI_OZONE_PUBLIC_SURFACE_FACTORY_OZONE_H_ |
OLD | NEW |