Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Side by Side Diff: ui/ozone/public/surface_factory_ozone.h

Issue 312393002: ozone: Move the factory interfaces into a common target. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tot-merge-r278697 Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/ozone/public/overlay_candidates_ozone.cc ('k') | ui/ozone/public/surface_factory_ozone.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_OZONE_PUBLIC_SURFACE_FACTORY_OZONE_H_
6 #define UI_GFX_OZONE_SURFACE_LNUX_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"
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"
14 #include "ui/gfx/native_widget_types.h" 13 #include "ui/gfx/native_widget_types.h"
15 #include "ui/gfx/overlay_transform.h" 14 #include "ui/gfx/overlay_transform.h"
16 #include "ui/gfx/rect.h" 15 #include "ui/gfx/rect.h"
16 #include "ui/ozone/ozone_base_export.h"
17 17
18 class SkBitmap; 18 class SkBitmap;
19 class SkCanvas; 19 class SkCanvas;
20 20
21 namespace gfx { 21 namespace ui {
22 class VSyncProvider; 22
23 typedef intptr_t NativeBufferOzone;
23 class OverlayCandidatesOzone; 24 class OverlayCandidatesOzone;
24 class SurfaceOzoneCanvas; 25 class SurfaceOzoneCanvas;
25 class SurfaceOzoneEGL; 26 class SurfaceOzoneEGL;
26 typedef intptr_t NativeBufferOzone;
27 27
28 // The Ozone interface allows external implementations to hook into Chromium to 28 // The Ozone interface allows external implementations to hook into Chromium to
29 // provide a system specific implementation. The Ozone interface supports two 29 // provide a system specific implementation. The Ozone interface supports two
30 // drawing modes: 1) accelerated drawing through EGL and 2) software drawing 30 // drawing modes: 1) accelerated drawing through EGL and 2) software drawing
31 // through Skia. 31 // through Skia.
32 // 32 //
33 // If you want to paint on a window with ozone, you need to create a 33 // If you want to paint on a window with ozone, you need to create a
34 // SurfaceOzoneEGL or SurfaceOzoneCanvas for that window. The platform can 34 // SurfaceOzoneEGL or SurfaceOzoneCanvas for that window. The platform can
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
(...skipping 12 matching lines...) Expand all
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.
56 // 56 //
57 // The remaining functions are not covered since they are needed in both drawing 57 // The remaining functions are not covered since they are needed in both drawing
58 // modes (See comments bellow for descriptions). 58 // modes (See comments bellow for descriptions).
59 class GFX_EXPORT SurfaceFactoryOzone { 59 class OZONE_BASE_EXPORT SurfaceFactoryOzone {
60 public: 60 public:
61 // Describes the state of the hardware after initialization. 61 // Describes the state of the hardware after initialization.
62 enum HardwareState { 62 enum HardwareState {
63 UNINITIALIZED, 63 UNINITIALIZED,
64 INITIALIZED, 64 INITIALIZED,
65 FAILED, 65 FAILED,
66 }; 66 };
67 67
68 // Describes overlay buffer format. 68 // Describes overlay buffer format.
69 // TODO: this is a placeholder for now and will be populated with more 69 // TODO: this is a placeholder for now and will be populated with more
70 // formats once we know what sorts of content, video, etc. we can support. 70 // formats once we know what sorts of content, video, etc. we can support.
71 enum BufferFormat { 71 enum BufferFormat {
72 UNKNOWN, 72 UNKNOWN,
73 RGBA_8888, 73 RGBA_8888,
74 RGB_888, 74 RGB_888,
75 }; 75 };
76 76
77 typedef void*(*GLGetProcAddressProc)(const char* name); 77 typedef void* (*GLGetProcAddressProc)(const char* name);
78 typedef base::Callback<void(base::NativeLibrary)> AddGLLibraryCallback; 78 typedef base::Callback<void(base::NativeLibrary)> AddGLLibraryCallback;
79 typedef base::Callback<void(GLGetProcAddressProc)> 79 typedef base::Callback<void(GLGetProcAddressProc)>
80 SetGLGetProcAddressProcCallback; 80 SetGLGetProcAddressProcCallback;
81 81
82 SurfaceFactoryOzone(); 82 SurfaceFactoryOzone();
83 virtual ~SurfaceFactoryOzone(); 83 virtual ~SurfaceFactoryOzone();
84 84
85 // Returns the singleton instance. 85 // Returns the singleton instance.
86 static SurfaceFactoryOzone* GetInstance(); 86 static SurfaceFactoryOzone* GetInstance();
87 87
(...skipping 13 matching lines...) Expand all
101 // The returned AcceleratedWidget is an opaque token that must realized 101 // The returned AcceleratedWidget is an opaque token that must realized
102 // before it can be used to create a GL surface. 102 // before it can be used to create a GL surface.
103 virtual gfx::AcceleratedWidget GetAcceleratedWidget() = 0; 103 virtual gfx::AcceleratedWidget GetAcceleratedWidget() = 0;
104 104
105 // Create SurfaceOzoneEGL for the specified gfx::AcceleratedWidget. 105 // Create SurfaceOzoneEGL for the specified gfx::AcceleratedWidget.
106 // 106 //
107 // Note: When used from content, this is called in the GPU process. The 107 // Note: When used from content, this is called in the GPU process. The
108 // platform must support creation of SurfaceOzoneEGL from the GPU process 108 // platform must support creation of SurfaceOzoneEGL from the GPU process
109 // using only the handle contained in gfx::AcceleratedWidget. 109 // using only the handle contained in gfx::AcceleratedWidget.
110 virtual scoped_ptr<SurfaceOzoneEGL> CreateEGLSurfaceForWidget( 110 virtual scoped_ptr<SurfaceOzoneEGL> CreateEGLSurfaceForWidget(
111 gfx::AcceleratedWidget widget); 111 gfx::AcceleratedWidget widget);
112 112
113 // Create SurfaceOzoneCanvas for the specified gfx::AcceleratedWidget. 113 // Create SurfaceOzoneCanvas for the specified gfx::AcceleratedWidget.
114 // 114 //
115 // Note: The platform must support creation of SurfaceOzoneCanvas from the 115 // Note: The platform must support creation of SurfaceOzoneCanvas from the
116 // Browser Process using only the handle contained in gfx::AcceleratedWidget. 116 // Browser Process using only the handle contained in gfx::AcceleratedWidget.
117 virtual scoped_ptr<SurfaceOzoneCanvas> CreateCanvasForWidget( 117 virtual scoped_ptr<SurfaceOzoneCanvas> CreateCanvasForWidget(
118 gfx::AcceleratedWidget widget); 118 gfx::AcceleratedWidget widget);
119 119
120 // Sets up GL bindings for the native surface. Takes two callback parameters 120 // Sets up GL bindings for the native surface. Takes two callback parameters
121 // that allow Ozone to register the GL bindings. 121 // that allow Ozone to register the GL bindings.
122 virtual bool LoadEGLGLES2Bindings( 122 virtual bool LoadEGLGLES2Bindings(
123 AddGLLibraryCallback add_gl_library, 123 AddGLLibraryCallback add_gl_library,
124 SetGLGetProcAddressProcCallback set_gl_get_proc_address) = 0; 124 SetGLGetProcAddressProcCallback set_gl_get_proc_address) = 0;
125 125
126 // Returns an array of EGL properties, which can be used in any EGL function 126 // Returns an array of EGL properties, which can be used in any EGL function
127 // used to select a display configuration. Note that all properties should be 127 // used to select a display configuration. Note that all properties should be
128 // immediately followed by the corresponding desired value and array should be 128 // immediately followed by the corresponding desired value and array should be
129 // terminated with EGL_NONE. Ownership of the array is not transferred to 129 // terminated with EGL_NONE. Ownership of the array is not transferred to
130 // caller. desired_list contains list of desired EGL properties and values. 130 // caller. desired_list contains list of desired EGL properties and values.
131 virtual const int32* GetEGLSurfaceProperties(const int32* desired_list); 131 virtual const int32* GetEGLSurfaceProperties(const int32* desired_list);
132 132
133 // Get the hal struct to check for overlay support. 133 // Get the hal struct to check for overlay support.
134 virtual gfx::OverlayCandidatesOzone* GetOverlayCandidates( 134 virtual OverlayCandidatesOzone* GetOverlayCandidates(
135 gfx::AcceleratedWidget w); 135 gfx::AcceleratedWidget w);
136 136
137 // Sets the overlay plane to switch to at the next page flip. 137 // Sets the overlay plane to switch to at the next page flip.
138 // |plane_z_order| specifies the stacking order of the plane relative to the 138 // |plane_z_order| specifies the stacking order of the plane relative to the
139 // main framebuffer located at index 0. 139 // main framebuffer located at index 0.
140 // |plane_transform| specifies how the buffer is to be transformed during. 140 // |plane_transform| specifies how the buffer is to be transformed during.
141 // composition. 141 // composition.
142 // |buffer| to be presented by the overlay. 142 // |buffer| to be presented by the overlay.
143 // |display_bounds| specify where it is supposed to be on the screen. 143 // |display_bounds| specify where it is supposed to be on the screen.
144 // |crop_rect| specifies the region within the buffer to be placed inside 144 // |crop_rect| specifies the region within the buffer to be placed inside
145 // |display_bounds|. 145 // |display_bounds|.
146 virtual void ScheduleOverlayPlane(gfx::AcceleratedWidget w, 146 virtual void ScheduleOverlayPlane(gfx::AcceleratedWidget w,
147 int plane_z_order, 147 int plane_z_order,
148 gfx::OverlayTransform plane_transform, 148 gfx::OverlayTransform plane_transform,
149 gfx::NativeBufferOzone buffer, 149 ui::NativeBufferOzone buffer,
150 const gfx::Rect& display_bounds, 150 const gfx::Rect& display_bounds,
151 gfx::RectF crop_rect); 151 gfx::RectF crop_rect);
152 152
153 // Cleate a single native buffer to be used for overlay planes. 153 // Cleate a single native buffer to be used for overlay planes.
154 virtual gfx::NativeBufferOzone CreateNativeBuffer(gfx::Size size, 154 virtual ui::NativeBufferOzone CreateNativeBuffer(gfx::Size size,
155 BufferFormat format); 155 BufferFormat format);
156 156
157 private: 157 private:
158 static SurfaceFactoryOzone* impl_; // not owned 158 static SurfaceFactoryOzone* impl_; // not owned
159 }; 159 };
160 160
161 } // namespace gfx 161 } // namespace ui
162 162
163 #endif // UI_GFX_OZONE_SURFACE_LNUX_FACTORY_OZONE_H_ 163 #endif // UI_OZONE_PUBLIC_SURFACE_FACTORY_OZONE_H_
OLDNEW
« no previous file with comments | « ui/ozone/public/overlay_candidates_ozone.cc ('k') | ui/ozone/public/surface_factory_ozone.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698