| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 OZONE_BASE_EXPORT SurfaceFactoryOzone { | 59 class OZONE_BASE_EXPORT SurfaceFactoryOzone { |
| 60 public: | 60 public: |
| 61 // Describes the state of the hardware after initialization. | |
| 62 enum HardwareState { | |
| 63 UNINITIALIZED, | |
| 64 INITIALIZED, | |
| 65 FAILED, | |
| 66 }; | |
| 67 | |
| 68 // Describes overlay buffer format. | 61 // Describes overlay buffer format. |
| 69 // 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 |
| 70 // 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. |
| 71 enum BufferFormat { | 64 enum BufferFormat { |
| 72 UNKNOWN, | 65 UNKNOWN, |
| 73 RGBA_8888, | 66 RGBA_8888, |
| 74 RGB_888, | 67 RGB_888, |
| 75 }; | 68 }; |
| 76 | 69 |
| 77 typedef void* (*GLGetProcAddressProc)(const char* name); | 70 typedef void* (*GLGetProcAddressProc)(const char* name); |
| 78 typedef base::Callback<void(base::NativeLibrary)> AddGLLibraryCallback; | 71 typedef base::Callback<void(base::NativeLibrary)> AddGLLibraryCallback; |
| 79 typedef base::Callback<void(GLGetProcAddressProc)> | 72 typedef base::Callback<void(GLGetProcAddressProc)> |
| 80 SetGLGetProcAddressProcCallback; | 73 SetGLGetProcAddressProcCallback; |
| 81 | 74 |
| 82 SurfaceFactoryOzone(); | 75 SurfaceFactoryOzone(); |
| 83 virtual ~SurfaceFactoryOzone(); | 76 virtual ~SurfaceFactoryOzone(); |
| 84 | 77 |
| 85 // Returns the singleton instance. | 78 // Returns the singleton instance. |
| 86 static SurfaceFactoryOzone* GetInstance(); | 79 static SurfaceFactoryOzone* GetInstance(); |
| 87 | 80 |
| 88 // Configures the display hardware. Must be called from within the GPU | |
| 89 // process before the sandbox has been activated. | |
| 90 virtual HardwareState InitializeHardware() = 0; | |
| 91 | |
| 92 // Cleans up display hardware state. Call this from within the GPU process. | |
| 93 // This method must be safe to run inside of the sandbox. | |
| 94 virtual void ShutdownHardware() = 0; | |
| 95 | |
| 96 // Returns native platform display handle. This is used to obtain the EGL | 81 // Returns native platform display handle. This is used to obtain the EGL |
| 97 // display connection for the native display. | 82 // display connection for the native display. |
| 98 virtual intptr_t GetNativeDisplay(); | 83 virtual intptr_t GetNativeDisplay(); |
| 99 | 84 |
| 100 // Obtains an AcceleratedWidget backed by a native Linux framebuffer. | 85 // Obtains an AcceleratedWidget backed by a native Linux framebuffer. |
| 101 // The returned AcceleratedWidget is an opaque token that must realized | 86 // The returned AcceleratedWidget is an opaque token that must realized |
| 102 // before it can be used to create a GL surface. | 87 // before it can be used to create a GL surface. |
| 103 virtual gfx::AcceleratedWidget GetAcceleratedWidget() = 0; | 88 virtual gfx::AcceleratedWidget GetAcceleratedWidget() = 0; |
| 104 | 89 |
| 105 // Create SurfaceOzoneEGL for the specified gfx::AcceleratedWidget. | 90 // Create SurfaceOzoneEGL for the specified gfx::AcceleratedWidget. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 // overlay-only mode. | 129 // overlay-only mode. |
| 145 virtual bool CanShowPrimaryPlaneAsOverlay(); | 130 virtual bool CanShowPrimaryPlaneAsOverlay(); |
| 146 | 131 |
| 147 private: | 132 private: |
| 148 static SurfaceFactoryOzone* impl_; // not owned | 133 static SurfaceFactoryOzone* impl_; // not owned |
| 149 }; | 134 }; |
| 150 | 135 |
| 151 } // namespace ui | 136 } // namespace ui |
| 152 | 137 |
| 153 #endif // UI_OZONE_PUBLIC_SURFACE_FACTORY_OZONE_H_ | 138 #endif // UI_OZONE_PUBLIC_SURFACE_FACTORY_OZONE_H_ |
| OLD | NEW |