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_HARDWARE_DISPLAY_CONTROLLER_H_ | 5 #ifndef UI_OZONE_PLATFORM_DRM_GPU_HARDWARE_DISPLAY_CONTROLLER_H_ |
6 #define UI_OZONE_PLATFORM_DRM_GPU_HARDWARE_DISPLAY_CONTROLLER_H_ | 6 #define UI_OZONE_PLATFORM_DRM_GPU_HARDWARE_DISPLAY_CONTROLLER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 #include <xf86drmMode.h> | 10 #include <xf86drmMode.h> |
| 11 |
11 #include <deque> | 12 #include <deque> |
12 #include <map> | 13 #include <map> |
| 14 #include <memory> |
13 #include <vector> | 15 #include <vector> |
14 | 16 |
15 #include "base/callback.h" | 17 #include "base/callback.h" |
16 #include "base/containers/scoped_ptr_hash_map.h" | 18 #include "base/containers/scoped_ptr_hash_map.h" |
17 #include "base/macros.h" | 19 #include "base/macros.h" |
18 #include "base/memory/scoped_ptr.h" | |
19 #include "base/memory/scoped_vector.h" | 20 #include "base/memory/scoped_vector.h" |
20 #include "ui/gfx/swap_result.h" | 21 #include "ui/gfx/swap_result.h" |
21 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager.h" | 22 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager.h" |
22 #include "ui/ozone/platform/drm/gpu/overlay_plane.h" | 23 #include "ui/ozone/platform/drm/gpu/overlay_plane.h" |
23 | 24 |
24 namespace gfx { | 25 namespace gfx { |
25 class Point; | 26 class Point; |
26 } | 27 } |
27 | 28 |
28 namespace ui { | 29 namespace ui { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 // ---------------------- | 83 // ---------------------- |
83 // | 84 // |
84 // Note that it is possible to have more connectors than CRTCs which means that | 85 // Note that it is possible to have more connectors than CRTCs which means that |
85 // only a subset of connectors can be active independently, showing different | 86 // only a subset of connectors can be active independently, showing different |
86 // framebuffers. Though, in this case, it would be possible to have all | 87 // framebuffers. Though, in this case, it would be possible to have all |
87 // connectors active if some use the same CRTC to mirror the display. | 88 // connectors active if some use the same CRTC to mirror the display. |
88 class HardwareDisplayController { | 89 class HardwareDisplayController { |
89 typedef base::Callback<void(gfx::SwapResult)> PageFlipCallback; | 90 typedef base::Callback<void(gfx::SwapResult)> PageFlipCallback; |
90 | 91 |
91 public: | 92 public: |
92 HardwareDisplayController(scoped_ptr<CrtcController> controller, | 93 HardwareDisplayController(std::unique_ptr<CrtcController> controller, |
93 const gfx::Point& origin); | 94 const gfx::Point& origin); |
94 ~HardwareDisplayController(); | 95 ~HardwareDisplayController(); |
95 | 96 |
96 // Performs the initial CRTC configuration. If successful, it will display the | 97 // Performs the initial CRTC configuration. If successful, it will display the |
97 // framebuffer for |primary| with |mode|. | 98 // framebuffer for |primary| with |mode|. |
98 bool Modeset(const OverlayPlane& primary, drmModeModeInfo mode); | 99 bool Modeset(const OverlayPlane& primary, drmModeModeInfo mode); |
99 | 100 |
100 // Performs a CRTC configuration re-using the modes from the CRTCs. | 101 // Performs a CRTC configuration re-using the modes from the CRTCs. |
101 bool Enable(const OverlayPlane& primary); | 102 bool Enable(const OverlayPlane& primary); |
102 | 103 |
(...skipping 24 matching lines...) Expand all Loading... |
127 bool IsFormatSupported(uint32_t fourcc_format, uint32_t z_order) const; | 128 bool IsFormatSupported(uint32_t fourcc_format, uint32_t z_order) const; |
128 | 129 |
129 // Set the hardware cursor to show the contents of |surface|. | 130 // Set the hardware cursor to show the contents of |surface|. |
130 bool SetCursor(const scoped_refptr<ScanoutBuffer>& buffer); | 131 bool SetCursor(const scoped_refptr<ScanoutBuffer>& buffer); |
131 | 132 |
132 bool UnsetCursor(); | 133 bool UnsetCursor(); |
133 | 134 |
134 // Moves the hardware cursor to |location|. | 135 // Moves the hardware cursor to |location|. |
135 bool MoveCursor(const gfx::Point& location); | 136 bool MoveCursor(const gfx::Point& location); |
136 | 137 |
137 void AddCrtc(scoped_ptr<CrtcController> controller); | 138 void AddCrtc(std::unique_ptr<CrtcController> controller); |
138 scoped_ptr<CrtcController> RemoveCrtc(const scoped_refptr<DrmDevice>& drm, | 139 std::unique_ptr<CrtcController> RemoveCrtc( |
139 uint32_t crtc); | 140 const scoped_refptr<DrmDevice>& drm, |
| 141 uint32_t crtc); |
140 bool HasCrtc(const scoped_refptr<DrmDevice>& drm, uint32_t crtc) const; | 142 bool HasCrtc(const scoped_refptr<DrmDevice>& drm, uint32_t crtc) const; |
141 bool IsMirrored() const; | 143 bool IsMirrored() const; |
142 bool IsDisabled() const; | 144 bool IsDisabled() const; |
143 gfx::Size GetModeSize() const; | 145 gfx::Size GetModeSize() const; |
144 | 146 |
145 gfx::Point origin() const { return origin_; } | 147 gfx::Point origin() const { return origin_; } |
146 void set_origin(const gfx::Point& origin) { origin_ = origin; } | 148 void set_origin(const gfx::Point& origin) { origin_ = origin; } |
147 | 149 |
148 uint64_t GetTimeOfLastFlip() const; | 150 uint64_t GetTimeOfLastFlip() const; |
149 | 151 |
150 const std::vector<scoped_ptr<CrtcController>>& crtc_controllers() const { | 152 const std::vector<std::unique_ptr<CrtcController>>& crtc_controllers() const { |
151 return crtc_controllers_; | 153 return crtc_controllers_; |
152 } | 154 } |
153 | 155 |
154 scoped_refptr<DrmDevice> GetAllocationDrmDevice() const; | 156 scoped_refptr<DrmDevice> GetAllocationDrmDevice() const; |
155 | 157 |
156 private: | 158 private: |
157 bool ActualSchedulePageFlip(const OverlayPlaneList& plane_list, | 159 bool ActualSchedulePageFlip(const OverlayPlaneList& plane_list, |
158 bool test_only, | 160 bool test_only, |
159 const PageFlipCallback& callback); | 161 const PageFlipCallback& callback); |
160 | 162 |
161 base::ScopedPtrHashMap<DrmDevice*, scoped_ptr<HardwareDisplayPlaneList>> | 163 base::ScopedPtrHashMap<DrmDevice*, std::unique_ptr<HardwareDisplayPlaneList>> |
162 owned_hardware_planes_; | 164 owned_hardware_planes_; |
163 | 165 |
164 // Stores the CRTC configuration. This is used to identify monitors and | 166 // Stores the CRTC configuration. This is used to identify monitors and |
165 // configure them. | 167 // configure them. |
166 std::vector<scoped_ptr<CrtcController>> crtc_controllers_; | 168 std::vector<std::unique_ptr<CrtcController>> crtc_controllers_; |
167 | 169 |
168 // Location of the controller on the screen. | 170 // Location of the controller on the screen. |
169 gfx::Point origin_; | 171 gfx::Point origin_; |
170 | 172 |
171 bool is_disabled_; | 173 bool is_disabled_; |
172 | 174 |
173 DISALLOW_COPY_AND_ASSIGN(HardwareDisplayController); | 175 DISALLOW_COPY_AND_ASSIGN(HardwareDisplayController); |
174 }; | 176 }; |
175 | 177 |
176 } // namespace ui | 178 } // namespace ui |
177 | 179 |
178 #endif // UI_OZONE_PLATFORM_DRM_GPU_HARDWARE_DISPLAY_CONTROLLER_H_ | 180 #endif // UI_OZONE_PLATFORM_DRM_GPU_HARDWARE_DISPLAY_CONTROLLER_H_ |
OLD | NEW |