Chromium Code Reviews| 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_DRM_GPU_GBM_BUFFER_H_ | 5 #ifndef UI_OZONE_PLATFORM_DRM_GPU_GBM_BUFFER_H_ |
| 6 #define UI_OZONE_PLATFORM_DRM_GPU_GBM_BUFFER_H_ | 6 #define UI_OZONE_PLATFORM_DRM_GPU_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/drm/gpu/gbm_buffer_base.h" | 11 #include "ui/ozone/platform/drm/gpu/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 | 16 |
| 17 namespace gfx { | |
| 18 struct GpuMemoryBufferHandle; | |
|
reveman
2015/05/14 13:22:03
This code should not know about GpuMemoryBuffers.
| |
| 19 } | |
| 20 | |
| 17 namespace ui { | 21 namespace ui { |
| 18 | 22 |
| 19 class GbmDevice; | 23 class GbmDevice; |
| 20 | 24 |
| 21 class GbmBuffer : public GbmBufferBase { | 25 class GbmBuffer : public GbmBufferBase { |
| 22 public: | 26 public: |
| 23 static scoped_refptr<GbmBuffer> CreateBuffer( | 27 static scoped_refptr<GbmBuffer> CreateBuffer( |
| 24 const scoped_refptr<GbmDevice>& gbm, | 28 const scoped_refptr<GbmDevice>& gbm, |
| 25 SurfaceFactoryOzone::BufferFormat format, | 29 SurfaceFactoryOzone::BufferFormat format, |
| 26 const gfx::Size& size, | 30 const gfx::Size& size, |
| 27 bool scanout); | 31 bool scanout); |
| 28 | 32 |
| 29 private: | 33 private: |
| 30 GbmBuffer(const scoped_refptr<GbmDevice>& gbm, gbm_bo* bo, bool scanout); | 34 GbmBuffer(const scoped_refptr<GbmDevice>& gbm, gbm_bo* bo, bool scanout); |
| 31 ~GbmBuffer() override; | 35 ~GbmBuffer() override; |
| 32 | 36 |
| 33 DISALLOW_COPY_AND_ASSIGN(GbmBuffer); | 37 DISALLOW_COPY_AND_ASSIGN(GbmBuffer); |
| 34 }; | 38 }; |
| 35 | 39 |
| 36 class GbmPixmap : public NativePixmap { | 40 class GbmPixmap : public NativePixmap { |
| 37 public: | 41 public: |
| 38 GbmPixmap(const scoped_refptr<GbmBuffer>& buffer); | 42 GbmPixmap(const scoped_refptr<GbmBuffer>& buffer); |
| 39 bool Initialize(); | 43 bool Initialize(); |
| 40 | 44 |
| 41 // NativePixmap: | 45 // NativePixmap: |
| 42 void* GetEGLClientBuffer() override; | 46 void* GetEGLClientBuffer() override; |
| 43 int GetDmaBufFd() override; | 47 int GetDmaBufFd() override; |
| 44 int GetDmaBufPitch() override; | 48 int GetDmaBufPitch() override; |
| 49 BufferUsage GetBufferUsage() const override; | |
| 45 | 50 |
| 46 scoped_refptr<GbmBuffer> buffer() { return buffer_; } | 51 scoped_refptr<GbmBuffer> buffer() { return buffer_; } |
| 47 | 52 |
| 48 private: | 53 private: |
| 49 ~GbmPixmap() override; | 54 ~GbmPixmap() override; |
| 50 | 55 |
| 51 scoped_refptr<GbmBuffer> buffer_; | 56 scoped_refptr<GbmBuffer> buffer_; |
| 52 int dma_buf_; | 57 int dma_buf_; |
| 53 | 58 |
| 54 DISALLOW_COPY_AND_ASSIGN(GbmPixmap); | 59 DISALLOW_COPY_AND_ASSIGN(GbmPixmap); |
| 55 }; | 60 }; |
| 56 | 61 |
| 57 } // namespace ui | 62 } // namespace ui |
| 58 | 63 |
| 59 #endif // UI_OZONE_PLATFORM_DRM_GPU_GBM_BUFFER_H_ | 64 #endif // UI_OZONE_PLATFORM_DRM_GPU_GBM_BUFFER_H_ |
| OLD | NEW |