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" |
(...skipping 15 matching lines...) Expand all Loading... |
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 gfx::BufferFormat format, | 28 gfx::BufferFormat format, |
29 const gfx::Size& size, | 29 const gfx::Size& size, |
30 gfx::BufferUsage usage); | 30 gfx::BufferUsage usage); |
31 static scoped_refptr<GbmBuffer> CreateBufferFromFds( | 31 static scoped_refptr<GbmBuffer> CreateBufferFromFds( |
32 const scoped_refptr<GbmDevice>& gbm, | 32 const scoped_refptr<GbmDevice>& gbm, |
33 gfx::BufferFormat format, | 33 gfx::BufferFormat format, |
34 const gfx::Size& size, | 34 const gfx::Size& size, |
35 std::vector<base::ScopedFD>&& fds, | 35 std::vector<base::ScopedFD>&& fds, |
36 const std::vector<int>& strides, | 36 const std::vector<gfx::GbmBufferPlane>& planes); |
37 const std::vector<int>& offsets); | |
38 gfx::BufferFormat GetFormat() const { return format_; } | 37 gfx::BufferFormat GetFormat() const { return format_; } |
39 gfx::BufferUsage GetUsage() const { return usage_; } | 38 gfx::BufferUsage GetUsage() const { return usage_; } |
40 bool AreFdsValid() const; | 39 bool AreFdsValid() const; |
41 size_t GetFdCount() const; | 40 size_t GetFdCount() const; |
42 int GetFd(size_t plane) const; | 41 int GetFd(size_t plane) const; |
43 int GetStride(size_t plane) const; | 42 int GetStride(size_t plane) const; |
44 int GetOffset(size_t plane) const; | 43 int GetOffset(size_t plane) const; |
| 44 uint64_t GetFormatModifier(size_t plane) const; |
45 gfx::Size GetSize() const override; | 45 gfx::Size GetSize() const override; |
46 | 46 |
47 private: | 47 private: |
48 GbmBuffer(const scoped_refptr<GbmDevice>& gbm, | 48 GbmBuffer(const scoped_refptr<GbmDevice>& gbm, |
49 gbm_bo* bo, | 49 gbm_bo* bo, |
50 gfx::BufferFormat format, | 50 gfx::BufferFormat format, |
51 gfx::BufferUsage usage, | 51 gfx::BufferUsage usage, |
52 std::vector<base::ScopedFD>&& fds, | 52 std::vector<base::ScopedFD>&& fds, |
53 const gfx::Size& size, | 53 const gfx::Size& size, |
54 const std::vector<int>& strides, | 54 const std::vector<gfx::GbmBufferPlane>&& planes); |
55 const std::vector<int>& offsets); | |
56 ~GbmBuffer() override; | 55 ~GbmBuffer() override; |
57 | 56 |
58 gfx::BufferFormat format_; | 57 gfx::BufferFormat format_; |
59 gfx::BufferUsage usage_; | 58 gfx::BufferUsage usage_; |
60 std::vector<base::ScopedFD> fds_; | 59 std::vector<base::ScopedFD> fds_; |
61 gfx::Size size_; | 60 gfx::Size size_; |
62 std::vector<int> strides_; | 61 |
63 std::vector<int> offsets_; | 62 std::vector<gfx::GbmBufferPlane> planes_; |
64 | 63 |
65 DISALLOW_COPY_AND_ASSIGN(GbmBuffer); | 64 DISALLOW_COPY_AND_ASSIGN(GbmBuffer); |
66 }; | 65 }; |
67 | 66 |
68 class GbmPixmap : public NativePixmap { | 67 class GbmPixmap : public NativePixmap { |
69 public: | 68 public: |
70 GbmPixmap(GbmSurfaceFactory* surface_manager, | 69 GbmPixmap(GbmSurfaceFactory* surface_manager, |
71 const scoped_refptr<GbmBuffer>& buffer); | 70 const scoped_refptr<GbmBuffer>& buffer); |
72 | 71 |
73 void SetProcessingCallback( | 72 void SetProcessingCallback( |
74 const ProcessingCallback& processing_callback) override; | 73 const ProcessingCallback& processing_callback) override; |
75 | 74 |
76 // NativePixmap: | 75 // NativePixmap: |
77 void* GetEGLClientBuffer() const override; | 76 void* GetEGLClientBuffer() const override; |
78 bool AreDmaBufFdsValid() const override; | 77 bool AreDmaBufFdsValid() const override; |
79 size_t GetDmaBufFdCount() const override; | 78 size_t GetDmaBufFdCount() const override; |
80 int GetDmaBufFd(size_t plane) const override; | 79 int GetDmaBufFd(size_t plane) const override; |
81 int GetDmaBufPitch(size_t plane) const override; | 80 int GetDmaBufPitch(size_t plane) const override; |
82 int GetDmaBufOffset(size_t plane) const override; | 81 int GetDmaBufOffset(size_t plane) const override; |
| 82 uint64_t GetDmaBufModifier(size_t plane) const override; |
83 gfx::BufferFormat GetBufferFormat() const override; | 83 gfx::BufferFormat GetBufferFormat() const override; |
84 gfx::Size GetBufferSize() const override; | 84 gfx::Size GetBufferSize() const override; |
85 bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget, | 85 bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget, |
86 int plane_z_order, | 86 int plane_z_order, |
87 gfx::OverlayTransform plane_transform, | 87 gfx::OverlayTransform plane_transform, |
88 const gfx::Rect& display_bounds, | 88 const gfx::Rect& display_bounds, |
89 const gfx::RectF& crop_rect) override; | 89 const gfx::RectF& crop_rect) override; |
90 gfx::NativePixmapHandle ExportHandle() override; | 90 gfx::NativePixmapHandle ExportHandle() override; |
91 | 91 |
92 scoped_refptr<GbmBuffer> buffer() { return buffer_; } | 92 scoped_refptr<GbmBuffer> buffer() { return buffer_; } |
(...skipping 10 matching lines...) Expand all Loading... |
103 // this Pixmap. This holds the processed buffer. | 103 // this Pixmap. This holds the processed buffer. |
104 scoped_refptr<GbmPixmap> processed_pixmap_; | 104 scoped_refptr<GbmPixmap> processed_pixmap_; |
105 ProcessingCallback processing_callback_; | 105 ProcessingCallback processing_callback_; |
106 | 106 |
107 DISALLOW_COPY_AND_ASSIGN(GbmPixmap); | 107 DISALLOW_COPY_AND_ASSIGN(GbmPixmap); |
108 }; | 108 }; |
109 | 109 |
110 } // namespace ui | 110 } // namespace ui |
111 | 111 |
112 #endif // UI_OZONE_PLATFORM_DRM_GPU_GBM_BUFFER_H_ | 112 #endif // UI_OZONE_PLATFORM_DRM_GPU_GBM_BUFFER_H_ |
OLD | NEW |