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_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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 // Describes overlay buffer format. | 61 // Describes overlay buffer format. |
| 62 // TODO: this is a placeholder for now and will be populated with more | 62 // TODO: this is a placeholder for now and will be populated with more |
| 63 // formats once we know what sorts of content, video, etc. we can support. | 63 // formats once we know what sorts of content, video, etc. we can support. |
| 64 enum BufferFormat { | 64 enum BufferFormat { |
| 65 UNKNOWN, | 65 UNKNOWN, |
| 66 RGBA_8888, | 66 RGBA_8888, |
| 67 RGBX_8888, | 67 RGBX_8888, |
| 68 RGB_888, | 68 RGB_888, |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 enum BufferUsage { | |
| 72 MAP, | |
|
spang
2014/11/07 17:42:06
do we ever want both (MAP | SCANOUT)?
| |
| 73 SCANOUT, | |
| 74 }; | |
| 75 | |
| 71 typedef void* (*GLGetProcAddressProc)(const char* name); | 76 typedef void* (*GLGetProcAddressProc)(const char* name); |
| 72 typedef base::Callback<void(base::NativeLibrary)> AddGLLibraryCallback; | 77 typedef base::Callback<void(base::NativeLibrary)> AddGLLibraryCallback; |
| 73 typedef base::Callback<void(GLGetProcAddressProc)> | 78 typedef base::Callback<void(GLGetProcAddressProc)> |
| 74 SetGLGetProcAddressProcCallback; | 79 SetGLGetProcAddressProcCallback; |
| 75 | 80 |
| 76 SurfaceFactoryOzone(); | 81 SurfaceFactoryOzone(); |
| 77 virtual ~SurfaceFactoryOzone(); | 82 virtual ~SurfaceFactoryOzone(); |
| 78 | 83 |
| 79 // Returns the singleton instance. | 84 // Returns the singleton instance. |
| 80 static SurfaceFactoryOzone* GetInstance(); | 85 static SurfaceFactoryOzone* GetInstance(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 114 // used to select a display configuration. Note that all properties should be | 119 // used to select a display configuration. Note that all properties should be |
| 115 // immediately followed by the corresponding desired value and array should be | 120 // immediately followed by the corresponding desired value and array should be |
| 116 // terminated with EGL_NONE. Ownership of the array is not transferred to | 121 // terminated with EGL_NONE. Ownership of the array is not transferred to |
| 117 // caller. desired_list contains list of desired EGL properties and values. | 122 // caller. desired_list contains list of desired EGL properties and values. |
| 118 virtual const int32* GetEGLSurfaceProperties(const int32* desired_list); | 123 virtual const int32* GetEGLSurfaceProperties(const int32* desired_list); |
| 119 | 124 |
| 120 // Get the hal struct to check for overlay support. | 125 // Get the hal struct to check for overlay support. |
| 121 virtual OverlayCandidatesOzone* GetOverlayCandidates( | 126 virtual OverlayCandidatesOzone* GetOverlayCandidates( |
| 122 gfx::AcceleratedWidget w); | 127 gfx::AcceleratedWidget w); |
| 123 | 128 |
| 124 // Cleate a single native buffer to be used for overlay planes. | 129 // Cleate a single native buffer to be used for overlay planes or zero copy. |
| 125 virtual scoped_refptr<NativePixmap> CreateNativePixmap( | 130 virtual scoped_refptr<NativePixmap> CreateNativePixmap(gfx::Size size, |
| 126 gfx::Size size, | 131 BufferFormat format, |
| 127 BufferFormat format); | 132 BufferUsage usage); |
| 128 | 133 |
| 129 // Sets the overlay plane to switch to at the next page flip. | 134 // Sets the overlay plane to switch to at the next page flip. |
| 130 // |w| specifies the screen to display this overlay plane on. | 135 // |w| specifies the screen to display this overlay plane on. |
| 131 // |plane_z_order| specifies the stacking order of the plane relative to the | 136 // |plane_z_order| specifies the stacking order of the plane relative to the |
| 132 // main framebuffer located at index 0. | 137 // main framebuffer located at index 0. |
| 133 // |plane_transform| specifies how the buffer is to be transformed during. | 138 // |plane_transform| specifies how the buffer is to be transformed during. |
| 134 // composition. | 139 // composition. |
| 135 // |buffer| to be presented by the overlay. | 140 // |buffer| to be presented by the overlay. |
| 136 // |display_bounds| specify where it is supposed to be on the screen. | 141 // |display_bounds| specify where it is supposed to be on the screen. |
| 137 // |crop_rect| specifies the region within the buffer to be placed | 142 // |crop_rect| specifies the region within the buffer to be placed |
| 138 // inside |display_bounds|. This is specified in texture coordinates, in the | 143 // inside |display_bounds|. This is specified in texture coordinates, in the |
| 139 // range of [0,1]. | 144 // range of [0,1]. |
| 140 virtual bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget, | 145 virtual bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget, |
| 141 int plane_z_order, | 146 int plane_z_order, |
| 142 gfx::OverlayTransform plane_transform, | 147 gfx::OverlayTransform plane_transform, |
| 143 scoped_refptr<NativePixmap> buffer, | 148 scoped_refptr<NativePixmap> buffer, |
| 144 const gfx::Rect& display_bounds, | 149 const gfx::Rect& display_bounds, |
| 145 const gfx::RectF& crop_rect); | 150 const gfx::RectF& crop_rect); |
| 146 | 151 |
| 147 // Returns true if overlays can be shown at z-index 0, replacing the main | 152 // Returns true if overlays can be shown at z-index 0, replacing the main |
| 148 // surface. Combined with surfaceless extensions, it allows for an | 153 // surface. Combined with surfaceless extensions, it allows for an |
| 149 // overlay-only mode. | 154 // overlay-only mode. |
| 150 virtual bool CanShowPrimaryPlaneAsOverlay(); | 155 virtual bool CanShowPrimaryPlaneAsOverlay(); |
| 151 | 156 |
| 157 // Returns true if the platform is able to create buffers for a specific usage | |
| 158 // such as MAP for zero copy or SCANOUT for display controller. | |
| 159 virtual bool CanCreateNativePixmap(BufferUsage usage); | |
| 160 | |
| 152 private: | 161 private: |
| 153 static SurfaceFactoryOzone* impl_; // not owned | 162 static SurfaceFactoryOzone* impl_; // not owned |
| 154 }; | 163 }; |
| 155 | 164 |
| 156 } // namespace ui | 165 } // namespace ui |
| 157 | 166 |
| 158 #endif // UI_OZONE_PUBLIC_SURFACE_FACTORY_OZONE_H_ | 167 #endif // UI_OZONE_PUBLIC_SURFACE_FACTORY_OZONE_H_ |
| OLD | NEW |