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 10 matching lines...) Expand all Loading... |
21 class GbmBufferBase; | 21 class GbmBufferBase; |
22 | 22 |
23 // Implement the ScanoutSurface interface on top of GBM (Generic Buffer | 23 // Implement the ScanoutSurface interface on top of GBM (Generic Buffer |
24 // Manager). GBM provides generic access to hardware accelerated surfaces which | 24 // Manager). GBM provides generic access to hardware accelerated surfaces which |
25 // can be used in association with EGL to provide accelerated drawing. | 25 // can be used in association with EGL to provide accelerated drawing. |
26 class GbmSurface : public ScanoutSurface { | 26 class GbmSurface : public ScanoutSurface { |
27 public: | 27 public: |
28 GbmSurface(gbm_device* device, DriWrapper* dri, const gfx::Size& size); | 28 GbmSurface(gbm_device* device, DriWrapper* dri, const gfx::Size& size); |
29 virtual ~GbmSurface(); | 29 virtual ~GbmSurface(); |
30 | 30 |
| 31 scoped_refptr<GbmBufferBase> backbuffer() const { |
| 32 return buffers_[front_buffer_ ^ 1]; |
| 33 } |
| 34 |
31 // ScanoutSurface: | 35 // ScanoutSurface: |
32 virtual bool Initialize() OVERRIDE; | 36 virtual bool Initialize() OVERRIDE; |
33 virtual uint32_t GetFramebufferId() const OVERRIDE; | 37 virtual uint32_t GetFramebufferId() const OVERRIDE; |
34 virtual uint32_t GetHandle() const OVERRIDE; | 38 virtual uint32_t GetHandle() const OVERRIDE; |
35 virtual gfx::Size Size() const OVERRIDE; | 39 virtual gfx::Size Size() const OVERRIDE; |
36 virtual void PreSwapBuffers() OVERRIDE; | 40 virtual void PreSwapBuffers() OVERRIDE; |
37 virtual void SwapBuffers() OVERRIDE; | 41 virtual void SwapBuffers() OVERRIDE; |
38 | 42 |
39 gbm_surface* native_surface() { return native_surface_; }; | 43 gbm_surface* native_surface() { return native_surface_; }; |
40 | 44 |
(...skipping 19 matching lines...) Expand all Loading... |
60 // before an actual window is created and draws. So, we create a dumb buffer | 64 // before an actual window is created and draws. So, we create a dumb buffer |
61 // for this purpose. | 65 // for this purpose. |
62 scoped_refptr<DriBuffer> dumb_buffer_; | 66 scoped_refptr<DriBuffer> dumb_buffer_; |
63 | 67 |
64 DISALLOW_COPY_AND_ASSIGN(GbmSurface); | 68 DISALLOW_COPY_AND_ASSIGN(GbmSurface); |
65 }; | 69 }; |
66 | 70 |
67 } // namespace ui | 71 } // namespace ui |
68 | 72 |
69 #endif // UI_OZONE_PLATFORM_DRI_GBM_SURFACE_H_ | 73 #endif // UI_OZONE_PLATFORM_DRI_GBM_SURFACE_H_ |
OLD | NEW |