| 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/platform/dri/gbm_buffer_base.h" | 
| 12 #include "ui/ozone/public/native_pixmap.h" | 12 #include "ui/ozone/public/native_pixmap.h" | 
| 13 #include "ui/ozone/public/surface_factory_ozone.h" | 13 #include "ui/ozone/public/surface_factory_ozone.h" | 
| 14 | 14 | 
| 15 struct gbm_bo; | 15 struct gbm_bo; | 
| 16 struct gbm_device; | 16 struct gbm_device; | 
| 17 | 17 | 
| 18 namespace ui { | 18 namespace ui { | 
| 19 | 19 | 
| 20 class DriWrapper; | 20 class DriWrapper; | 
| 21 | 21 | 
| 22 class GbmBuffer : public ScanoutSurface { | 22 class GbmBuffer : public GbmBufferBase { | 
| 23  public: | 23  public: | 
| 24   GbmBuffer(gbm_device* device, DriWrapper* dri, const gfx::Size& size); | 24   static scoped_refptr<GbmBuffer> CreateBuffer( | 
|  | 25       DriWrapper* dri, | 
|  | 26       gbm_device* device, | 
|  | 27       SurfaceFactoryOzone::BufferFormat format, | 
|  | 28       const gfx::Size& size, | 
|  | 29       bool scanout); | 
|  | 30 | 
|  | 31  private: | 
|  | 32   GbmBuffer(DriWrapper* dri, gbm_bo* bo, bool scanout); | 
| 25   virtual ~GbmBuffer(); | 33   virtual ~GbmBuffer(); | 
| 26 | 34 | 
| 27   bool InitializeBuffer(SurfaceFactoryOzone::BufferFormat format, bool scanout); | 35   DISALLOW_COPY_AND_ASSIGN(GbmBuffer); | 
| 28 |  | 
| 29   // ScanoutSurface: |  | 
| 30   virtual bool Initialize() 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; |  | 
| 36 |  | 
| 37   gbm_bo* bo() { return bo_; } |  | 
| 38 |  | 
| 39  private: |  | 
| 40   gbm_device* gbm_device_; |  | 
| 41   gbm_bo* bo_; |  | 
| 42 |  | 
| 43   uint32_t handle_; |  | 
| 44   uint32_t framebuffer_; |  | 
| 45 |  | 
| 46   DriWrapper* dri_; |  | 
| 47 |  | 
| 48   gfx::Size size_; |  | 
| 49 }; | 36 }; | 
| 50 | 37 | 
| 51 class GbmPixmap : public NativePixmap { | 38 class GbmPixmap : public NativePixmap { | 
| 52  public: | 39  public: | 
| 53   GbmPixmap(gbm_device* device, DriWrapper* dri, const gfx::Size& size); | 40   GbmPixmap(scoped_refptr<GbmBuffer> buffer); | 
| 54 | 41 | 
| 55   // NativePixmap: | 42   // NativePixmap: | 
| 56   virtual void* GetEGLClientBuffer() OVERRIDE; | 43   virtual void* GetEGLClientBuffer() OVERRIDE; | 
| 57   virtual int GetDmaBufFd() OVERRIDE; | 44   virtual int GetDmaBufFd() OVERRIDE; | 
| 58 | 45 | 
| 59   GbmBuffer* buffer() { return &buffer_; } | 46   scoped_refptr<GbmBuffer> buffer() { return buffer_; } | 
| 60 | 47 | 
| 61  private: | 48  private: | 
| 62   virtual ~GbmPixmap(); | 49   virtual ~GbmPixmap(); | 
| 63 | 50 | 
| 64   GbmBuffer buffer_; | 51   scoped_refptr<GbmBuffer> buffer_; | 
|  | 52 | 
|  | 53   DISALLOW_COPY_AND_ASSIGN(GbmPixmap); | 
| 65 }; | 54 }; | 
| 66 | 55 | 
| 67 }  // namespace ui | 56 }  // namespace ui | 
| 68 | 57 | 
| 69 #endif  // UI_OZONE_PLATFORM_DRI_GBM_BUFFER_H_ | 58 #endif  // UI_OZONE_PLATFORM_DRI_GBM_BUFFER_H_ | 
| OLD | NEW | 
|---|