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