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