| 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_BUFFER_H_ | 5 #ifndef UI_OZONE_PLATFORM_DRI_GBM_BUFFER_H_ |
| 6 #define UI_OZONE_PLATFORM_DRI_GBM_BUFFER_H_ | 6 #define UI_OZONE_PLATFORM_DRI_GBM_BUFFER_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" |
| 11 #include "ui/ozone/platform/dri/scanout_surface.h" |
| 11 #include "ui/ozone/public/native_pixmap.h" | 12 #include "ui/ozone/public/native_pixmap.h" |
| 12 #include "ui/ozone/public/surface_factory_ozone.h" | 13 #include "ui/ozone/public/surface_factory_ozone.h" |
| 13 | 14 |
| 14 struct gbm_bo; | 15 struct gbm_bo; |
| 15 struct gbm_device; | 16 struct gbm_device; |
| 16 | 17 |
| 17 namespace ui { | 18 namespace ui { |
| 18 | 19 |
| 19 class DriWrapper; | 20 class DriWrapper; |
| 20 | 21 |
| 21 class GbmBuffer : public NativePixmap { | 22 class GbmBuffer : public NativePixmap, public ScanoutSurface { |
| 22 public: | 23 public: |
| 23 GbmBuffer(gbm_device* device, DriWrapper* dri, const gfx::Size& size); | 24 GbmBuffer(gbm_device* device, DriWrapper* dri, const gfx::Size& size); |
| 24 | 25 |
| 25 bool InitializeBuffer(SurfaceFactoryOzone::BufferFormat format, bool scanout); | 26 bool InitializeBuffer(SurfaceFactoryOzone::BufferFormat format, bool scanout); |
| 26 | 27 |
| 27 // NativePixmap: | 28 // NativePixmap: |
| 28 virtual void* GetEGLClientBuffer() OVERRIDE; | 29 virtual void* GetEGLClientBuffer() OVERRIDE; |
| 29 virtual int GetDmaBufFd() OVERRIDE; | 30 virtual int GetDmaBufFd() OVERRIDE; |
| 30 | 31 |
| 32 // ScanoutSurface: |
| 33 virtual bool Initialize() OVERRIDE; |
| 34 virtual uint32_t GetFramebufferId() const OVERRIDE; |
| 35 virtual uint32_t GetHandle() const OVERRIDE; |
| 36 virtual gfx::Size Size() const OVERRIDE; |
| 37 virtual void PreSwapBuffers() OVERRIDE; |
| 38 virtual void SwapBuffers() OVERRIDE; |
| 39 |
| 31 protected: | 40 protected: |
| 32 virtual ~GbmBuffer(); | 41 virtual ~GbmBuffer(); |
| 33 | 42 |
| 34 private: | 43 private: |
| 35 gbm_device* gbm_device_; | 44 gbm_device* gbm_device_; |
| 36 gbm_bo* bo_; | 45 gbm_bo* bo_; |
| 37 | 46 |
| 38 uint32_t handle_; | 47 uint32_t handle_; |
| 39 uint32_t framebuffer_; | 48 uint32_t framebuffer_; |
| 40 | 49 |
| 41 DriWrapper* dri_; | 50 DriWrapper* dri_; |
| 42 | 51 |
| 43 gfx::Size size_; | 52 gfx::Size size_; |
| 44 }; | 53 }; |
| 45 | 54 |
| 46 } // namespace ui | 55 } // namespace ui |
| 47 | 56 |
| 48 #endif // UI_OZONE_PLATFORM_DRI_GBM_BUFFER_H_ | 57 #endif // UI_OZONE_PLATFORM_DRI_GBM_BUFFER_H_ |
| OLD | NEW |