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/files/scoped_file.h" | 8 #include "base/files/scoped_file.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "ui/gfx/buffer_types.h" | 10 #include "ui/gfx/buffer_types.h" |
11 #include "ui/gfx/geometry/size.h" | 11 #include "ui/gfx/geometry/size.h" |
12 #include "ui/ozone/platform/drm/gpu/gbm_buffer_base.h" | 12 #include "ui/ozone/platform/drm/gpu/gbm_buffer_base.h" |
13 #include "ui/ozone/public/native_pixmap.h" | 13 #include "ui/ozone/public/native_pixmap.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 class GbmSurfaceFactory; | 20 class GbmSurfaceFactory; |
21 | 21 |
22 class GbmBuffer : public GbmBufferBase { | 22 class GbmBuffer : public GbmBufferBase { |
23 public: | 23 public: |
24 static scoped_refptr<GbmBuffer> CreateBuffer( | 24 static scoped_refptr<GbmBuffer> CreateBuffer( |
25 const scoped_refptr<GbmDevice>& gbm, | 25 const scoped_refptr<GbmDevice>& gbm, |
26 gfx::BufferFormat format, | 26 gfx::BufferFormat format, |
27 const gfx::Size& size, | 27 const gfx::Size& size, |
28 gfx::BufferUsage usage); | 28 gfx::BufferUsage usage); |
| 29 gfx::BufferFormat GetFormat() const { return format_; } |
29 gfx::BufferUsage GetUsage() const { return usage_; } | 30 gfx::BufferUsage GetUsage() const { return usage_; } |
30 | 31 |
31 private: | 32 private: |
32 GbmBuffer(const scoped_refptr<GbmDevice>& gbm, | 33 GbmBuffer(const scoped_refptr<GbmDevice>& gbm, |
33 gbm_bo* bo, | 34 gbm_bo* bo, |
| 35 gfx::BufferFormat format, |
34 gfx::BufferUsage usage); | 36 gfx::BufferUsage usage); |
35 ~GbmBuffer() override; | 37 ~GbmBuffer() override; |
36 | 38 |
| 39 gfx::BufferFormat format_; |
37 gfx::BufferUsage usage_; | 40 gfx::BufferUsage usage_; |
38 | 41 |
39 DISALLOW_COPY_AND_ASSIGN(GbmBuffer); | 42 DISALLOW_COPY_AND_ASSIGN(GbmBuffer); |
40 }; | 43 }; |
41 | 44 |
42 class GbmPixmap : public NativePixmap { | 45 class GbmPixmap : public NativePixmap { |
43 public: | 46 public: |
44 explicit GbmPixmap(GbmSurfaceFactory* surface_manager); | 47 explicit GbmPixmap(GbmSurfaceFactory* surface_manager); |
45 void Initialize(base::ScopedFD dma_buf, int dma_buf_pitch); | 48 void Initialize(base::ScopedFD dma_buf, int dma_buf_pitch); |
46 bool InitializeFromBuffer(const scoped_refptr<GbmBuffer>& buffer); | 49 bool InitializeFromBuffer(const scoped_refptr<GbmBuffer>& buffer); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 GbmSurfaceFactory* surface_manager_; | 82 GbmSurfaceFactory* surface_manager_; |
80 | 83 |
81 ProcessingCallback processing_callback_; | 84 ProcessingCallback processing_callback_; |
82 | 85 |
83 DISALLOW_COPY_AND_ASSIGN(GbmPixmap); | 86 DISALLOW_COPY_AND_ASSIGN(GbmPixmap); |
84 }; | 87 }; |
85 | 88 |
86 } // namespace ui | 89 } // namespace ui |
87 | 90 |
88 #endif // UI_OZONE_PLATFORM_DRM_GPU_GBM_BUFFER_H_ | 91 #endif // UI_OZONE_PLATFORM_DRM_GPU_GBM_BUFFER_H_ |
OLD | NEW |