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 #include "ui/ozone/platform/drm/gpu/hardware_display_controller.h" | 5 #include "ui/ozone/platform/drm/gpu/hardware_display_controller.h" |
6 | 6 |
7 #include <drm.h> | 7 #include <drm.h> |
8 #include <string.h> | 8 #include <string.h> |
9 #include <xf86drm.h> | 9 #include <xf86drm.h> |
10 #include <utility> | 10 #include <utility> |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 uint32_t z_order) const { | 138 uint32_t z_order) const { |
139 for (size_t i = 0; i < crtc_controllers_.size(); ++i) { | 139 for (size_t i = 0; i < crtc_controllers_.size(); ++i) { |
140 // Make sure all displays have overlay to support this format. | 140 // Make sure all displays have overlay to support this format. |
141 if (!crtc_controllers_[i]->IsFormatSupported(fourcc_format, z_order)) | 141 if (!crtc_controllers_[i]->IsFormatSupported(fourcc_format, z_order)) |
142 return false; | 142 return false; |
143 } | 143 } |
144 | 144 |
145 return true; | 145 return true; |
146 } | 146 } |
147 | 147 |
| 148 std::vector<uint64_t> HardwareDisplayController::GetFormatModifiers( |
| 149 uint32_t format) { |
| 150 std::vector<uint64_t> modifiers; |
| 151 |
| 152 if (crtc_controllers_.empty()) |
| 153 return modifiers; |
| 154 |
| 155 modifiers = crtc_controllers_[0]->GetFormatModifiers(format); |
| 156 |
| 157 for (size_t i = 1; i < crtc_controllers_.size(); ++i) { |
| 158 std::vector<uint64_t> other = |
| 159 crtc_controllers_[i]->GetFormatModifiers(format); |
| 160 std::vector<uint64_t> intersection; |
| 161 |
| 162 std::set_intersection(modifiers.begin(), modifiers.end(), other.begin(), |
| 163 other.end(), std::back_inserter(intersection)); |
| 164 modifiers = std::move(intersection); |
| 165 } |
| 166 |
| 167 return modifiers; |
| 168 } |
| 169 |
148 bool HardwareDisplayController::SetCursor( | 170 bool HardwareDisplayController::SetCursor( |
149 const scoped_refptr<ScanoutBuffer>& buffer) { | 171 const scoped_refptr<ScanoutBuffer>& buffer) { |
150 bool status = true; | 172 bool status = true; |
151 | 173 |
152 if (is_disabled_) | 174 if (is_disabled_) |
153 return true; | 175 return true; |
154 | 176 |
155 for (const auto& controller : crtc_controllers_) | 177 for (const auto& controller : crtc_controllers_) |
156 status &= controller->SetCursor(buffer); | 178 status &= controller->SetCursor(buffer); |
157 | 179 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 | 293 |
272 scoped_refptr<DrmDevice> HardwareDisplayController::GetAllocationDrmDevice() | 294 scoped_refptr<DrmDevice> HardwareDisplayController::GetAllocationDrmDevice() |
273 const { | 295 const { |
274 DCHECK(!crtc_controllers_.empty()); | 296 DCHECK(!crtc_controllers_.empty()); |
275 // TODO(dnicoara) When we support mirroring across DRM devices, figure out | 297 // TODO(dnicoara) When we support mirroring across DRM devices, figure out |
276 // which device should be used for allocations. | 298 // which device should be used for allocations. |
277 return crtc_controllers_[0]->drm(); | 299 return crtc_controllers_[0]->drm(); |
278 } | 300 } |
279 | 301 |
280 } // namespace ui | 302 } // namespace ui |
OLD | NEW |