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; |
| 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 |
| 45 bool ExportDmaBuf(int vgem_fd, gfx::GpuMemoryBufferHandle* handle); |
| 46 |
41 // NativePixmap: | 47 // NativePixmap: |
42 void* GetEGLClientBuffer() override; | 48 void* GetEGLClientBuffer() override; |
43 int GetDmaBufFd() override; | 49 int GetDmaBufFd() override; |
44 int GetDmaBufPitch() override; | 50 int GetDmaBufPitch() override; |
| 51 BufferUsage GetBufferUsage() const override; |
45 | 52 |
46 scoped_refptr<GbmBuffer> buffer() { return buffer_; } | 53 scoped_refptr<GbmBuffer> buffer() { return buffer_; } |
47 | 54 |
48 private: | 55 private: |
49 ~GbmPixmap() override; | 56 ~GbmPixmap() override; |
50 | 57 |
51 scoped_refptr<GbmBuffer> buffer_; | 58 scoped_refptr<GbmBuffer> buffer_; |
52 int dma_buf_; | 59 int dma_buf_; |
53 | 60 |
54 DISALLOW_COPY_AND_ASSIGN(GbmPixmap); | 61 DISALLOW_COPY_AND_ASSIGN(GbmPixmap); |
55 }; | 62 }; |
56 | 63 |
57 } // namespace ui | 64 } // namespace ui |
58 | 65 |
59 #endif // UI_OZONE_PLATFORM_DRM_GPU_GBM_BUFFER_H_ | 66 #endif // UI_OZONE_PLATFORM_DRM_GPU_GBM_BUFFER_H_ |
OLD | NEW |