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/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "ui/gfx/geometry/size.h" | 10 #include "ui/gfx/geometry/size.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 class GbmSurface : public ScanoutSurface { | 25 class GbmSurface : public ScanoutSurface { |
26 public: | 26 public: |
27 GbmSurface(gbm_device* device, DriWrapper* dri, const gfx::Size& size); | 27 GbmSurface(gbm_device* device, DriWrapper* dri, const gfx::Size& size); |
28 virtual ~GbmSurface(); | 28 virtual ~GbmSurface(); |
29 | 29 |
30 // ScanoutSurface: | 30 // ScanoutSurface: |
31 virtual bool Initialize() OVERRIDE; | 31 virtual bool Initialize() OVERRIDE; |
32 virtual uint32_t GetFramebufferId() const OVERRIDE; | 32 virtual uint32_t GetFramebufferId() const OVERRIDE; |
33 virtual uint32_t GetHandle() const OVERRIDE; | 33 virtual uint32_t GetHandle() const OVERRIDE; |
34 virtual gfx::Size Size() const OVERRIDE; | 34 virtual gfx::Size Size() const OVERRIDE; |
| 35 virtual void PreSwapBuffers() OVERRIDE; |
35 virtual void SwapBuffers() OVERRIDE; | 36 virtual void SwapBuffers() OVERRIDE; |
36 | 37 |
37 // Before scheduling the backbuffer to be scanned out we need to "lock" it. | |
38 // When we lock it, GBM will give a pointer to a buffer representing the | |
39 // backbuffer. It will also update its information on which buffers can not be | |
40 // used for drawing. The buffer will be released when the page flip event | |
41 // occurs (see SwapBuffers). This is called from GbmSurfaceFactory before | |
42 // scheduling a page flip. | |
43 void LockCurrentDrawable(); | |
44 | |
45 gbm_surface* native_surface() { return native_surface_; }; | 38 gbm_surface* native_surface() { return native_surface_; }; |
46 | 39 |
47 private: | 40 private: |
48 gbm_device* gbm_device_; | 41 gbm_device* gbm_device_; |
49 | 42 |
50 DriWrapper* dri_; | 43 DriWrapper* dri_; |
51 | 44 |
52 gfx::Size size_; | 45 gfx::Size size_; |
53 | 46 |
54 // The native GBM surface. In EGL this represents the EGLNativeWindowType. | 47 // The native GBM surface. In EGL this represents the EGLNativeWindowType. |
(...skipping 11 matching lines...) Expand all Loading... |
66 // before an actual window is created and draws. So, we create a dumb buffer | 59 // before an actual window is created and draws. So, we create a dumb buffer |
67 // for this purpose. | 60 // for this purpose. |
68 scoped_ptr<DriBuffer> dumb_buffer_; | 61 scoped_ptr<DriBuffer> dumb_buffer_; |
69 | 62 |
70 DISALLOW_COPY_AND_ASSIGN(GbmSurface); | 63 DISALLOW_COPY_AND_ASSIGN(GbmSurface); |
71 }; | 64 }; |
72 | 65 |
73 } // namespace ui | 66 } // namespace ui |
74 | 67 |
75 #endif // UI_OZONE_PLATFORM_DRI_GBM_SURFACE_H_ | 68 #endif // UI_OZONE_PLATFORM_DRI_GBM_SURFACE_H_ |
OLD | NEW |