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

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

Issue 2705213005: Add NativePixmapDmabufStub to finalize glCreateImageCHROMIUM on Linux. (Closed)
Patch Set: Go back to previous solution (Patch Set 13) make the helper a parent instead of member 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, public gfx::NativePixmapDmabufHelper {
reveman 2017/06/08 13:40:32 why do we need to inherit this here? can't we just
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 flags); 30 uint32_t flags);
31 static scoped_refptr<GbmBuffer> CreateBufferWithModifiers( 31 static scoped_refptr<GbmBuffer> CreateBufferWithModifiers(
32 const scoped_refptr<GbmDevice>& gbm, 32 const scoped_refptr<GbmDevice>& gbm,
33 uint32_t format, 33 uint32_t format,
34 const gfx::Size& size, 34 const gfx::Size& size,
35 uint32_t flags, 35 uint32_t flags,
36 const std::vector<uint64_t>& modifiers); 36 const std::vector<uint64_t>& modifiers);
37 static scoped_refptr<GbmBuffer> CreateBufferFromFds( 37 static scoped_refptr<GbmBuffer> CreateBufferFromFds(
38 const scoped_refptr<GbmDevice>& gbm, 38 const scoped_refptr<GbmDevice>& gbm,
39 uint32_t format, 39 uint32_t format,
40 const gfx::Size& size, 40 const gfx::Size& size,
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
43 uint32_t GetFormat() const { return format_; } 44 uint32_t GetFormat() const { return format_; }
44 uint32_t GetFlags() const { return flags_; } 45 uint32_t GetFlags() const { return flags_; }
45 bool AreFdsValid() const; 46
46 size_t GetFdCount() const; 47 // GbmBufferBase
47 int GetFd(size_t plane) const;
48 int GetStride(size_t plane) const;
49 int GetOffset(size_t plane) const;
50 size_t GetSize(size_t plane) const;
51 uint64_t GetFormatModifier(size_t plane) const;
52 gfx::Size GetSize() const override; 48 gfx::Size GetSize() const override;
53 49
50 // NativePixmapDmabufHelper
51 size_t GetSize(size_t plane) const override;
52
54 private: 53 private:
55 GbmBuffer(const scoped_refptr<GbmDevice>& gbm, 54 GbmBuffer(const scoped_refptr<GbmDevice>& gbm,
56 gbm_bo* bo, 55 gbm_bo* bo,
57 uint32_t format, 56 uint32_t format,
58 uint32_t flags, 57 uint32_t flags,
59 uint64_t modifier, 58 uint64_t modifier,
60 uint32_t addfb_flags, 59 uint32_t addfb_flags,
61 std::vector<base::ScopedFD>&& fds, 60 std::vector<base::ScopedFD>&& fds,
62 const gfx::Size& size, 61 const gfx::Size& size,
63 const std::vector<gfx::NativePixmapPlane>&& planes); 62 const std::vector<gfx::NativePixmapPlane>&& planes);
64 ~GbmBuffer() override; 63 ~GbmBuffer() override;
65 64
66 static scoped_refptr<GbmBuffer> CreateBufferForBO( 65 static scoped_refptr<GbmBuffer> CreateBufferForBO(
67 const scoped_refptr<GbmDevice>& gbm, 66 const scoped_refptr<GbmDevice>& gbm,
68 gbm_bo* bo, 67 gbm_bo* bo,
69 uint32_t format, 68 uint32_t format,
70 const gfx::Size& size, 69 const gfx::Size& size,
71 uint32_t flags, 70 uint32_t flags,
72 uint64_t modifiers, 71 uint64_t modifiers,
73 uint32_t addfb_flags); 72 uint32_t addfb_flags);
74 73
75 uint32_t format_; 74 uint32_t format_;
76 uint32_t flags_; 75 uint32_t flags_;
77 std::vector<base::ScopedFD> fds_;
78 gfx::Size size_; 76 gfx::Size size_;
79 77
80 std::vector<gfx::NativePixmapPlane> planes_;
81
82 DISALLOW_COPY_AND_ASSIGN(GbmBuffer); 78 DISALLOW_COPY_AND_ASSIGN(GbmBuffer);
83 }; 79 };
84 80
85 class GbmPixmap : public gfx::NativePixmap { 81 class GbmPixmap : public gfx::NativePixmapDmaBuf {
86 public: 82 public:
87 GbmPixmap(GbmSurfaceFactory* surface_manager, 83 GbmPixmap(GbmSurfaceFactory* surface_manager,
88 const scoped_refptr<GbmBuffer>& buffer); 84 const scoped_refptr<GbmBuffer>& buffer);
89 85
90 void SetProcessingCallback( 86 void SetProcessingCallback(
91 const ProcessingCallback& processing_callback) override; 87 const ProcessingCallback& processing_callback) override;
92 88
93 // NativePixmap: 89 // NativePixmapDmabuf
94 void* GetEGLClientBuffer() const override;
95 bool AreDmaBufFdsValid() const override;
96 size_t GetDmaBufFdCount() const override;
97 int GetDmaBufFd(size_t plane) const override;
98 int GetDmaBufPitch(size_t plane) const override;
99 int GetDmaBufOffset(size_t plane) const override;
100 uint64_t GetDmaBufModifier(size_t plane) const override;
101 gfx::BufferFormat GetBufferFormat() const override;
102 gfx::Size GetBufferSize() const override;
103 bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget, 90 bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget,
104 int plane_z_order, 91 int plane_z_order,
105 gfx::OverlayTransform plane_transform, 92 gfx::OverlayTransform plane_transform,
106 const gfx::Rect& display_bounds, 93 const gfx::Rect& display_bounds,
107 const gfx::RectF& crop_rect) override; 94 const gfx::RectF& crop_rect) override;
108 gfx::NativePixmapHandle ExportHandle() override; 95 gfx::NativePixmapHandle ExportHandle() override;
109 96
110 scoped_refptr<GbmBuffer> buffer() { return buffer_; } 97 scoped_refptr<GbmBuffer> buffer() { return buffer_; }
111 98
112 private: 99 private:
113 ~GbmPixmap() override; 100 ~GbmPixmap() override;
114 scoped_refptr<ScanoutBuffer> ProcessBuffer(const gfx::Size& size, 101 scoped_refptr<ScanoutBuffer> ProcessBuffer(const gfx::Size& size,
115 uint32_t format); 102 uint32_t format);
116 103
117 GbmSurfaceFactory* surface_manager_; 104 GbmSurfaceFactory* surface_manager_;
118 scoped_refptr<GbmBuffer> buffer_; 105 scoped_refptr<GbmBuffer> buffer_;
119 106
120 // OverlayValidator can request scaling or format conversions as needed for 107 // OverlayValidator can request scaling or format conversions as needed for
121 // this Pixmap. This holds the processed buffer. 108 // this Pixmap. This holds the processed buffer.
122 scoped_refptr<GbmPixmap> processed_pixmap_; 109 scoped_refptr<GbmPixmap> processed_pixmap_;
123 ProcessingCallback processing_callback_; 110 ProcessingCallback processing_callback_;
124 111
125 DISALLOW_COPY_AND_ASSIGN(GbmPixmap); 112 DISALLOW_COPY_AND_ASSIGN(GbmPixmap);
126 }; 113 };
127 114
128 } // namespace ui 115 } // namespace ui
129 116
130 #endif // UI_OZONE_PLATFORM_DRM_GPU_GBM_BUFFER_H_ 117 #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