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" |
11 #include "ui/ozone/platform/dri/scanout_surface.h" | 11 #include "ui/ozone/platform/dri/scanout_surface.h" |
12 | 12 |
13 struct gbm_bo; | 13 struct gbm_bo; |
14 struct gbm_device; | 14 struct gbm_device; |
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 DriWrapper; | 20 class DriWrapper; |
| 21 class GbmBufferBase; |
21 | 22 |
22 // Implement the ScanoutSurface interface on top of GBM (Generic Buffer | 23 // Implement the ScanoutSurface interface on top of GBM (Generic Buffer |
23 // Manager). GBM provides generic access to hardware accelerated surfaces which | 24 // Manager). GBM provides generic access to hardware accelerated surfaces which |
24 // can be used in association with EGL to provide accelerated drawing. | 25 // can be used in association with EGL to provide accelerated drawing. |
25 class GbmSurface : public ScanoutSurface { | 26 class GbmSurface : public ScanoutSurface { |
26 public: | 27 public: |
27 GbmSurface(gbm_device* device, DriWrapper* dri, const gfx::Size& size); | 28 GbmSurface(gbm_device* device, DriWrapper* dri, const gfx::Size& size); |
28 virtual ~GbmSurface(); | 29 virtual ~GbmSurface(); |
29 | 30 |
30 // ScanoutSurface: | 31 // ScanoutSurface: |
(...skipping 11 matching lines...) Expand all Loading... |
42 | 43 |
43 DriWrapper* dri_; | 44 DriWrapper* dri_; |
44 | 45 |
45 gfx::Size size_; | 46 gfx::Size size_; |
46 | 47 |
47 // The native GBM surface. In EGL this represents the EGLNativeWindowType. | 48 // The native GBM surface. In EGL this represents the EGLNativeWindowType. |
48 gbm_surface* native_surface_; | 49 gbm_surface* native_surface_; |
49 | 50 |
50 // Backing GBM buffers. One is the current front buffer. The other is the | 51 // Backing GBM buffers. One is the current front buffer. The other is the |
51 // current backbuffer that is pending scan out. | 52 // current backbuffer that is pending scan out. |
52 gbm_bo* buffers_[2]; | 53 scoped_refptr<GbmBufferBase> buffers_[2]; |
53 | 54 |
54 // Index to the front buffer. | 55 // Index to the front buffer. |
55 int front_buffer_; | 56 int front_buffer_; |
56 | 57 |
57 // We can't lock (and get) an accelerated buffer from the GBM surface until | 58 // 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, | 59 // 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 | 60 // before an actual window is created and draws. So, we create a dumb buffer |
60 // for this purpose. | 61 // for this purpose. |
61 scoped_refptr<DriBuffer> dumb_buffer_; | 62 scoped_refptr<DriBuffer> dumb_buffer_; |
62 | 63 |
63 DISALLOW_COPY_AND_ASSIGN(GbmSurface); | 64 DISALLOW_COPY_AND_ASSIGN(GbmSurface); |
64 }; | 65 }; |
65 | 66 |
66 } // namespace ui | 67 } // namespace ui |
67 | 68 |
68 #endif // UI_OZONE_PLATFORM_DRI_GBM_SURFACE_H_ | 69 #endif // UI_OZONE_PLATFORM_DRI_GBM_SURFACE_H_ |
OLD | NEW |