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 ui { | 17 namespace ui { |
18 | 18 |
19 class GbmDevice; | 19 class GbmDevice; |
20 | 20 |
21 class GbmBuffer : public GbmBufferBase { | 21 class GbmBuffer : public GbmBufferBase { |
22 public: | 22 public: |
23 static scoped_refptr<GbmBuffer> CreateBuffer( | 23 static scoped_refptr<GbmBuffer> CreateBuffer( |
24 const scoped_refptr<GbmDevice>& gbm, | 24 const scoped_refptr<GbmDevice>& gbm, |
25 SurfaceFactoryOzone::BufferFormat format, | 25 SurfaceFactoryOzone::BufferFormat format, |
26 const gfx::Size& size, | 26 const gfx::Size& size); |
27 bool scanout); | |
28 | 27 |
29 private: | 28 private: |
30 GbmBuffer(const scoped_refptr<GbmDevice>& gbm, gbm_bo* bo, bool scanout); | 29 GbmBuffer(const scoped_refptr<GbmDevice>& gbm, gbm_bo* bo); |
31 ~GbmBuffer() override; | 30 ~GbmBuffer() override; |
32 | 31 |
33 DISALLOW_COPY_AND_ASSIGN(GbmBuffer); | 32 DISALLOW_COPY_AND_ASSIGN(GbmBuffer); |
34 }; | 33 }; |
35 | 34 |
36 class GbmPixmap : public NativePixmap { | 35 class GbmPixmap : public NativePixmap { |
37 public: | 36 public: |
38 GbmPixmap(const scoped_refptr<GbmBuffer>& buffer); | 37 GbmPixmap(const scoped_refptr<GbmBuffer>& buffer); |
39 bool Initialize(); | 38 bool Initialize(); |
40 | 39 |
41 // NativePixmap: | 40 // NativePixmap: |
42 void* GetEGLClientBuffer() override; | 41 void* GetEGLClientBuffer() override; |
43 int GetDmaBufFd() override; | 42 int GetDmaBufFd() override; |
44 int GetDmaBufPitch() override; | 43 int GetDmaBufPitch() override; |
45 | 44 |
46 scoped_refptr<GbmBuffer> buffer() { return buffer_; } | 45 scoped_refptr<GbmBuffer> buffer() { return buffer_; } |
47 | 46 |
48 private: | 47 private: |
49 ~GbmPixmap() override; | 48 ~GbmPixmap() override; |
50 | 49 |
51 scoped_refptr<GbmBuffer> buffer_; | 50 scoped_refptr<GbmBuffer> buffer_; |
52 int dma_buf_; | 51 int dma_buf_; |
53 | 52 |
54 DISALLOW_COPY_AND_ASSIGN(GbmPixmap); | 53 DISALLOW_COPY_AND_ASSIGN(GbmPixmap); |
55 }; | 54 }; |
56 | 55 |
57 } // namespace ui | 56 } // namespace ui |
58 | 57 |
59 #endif // UI_OZONE_PLATFORM_DRM_GPU_GBM_BUFFER_H_ | 58 #endif // UI_OZONE_PLATFORM_DRM_GPU_GBM_BUFFER_H_ |
OLD | NEW |