Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(639)

Side by Side Diff: ui/ozone/platform/drm/gpu/gbm_buffer.h

Issue 2705213005: Add NativePixmapDmabufStub to finalize glCreateImageCHROMIUM on Linux. (Closed)
Patch Set: Just rebase Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/gfx/linux/native_pixmap_dmabuf.cc ('k') | ui/ozone/platform/drm/gpu/gbm_buffer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/gfx/native_pixmap.h" 14 #include "ui/gfx/linux/native_pixmap_dmabuf.h"
15 #include "ui/ozone/platform/drm/gpu/gbm_buffer_base.h" 15 #include "ui/ozone/platform/drm/gpu/gbm_buffer_base.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 {
(...skipping 16 matching lines...) Expand all
41 std::vector<base::ScopedFD>&& fds, 41 std::vector<base::ScopedFD>&& fds,
42 const std::vector<gfx::NativePixmapPlane>& planes); 42 const std::vector<gfx::NativePixmapPlane>& planes);
43 uint32_t GetFormat() const { return format_; } 43 uint32_t GetFormat() const { return format_; }
44 uint32_t GetFlags() const { return flags_; } 44 uint32_t GetFlags() const { return flags_; }
45 bool AreFdsValid() const; 45 bool AreFdsValid() const;
46 size_t GetFdCount() const; 46 size_t GetFdCount() const;
47 int GetFd(size_t plane) const; 47 int GetFd(size_t plane) const;
48 int GetStride(size_t plane) const; 48 int GetStride(size_t plane) const;
49 int GetOffset(size_t plane) const; 49 int GetOffset(size_t plane) const;
50 size_t GetSize(size_t plane) const; 50 size_t GetSize(size_t plane) const;
51
52 // GbmBufferBase
51 gfx::Size GetSize() const override; 53 gfx::Size GetSize() const override;
52 54
55 scoped_refptr<gfx::NativePixmapDmabufHelper> helper() { return helper_; }
56
53 private: 57 private:
54 GbmBuffer(const scoped_refptr<GbmDevice>& gbm, 58 GbmBuffer(const scoped_refptr<GbmDevice>& gbm,
55 gbm_bo* bo, 59 gbm_bo* bo,
56 uint32_t format, 60 uint32_t format,
57 uint32_t flags, 61 uint32_t flags,
58 uint64_t modifier, 62 uint64_t modifier,
59 uint32_t addfb_flags, 63 uint32_t addfb_flags,
60 std::vector<base::ScopedFD>&& fds, 64 std::vector<base::ScopedFD>&& fds,
61 const gfx::Size& size, 65 const gfx::Size& size,
62 const std::vector<gfx::NativePixmapPlane>&& planes); 66 const std::vector<gfx::NativePixmapPlane>&& planes);
63 ~GbmBuffer() override; 67 ~GbmBuffer() override;
64 68
65 static scoped_refptr<GbmBuffer> CreateBufferForBO( 69 static scoped_refptr<GbmBuffer> CreateBufferForBO(
66 const scoped_refptr<GbmDevice>& gbm, 70 const scoped_refptr<GbmDevice>& gbm,
67 gbm_bo* bo, 71 gbm_bo* bo,
68 uint32_t format, 72 uint32_t format,
69 const gfx::Size& size, 73 const gfx::Size& size,
70 uint32_t flags, 74 uint32_t flags,
71 uint64_t modifiers, 75 uint64_t modifiers,
72 uint32_t addfb_flags); 76 uint32_t addfb_flags);
73 77
74 uint32_t format_; 78 uint32_t format_;
75 uint32_t flags_; 79 uint32_t flags_;
76 std::vector<base::ScopedFD> fds_;
77 gfx::Size size_; 80 gfx::Size size_;
78 81
79 std::vector<gfx::NativePixmapPlane> planes_; 82 scoped_refptr<gfx::NativePixmapDmabufHelper> helper_;
80 83
81 DISALLOW_COPY_AND_ASSIGN(GbmBuffer); 84 DISALLOW_COPY_AND_ASSIGN(GbmBuffer);
82 }; 85 };
83 86
84 class GbmPixmap : public gfx::NativePixmap { 87 class GbmPixmap : public gfx::NativePixmapDmaBuf {
85 public: 88 public:
86 GbmPixmap(GbmSurfaceFactory* surface_manager, 89 GbmPixmap(GbmSurfaceFactory* surface_manager,
87 const scoped_refptr<GbmBuffer>& buffer); 90 const scoped_refptr<GbmBuffer>& buffer);
88 91
89 void SetProcessingCallback( 92 // NativePixmapDmabuf
90 const ProcessingCallback& processing_callback) override;
91
92 // NativePixmap:
93 void* GetEGLClientBuffer() const override;
94 bool AreDmaBufFdsValid() const override;
95 size_t GetDmaBufFdCount() const override;
96 int GetDmaBufFd(size_t plane) const override;
97 int GetDmaBufPitch(size_t plane) const override;
98 int GetDmaBufOffset(size_t plane) const override;
99 uint64_t GetDmaBufModifier(size_t plane) const override; 93 uint64_t GetDmaBufModifier(size_t plane) const override;
100 gfx::BufferFormat GetBufferFormat() const override;
101 gfx::Size GetBufferSize() const override;
102 bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget, 94 bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget,
103 int plane_z_order, 95 int plane_z_order,
104 gfx::OverlayTransform plane_transform, 96 gfx::OverlayTransform plane_transform,
105 const gfx::Rect& display_bounds, 97 const gfx::Rect& display_bounds,
106 const gfx::RectF& crop_rect) override; 98 const gfx::RectF& crop_rect) override;
99 void SetProcessingCallback(
100 const ProcessingCallback& processing_callback) override;
107 gfx::NativePixmapHandle ExportHandle() override; 101 gfx::NativePixmapHandle ExportHandle() override;
108 102
109 scoped_refptr<GbmBuffer> buffer() { return buffer_; } 103 scoped_refptr<GbmBuffer> buffer() { return buffer_; }
110 104
111 private: 105 private:
112 ~GbmPixmap() override; 106 ~GbmPixmap() override;
113 scoped_refptr<ScanoutBuffer> ProcessBuffer(const gfx::Size& size, 107 scoped_refptr<ScanoutBuffer> ProcessBuffer(const gfx::Size& size,
114 uint32_t format); 108 uint32_t format);
115 109
116 GbmSurfaceFactory* surface_manager_; 110 GbmSurfaceFactory* surface_manager_;
117 scoped_refptr<GbmBuffer> buffer_; 111 scoped_refptr<GbmBuffer> buffer_;
118 112
119 // OverlayValidator can request scaling or format conversions as needed for 113 // OverlayValidator can request scaling or format conversions as needed for
120 // this Pixmap. This holds the processed buffer. 114 // this Pixmap. This holds the processed buffer.
121 scoped_refptr<GbmPixmap> processed_pixmap_; 115 scoped_refptr<GbmPixmap> processed_pixmap_;
122 ProcessingCallback processing_callback_; 116 ProcessingCallback processing_callback_;
123 117
124 DISALLOW_COPY_AND_ASSIGN(GbmPixmap); 118 DISALLOW_COPY_AND_ASSIGN(GbmPixmap);
125 }; 119 };
126 120
127 } // namespace ui 121 } // namespace ui
128 122
129 #endif // UI_OZONE_PLATFORM_DRM_GPU_GBM_BUFFER_H_ 123 #endif // UI_OZONE_PLATFORM_DRM_GPU_GBM_BUFFER_H_
OLDNEW
« no previous file with comments | « ui/gfx/linux/native_pixmap_dmabuf.cc ('k') | ui/ozone/platform/drm/gpu/gbm_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698