| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_PLATFORM_DRI_GBM_SURFACE_H_ | 5 #ifndef UI_OZONE_PLATFORM_DRI_GBM_SURFACE_H_ |
| 6 #define UI_OZONE_PLATFORM_DRI_GBM_SURFACE_H_ | 6 #define UI_OZONE_PLATFORM_DRI_GBM_SURFACE_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "ui/gfx/geometry/size.h" | 10 #include "ui/gfx/geometry/size.h" |
| 11 #include "ui/ozone/platform/dri/gbm_surfaceless.h" | 11 #include "ui/ozone/platform/dri/gbm_surfaceless.h" |
| 12 #include "ui/ozone/public/surface_ozone_egl.h" | 12 #include "ui/ozone/public/surface_ozone_egl.h" |
| 13 | 13 |
| 14 struct gbm_bo; | 14 struct gbm_bo; |
| 15 struct gbm_surface; | 15 struct gbm_surface; |
| 16 | 16 |
| 17 namespace ui { | 17 namespace ui { |
| 18 | 18 |
| 19 class DriBuffer; | 19 class DriBuffer; |
| 20 class DriWindowDelegate; | 20 class DriWindowDelegate; |
| 21 class GbmWrapper; | 21 class GbmDevice; |
| 22 | 22 |
| 23 // Extends the GBM surfaceless functionality and adds an implicit surface for | 23 // Extends the GBM surfaceless functionality and adds an implicit surface for |
| 24 // the primary plane. Arbitrary buffers can still be allocated and displayed as | 24 // the primary plane. Arbitrary buffers can still be allocated and displayed as |
| 25 // overlay planes, however the primary plane is associated with the native | 25 // overlay planes, however the primary plane is associated with the native |
| 26 // surface and is updated via an EGLSurface. | 26 // surface and is updated via an EGLSurface. |
| 27 class GbmSurface : public GbmSurfaceless { | 27 class GbmSurface : public GbmSurfaceless { |
| 28 public: | 28 public: |
| 29 GbmSurface(DriWindowDelegate* window_delegate, | 29 GbmSurface(DriWindowDelegate* window_delegate, |
| 30 const scoped_refptr<GbmWrapper>& gbm); | 30 const scoped_refptr<GbmDevice>& gbm); |
| 31 ~GbmSurface() override; | 31 ~GbmSurface() override; |
| 32 | 32 |
| 33 bool Initialize(); | 33 bool Initialize(); |
| 34 | 34 |
| 35 // GbmSurfaceless: | 35 // GbmSurfaceless: |
| 36 intptr_t GetNativeWindow() override; | 36 intptr_t GetNativeWindow() override; |
| 37 bool ResizeNativeWindow(const gfx::Size& viewport_size) override; | 37 bool ResizeNativeWindow(const gfx::Size& viewport_size) override; |
| 38 bool OnSwapBuffers() override; | 38 bool OnSwapBuffers() override; |
| 39 bool OnSwapBuffersAsync(const SwapCompletionCallback& callback) override; | 39 bool OnSwapBuffersAsync(const SwapCompletionCallback& callback) override; |
| 40 | 40 |
| 41 private: | 41 private: |
| 42 void OnSwapBuffersCallback(const SwapCompletionCallback& callback, | 42 void OnSwapBuffersCallback(const SwapCompletionCallback& callback, |
| 43 gbm_bo* pending_buffer); | 43 gbm_bo* pending_buffer); |
| 44 | 44 |
| 45 scoped_refptr<GbmWrapper> gbm_; | 45 scoped_refptr<GbmDevice> gbm_; |
| 46 | 46 |
| 47 // The native GBM surface. In EGL this represents the EGLNativeWindowType. | 47 // The native GBM surface. In EGL this represents the EGLNativeWindowType. |
| 48 gbm_surface* native_surface_; | 48 gbm_surface* native_surface_; |
| 49 | 49 |
| 50 // Buffer currently used for scanout. | 50 // Buffer currently used for scanout. |
| 51 gbm_bo* current_buffer_; | 51 gbm_bo* current_buffer_; |
| 52 | 52 |
| 53 gfx::Size size_; | 53 gfx::Size size_; |
| 54 | 54 |
| 55 base::WeakPtrFactory<GbmSurface> weak_factory_; | 55 base::WeakPtrFactory<GbmSurface> weak_factory_; |
| 56 | 56 |
| 57 DISALLOW_COPY_AND_ASSIGN(GbmSurface); | 57 DISALLOW_COPY_AND_ASSIGN(GbmSurface); |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 } // namespace ui | 60 } // namespace ui |
| 61 | 61 |
| 62 #endif // UI_OZONE_PLATFORM_DRI_GBM_SURFACE_H_ | 62 #endif // UI_OZONE_PLATFORM_DRI_GBM_SURFACE_H_ |
| OLD | NEW |