| 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 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); |
| 25 virtual ~GbmBuffer(); |
| 24 | 26 |
| 25 bool InitializeBuffer(SurfaceFactoryOzone::BufferFormat format, bool scanout); | 27 bool InitializeBuffer(SurfaceFactoryOzone::BufferFormat format, bool scanout); |
| 26 | 28 |
| 27 // NativePixmap: | 29 // ScanoutSurface: |
| 28 virtual void* GetEGLClientBuffer() OVERRIDE; | 30 virtual bool Initialize() OVERRIDE; |
| 29 virtual int GetDmaBufFd() OVERRIDE; | 31 virtual uint32_t GetFramebufferId() const OVERRIDE; |
| 32 virtual uint32_t GetHandle() const OVERRIDE; |
| 33 virtual gfx::Size Size() const OVERRIDE; |
| 34 virtual void PreSwapBuffers() OVERRIDE; |
| 35 virtual void SwapBuffers() OVERRIDE; |
| 30 | 36 |
| 31 protected: | 37 gbm_bo* bo() { return bo_; } |
| 32 virtual ~GbmBuffer(); | |
| 33 | 38 |
| 34 private: | 39 private: |
| 35 gbm_device* gbm_device_; | 40 gbm_device* gbm_device_; |
| 36 gbm_bo* bo_; | 41 gbm_bo* bo_; |
| 37 | 42 |
| 38 uint32_t handle_; | 43 uint32_t handle_; |
| 39 uint32_t framebuffer_; | 44 uint32_t framebuffer_; |
| 40 | 45 |
| 41 DriWrapper* dri_; | 46 DriWrapper* dri_; |
| 42 | 47 |
| 43 gfx::Size size_; | 48 gfx::Size size_; |
| 44 }; | 49 }; |
| 45 | 50 |
| 51 class GbmPixmap : public NativePixmap { |
| 52 public: |
| 53 GbmPixmap(gbm_device* device, DriWrapper* dri, const gfx::Size& size); |
| 54 virtual ~GbmPixmap(); |
| 55 |
| 56 // NativePixmap: |
| 57 virtual void* GetEGLClientBuffer() OVERRIDE; |
| 58 virtual int GetDmaBufFd() OVERRIDE; |
| 59 |
| 60 GbmBuffer* buffer() { return &buffer_; } |
| 61 |
| 62 private: |
| 63 GbmBuffer buffer_; |
| 64 }; |
| 65 |
| 46 } // namespace ui | 66 } // namespace ui |
| 47 | 67 |
| 48 #endif // UI_OZONE_PLATFORM_DRI_GBM_BUFFER_H_ | 68 #endif // UI_OZONE_PLATFORM_DRI_GBM_BUFFER_H_ |
| OLD | NEW |