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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/files/scoped_file.h" | 10 #include "base/files/scoped_file.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "ui/gfx/buffer_types.h" | 12 #include "ui/gfx/buffer_types.h" |
13 #include "ui/gfx/geometry/size.h" | 13 #include "ui/gfx/geometry/size.h" |
14 #include "ui/ozone/platform/drm/gpu/gbm_buffer_base.h" | 14 #include "ui/ozone/platform/drm/gpu/gbm_buffer_base.h" |
15 #include "ui/ozone/public/native_pixmap.h" | 15 #include "ui/ozone/public/native_pixmap.h" |
16 | 16 |
17 struct gbm_bo; | 17 struct gbm_bo; |
18 | 18 |
19 namespace ui { | 19 namespace ui { |
20 | 20 |
21 class GbmDevice; | 21 class GbmDevice; |
22 class GbmSurfaceFactory; | 22 class GbmSurfaceFactory; |
23 | 23 |
24 class GbmBuffer : public GbmBufferBase { | 24 class GbmBuffer : public GbmBufferBase { |
25 public: | 25 public: |
26 static scoped_refptr<GbmBuffer> CreateBuffer( | 26 static scoped_refptr<GbmBuffer> CreateBuffer( |
27 const scoped_refptr<GbmDevice>& gbm, | 27 const scoped_refptr<GbmDevice>& gbm, |
28 uint32_t format, | 28 uint32_t format, |
29 const gfx::Size& size, | 29 const gfx::Size& size, |
30 uint32_t usage); | 30 uint32_t flags); |
| 31 static scoped_refptr<GbmBuffer> CreateBufferWithModifiers( |
| 32 const scoped_refptr<GbmDevice>& gbm, |
| 33 uint32_t format, |
| 34 const gfx::Size& size, |
| 35 uint32_t flags, |
| 36 const std::vector<uint64_t>& modifiers); |
31 static scoped_refptr<GbmBuffer> CreateBufferFromFds( | 37 static scoped_refptr<GbmBuffer> CreateBufferFromFds( |
32 const scoped_refptr<GbmDevice>& gbm, | 38 const scoped_refptr<GbmDevice>& gbm, |
33 uint32_t format, | 39 uint32_t format, |
34 const gfx::Size& size, | 40 const gfx::Size& size, |
35 std::vector<base::ScopedFD>&& fds, | 41 std::vector<base::ScopedFD>&& fds, |
36 const std::vector<gfx::NativePixmapPlane>& planes); | 42 const std::vector<gfx::NativePixmapPlane>& planes); |
37 uint32_t GetFormat() const { return format_; } | 43 uint32_t GetFormat() const { return format_; } |
38 uint32_t GetFlags() const { return flags_; } | 44 uint32_t GetFlags() const { return flags_; } |
39 bool AreFdsValid() const; | 45 bool AreFdsValid() const; |
40 size_t GetFdCount() const; | 46 size_t GetFdCount() const; |
41 int GetFd(size_t plane) const; | 47 int GetFd(size_t plane) const; |
42 int GetStride(size_t plane) const; | 48 int GetStride(size_t plane) const; |
43 int GetOffset(size_t plane) const; | 49 int GetOffset(size_t plane) const; |
44 size_t GetSize(size_t plane) const; | 50 size_t GetSize(size_t plane) const; |
45 uint64_t GetFormatModifier(size_t plane) const; | 51 uint64_t GetFormatModifier(size_t plane) const; |
46 gfx::Size GetSize() const override; | 52 gfx::Size GetSize() const override; |
47 | 53 |
48 private: | 54 private: |
49 GbmBuffer(const scoped_refptr<GbmDevice>& gbm, | 55 GbmBuffer(const scoped_refptr<GbmDevice>& gbm, |
50 gbm_bo* bo, | 56 gbm_bo* bo, |
51 uint32_t format, | 57 uint32_t format, |
52 uint32_t flags, | 58 uint32_t flags, |
| 59 uint64_t modifier, |
| 60 uint32_t addfb_flags, |
53 std::vector<base::ScopedFD>&& fds, | 61 std::vector<base::ScopedFD>&& fds, |
54 const gfx::Size& size, | 62 const gfx::Size& size, |
55 const std::vector<gfx::NativePixmapPlane>&& planes); | 63 const std::vector<gfx::NativePixmapPlane>&& planes); |
56 ~GbmBuffer() override; | 64 ~GbmBuffer() override; |
57 | 65 |
| 66 static scoped_refptr<GbmBuffer> CreateBufferForBO( |
| 67 const scoped_refptr<GbmDevice>& gbm, |
| 68 gbm_bo* bo, |
| 69 uint32_t format, |
| 70 const gfx::Size& size, |
| 71 uint32_t flags, |
| 72 uint64_t modifiers, |
| 73 uint32_t addfb_flags); |
| 74 |
58 uint32_t format_; | 75 uint32_t format_; |
59 uint32_t flags_; | 76 uint32_t flags_; |
60 std::vector<base::ScopedFD> fds_; | 77 std::vector<base::ScopedFD> fds_; |
61 gfx::Size size_; | 78 gfx::Size size_; |
62 | 79 |
63 std::vector<gfx::NativePixmapPlane> planes_; | 80 std::vector<gfx::NativePixmapPlane> planes_; |
64 | 81 |
65 DISALLOW_COPY_AND_ASSIGN(GbmBuffer); | 82 DISALLOW_COPY_AND_ASSIGN(GbmBuffer); |
66 }; | 83 }; |
67 | 84 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 // this Pixmap. This holds the processed buffer. | 121 // this Pixmap. This holds the processed buffer. |
105 scoped_refptr<GbmPixmap> processed_pixmap_; | 122 scoped_refptr<GbmPixmap> processed_pixmap_; |
106 ProcessingCallback processing_callback_; | 123 ProcessingCallback processing_callback_; |
107 | 124 |
108 DISALLOW_COPY_AND_ASSIGN(GbmPixmap); | 125 DISALLOW_COPY_AND_ASSIGN(GbmPixmap); |
109 }; | 126 }; |
110 | 127 |
111 } // namespace ui | 128 } // namespace ui |
112 | 129 |
113 #endif // UI_OZONE_PLATFORM_DRM_GPU_GBM_BUFFER_H_ | 130 #endif // UI_OZONE_PLATFORM_DRM_GPU_GBM_BUFFER_H_ |
OLD | NEW |