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/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "ui/gfx/geometry/size.h" | 10 #include "ui/gfx/geometry/size.h" |
(...skipping 20 matching lines...) Expand all Loading... | |
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 PreSwapBuffers() OVERRIDE; |
36 virtual void SwapBuffers() OVERRIDE; | 36 virtual void SwapBuffers() OVERRIDE; |
37 | 37 |
38 gbm_surface* native_surface() { return native_surface_; }; | 38 gbm_surface* native_surface() { return native_surface_; }; |
39 | 39 |
40 private: | 40 private: |
41 class GbmSurfaceBuffer; | |
alexst (slow to review)
2014/07/18 21:11:31
I would prefer you declared it here fully, it shou
dnicoara
2014/07/18 21:48:28
Done.
| |
42 | |
41 gbm_device* gbm_device_; | 43 gbm_device* gbm_device_; |
42 | 44 |
43 DriWrapper* dri_; | 45 DriWrapper* dri_; |
44 | 46 |
45 gfx::Size size_; | 47 gfx::Size size_; |
46 | 48 |
47 // The native GBM surface. In EGL this represents the EGLNativeWindowType. | 49 // The native GBM surface. In EGL this represents the EGLNativeWindowType. |
48 gbm_surface* native_surface_; | 50 gbm_surface* native_surface_; |
49 | 51 |
50 // Backing GBM buffers. One is the current front buffer. The other is the | 52 // Backing GBM buffers. One is the current front buffer. The other is the |
51 // current backbuffer that is pending scan out. | 53 // current backbuffer that is pending scan out. |
52 gbm_bo* buffers_[2]; | 54 scoped_refptr<GbmSurfaceBuffer> buffers_[2]; |
53 | 55 |
54 // Index to the front buffer. | 56 // Index to the front buffer. |
55 int front_buffer_; | 57 int front_buffer_; |
56 | 58 |
57 // We can't lock (and get) an accelerated buffer from the GBM surface until | 59 // We can't lock (and get) an accelerated buffer from the GBM surface until |
58 // after something draws into it. But modesetting needs to happen earlier, | 60 // after something draws into it. But modesetting needs to happen earlier, |
59 // before an actual window is created and draws. So, we create a dumb buffer | 61 // before an actual window is created and draws. So, we create a dumb buffer |
60 // for this purpose. | 62 // for this purpose. |
61 scoped_refptr<DriBuffer> dumb_buffer_; | 63 scoped_refptr<DriBuffer> dumb_buffer_; |
62 | 64 |
63 DISALLOW_COPY_AND_ASSIGN(GbmSurface); | 65 DISALLOW_COPY_AND_ASSIGN(GbmSurface); |
64 }; | 66 }; |
65 | 67 |
66 } // namespace ui | 68 } // namespace ui |
67 | 69 |
68 #endif // UI_OZONE_PLATFORM_DRI_GBM_SURFACE_H_ | 70 #endif // UI_OZONE_PLATFORM_DRI_GBM_SURFACE_H_ |
OLD | NEW |