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

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

Issue 2705213005: Add NativePixmapDmabufStub to finalize glCreateImageCHROMIUM on Linux. (Closed)
Patch Set: Forgot friend class base::RefCountedThreadSafe 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
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 17 matching lines...) Expand all
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 uint64_t GetFormatModifier(size_t plane) const; 51 uint64_t GetFormatModifier(size_t plane) const;
52
53 // GbmBufferBase
52 gfx::Size GetSize() const override; 54 gfx::Size GetSize() const override;
53 55
56 scoped_refptr<gfx::NativePixmapDmabufHelper> helper() { return helper_; }
57
54 private: 58 private:
55 GbmBuffer(const scoped_refptr<GbmDevice>& gbm, 59 GbmBuffer(const scoped_refptr<GbmDevice>& gbm,
56 gbm_bo* bo, 60 gbm_bo* bo,
57 uint32_t format, 61 uint32_t format,
58 uint32_t flags, 62 uint32_t flags,
59 uint64_t modifier, 63 uint64_t modifier,
60 uint32_t addfb_flags, 64 uint32_t addfb_flags,
61 std::vector<base::ScopedFD>&& fds, 65 std::vector<base::ScopedFD>&& fds,
62 const gfx::Size& size, 66 const gfx::Size& size,
63 const std::vector<gfx::NativePixmapPlane>&& planes); 67 const std::vector<gfx::NativePixmapPlane>&& planes);
64 ~GbmBuffer() override; 68 ~GbmBuffer() override;
65 69
66 static scoped_refptr<GbmBuffer> CreateBufferForBO( 70 static scoped_refptr<GbmBuffer> CreateBufferForBO(
67 const scoped_refptr<GbmDevice>& gbm, 71 const scoped_refptr<GbmDevice>& gbm,
68 gbm_bo* bo, 72 gbm_bo* bo,
69 uint32_t format, 73 uint32_t format,
70 const gfx::Size& size, 74 const gfx::Size& size,
71 uint32_t flags, 75 uint32_t flags,
72 uint64_t modifiers, 76 uint64_t modifiers,
73 uint32_t addfb_flags); 77 uint32_t addfb_flags);
74 78
75 uint32_t format_; 79 uint32_t format_;
76 uint32_t flags_; 80 uint32_t flags_;
77 std::vector<base::ScopedFD> fds_;
78 gfx::Size size_; 81 gfx::Size size_;
79 82
80 std::vector<gfx::NativePixmapPlane> planes_; 83 scoped_refptr<gfx::NativePixmapDmabufHelper> helper_;
81 84
82 DISALLOW_COPY_AND_ASSIGN(GbmBuffer); 85 DISALLOW_COPY_AND_ASSIGN(GbmBuffer);
83 }; 86 };
84 87
85 class GbmPixmap : public gfx::NativePixmap { 88 class GbmPixmap : public gfx::NativePixmapDmaBuf {
86 public: 89 public:
87 GbmPixmap(GbmSurfaceFactory* surface_manager, 90 GbmPixmap(GbmSurfaceFactory* surface_manager,
88 const scoped_refptr<GbmBuffer>& buffer); 91 const scoped_refptr<GbmBuffer>& buffer);
89 92
90 void SetProcessingCallback( 93 // NativePixmapDmabuf
91 const ProcessingCallback& processing_callback) override;
92
93 // NativePixmap:
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, 94 bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget,
104 int plane_z_order, 95 int plane_z_order,
105 gfx::OverlayTransform plane_transform, 96 gfx::OverlayTransform plane_transform,
106 const gfx::Rect& display_bounds, 97 const gfx::Rect& display_bounds,
107 const gfx::RectF& crop_rect) override; 98 const gfx::RectF& crop_rect) override;
99 void SetProcessingCallback(
100 const ProcessingCallback& processing_callback) override;
108 gfx::NativePixmapHandle ExportHandle() override; 101 gfx::NativePixmapHandle ExportHandle() override;
109 102
110 scoped_refptr<GbmBuffer> buffer() { return buffer_; } 103 scoped_refptr<GbmBuffer> buffer() { return buffer_; }
111 104
112 private: 105 private:
113 ~GbmPixmap() override; 106 ~GbmPixmap() override;
114 scoped_refptr<ScanoutBuffer> ProcessBuffer(const gfx::Size& size, 107 scoped_refptr<ScanoutBuffer> ProcessBuffer(const gfx::Size& size,
115 uint32_t format); 108 uint32_t format);
116 109
117 GbmSurfaceFactory* surface_manager_; 110 GbmSurfaceFactory* surface_manager_;
118 scoped_refptr<GbmBuffer> buffer_; 111 scoped_refptr<GbmBuffer> buffer_;
119 112
120 // OverlayValidator can request scaling or format conversions as needed for 113 // OverlayValidator can request scaling or format conversions as needed for
121 // this Pixmap. This holds the processed buffer. 114 // this Pixmap. This holds the processed buffer.
122 scoped_refptr<GbmPixmap> processed_pixmap_; 115 scoped_refptr<GbmPixmap> processed_pixmap_;
123 ProcessingCallback processing_callback_; 116 ProcessingCallback processing_callback_;
124 117
125 DISALLOW_COPY_AND_ASSIGN(GbmPixmap); 118 DISALLOW_COPY_AND_ASSIGN(GbmPixmap);
126 }; 119 };
127 120
128 } // namespace ui 121 } // namespace ui
129 122
130 #endif // UI_OZONE_PLATFORM_DRM_GPU_GBM_BUFFER_H_ 123 #endif // UI_OZONE_PLATFORM_DRM_GPU_GBM_BUFFER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698