| 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/overlay_transform.h" | 15 #include "ui/gfx/overlay_transform.h" |
| 16 #include "ui/gfx/rect.h" | 16 #include "ui/gfx/rect.h" |
| 17 #include "ui/platform_window/platform_window_delegate.h" |
| 17 | 18 |
| 18 class SkBitmap; | 19 class SkBitmap; |
| 19 class SkCanvas; | 20 class SkCanvas; |
| 20 | 21 |
| 21 namespace gfx { | 22 namespace gfx { |
| 22 class VSyncProvider; | 23 class VSyncProvider; |
| 23 class OverlayCandidatesOzone; | 24 class OverlayCandidatesOzone; |
| 24 class SurfaceOzoneCanvas; | 25 class SurfaceOzoneCanvas; |
| 25 class SurfaceOzoneEGL; | 26 class SurfaceOzoneEGL; |
| 26 typedef intptr_t NativeBufferOzone; | 27 typedef intptr_t NativeBufferOzone; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 // This method must be safe to run inside of the sandbox. | 94 // This method must be safe to run inside of the sandbox. |
| 94 virtual void ShutdownHardware() = 0; | 95 virtual void ShutdownHardware() = 0; |
| 95 | 96 |
| 96 // Returns native platform display handle. This is used to obtain the EGL | 97 // Returns native platform display handle. This is used to obtain the EGL |
| 97 // display connection for the native display. | 98 // display connection for the native display. |
| 98 virtual intptr_t GetNativeDisplay(); | 99 virtual intptr_t GetNativeDisplay(); |
| 99 | 100 |
| 100 // Obtains an AcceleratedWidget backed by a native Linux framebuffer. | 101 // Obtains an AcceleratedWidget backed by a native Linux framebuffer. |
| 101 // The returned AcceleratedWidget is an opaque token that must realized | 102 // The returned AcceleratedWidget is an opaque token that must realized |
| 102 // before it can be used to create a GL surface. | 103 // before it can be used to create a GL surface. |
| 103 virtual gfx::AcceleratedWidget GetAcceleratedWidget() = 0; | 104 virtual intptr_t CreatePlatformWindow(ui::PlatformWindowDelegate*) = 0; |
| 104 | 105 |
| 105 // Create SurfaceOzoneEGL for the specified gfx::AcceleratedWidget. | 106 // Create SurfaceOzoneEGL for the specified gfx::AcceleratedWidget. |
| 106 // | 107 // |
| 107 // Note: When used from content, this is called in the GPU process. The | 108 // Note: When used from content, this is called in the GPU process. The |
| 108 // platform must support creation of SurfaceOzoneEGL from the GPU process | 109 // platform must support creation of SurfaceOzoneEGL from the GPU process |
| 109 // using only the handle contained in gfx::AcceleratedWidget. | 110 // using only the handle contained in gfx::AcceleratedWidget. |
| 110 virtual scoped_ptr<SurfaceOzoneEGL> CreateEGLSurfaceForWidget( | 111 virtual scoped_ptr<SurfaceOzoneEGL> CreateEGLSurfaceForWidget( |
| 111 gfx::AcceleratedWidget widget); | 112 intptr_t widget); |
| 112 | 113 |
| 113 // Create SurfaceOzoneCanvas for the specified gfx::AcceleratedWidget. | 114 // Create SurfaceOzoneCanvas for the specified gfx::AcceleratedWidget. |
| 114 // | 115 // |
| 115 // Note: The platform must support creation of SurfaceOzoneCanvas from the | 116 // Note: The platform must support creation of SurfaceOzoneCanvas from the |
| 116 // Browser Process using only the handle contained in gfx::AcceleratedWidget. | 117 // Browser Process using only the handle contained in gfx::AcceleratedWidget. |
| 117 virtual scoped_ptr<SurfaceOzoneCanvas> CreateCanvasForWidget( | 118 virtual scoped_ptr<SurfaceOzoneCanvas> CreateCanvasForWidget(intptr_t 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 gfx::OverlayCandidatesOzone* GetOverlayCandidates(intptr_t w); |
| 135 gfx::AcceleratedWidget w); | |
| 136 | 135 |
| 137 // Sets the overlay plane to switch to at the next page flip. | 136 // 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 | 137 // |plane_z_order| specifies the stacking order of the plane relative to the |
| 139 // main framebuffer located at index 0. | 138 // main framebuffer located at index 0. |
| 140 // |plane_transform| specifies how the buffer is to be transformed during. | 139 // |plane_transform| specifies how the buffer is to be transformed during. |
| 141 // composition. | 140 // composition. |
| 142 // |buffer| to be presented by the overlay. | 141 // |buffer| to be presented by the overlay. |
| 143 // |display_bounds| specify where it is supposed to be on the screen. | 142 // |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 | 143 // |crop_rect| specifies the region within the buffer to be placed inside |
| 145 // |display_bounds|. | 144 // |display_bounds|. |
| 146 virtual void ScheduleOverlayPlane(gfx::AcceleratedWidget w, | 145 virtual void ScheduleOverlayPlane(intptr_t w, |
| 147 int plane_z_order, | 146 int plane_z_order, |
| 148 gfx::OverlayTransform plane_transform, | 147 gfx::OverlayTransform plane_transform, |
| 149 gfx::NativeBufferOzone buffer, | 148 gfx::NativeBufferOzone buffer, |
| 150 const gfx::Rect& display_bounds, | 149 const gfx::Rect& display_bounds, |
| 151 gfx::RectF crop_rect); | 150 gfx::RectF crop_rect); |
| 152 | 151 |
| 153 // Cleate a single native buffer to be used for overlay planes. | 152 // Cleate a single native buffer to be used for overlay planes. |
| 154 virtual gfx::NativeBufferOzone CreateNativeBuffer(gfx::Size size, | 153 virtual gfx::NativeBufferOzone CreateNativeBuffer(gfx::Size size, |
| 155 BufferFormat format); | 154 BufferFormat format); |
| 156 | 155 |
| 157 private: | 156 private: |
| 158 static SurfaceFactoryOzone* impl_; // not owned | 157 static SurfaceFactoryOzone* impl_; // not owned |
| 159 }; | 158 }; |
| 160 | 159 |
| 161 } // namespace gfx | 160 } // namespace gfx |
| 162 | 161 |
| 163 #endif // UI_GFX_OZONE_SURFACE_LNUX_FACTORY_OZONE_H_ | 162 #endif // UI_GFX_OZONE_SURFACE_LNUX_FACTORY_OZONE_H_ |
| OLD | NEW |