| 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 bool status = true; | 195 bool status = true; |
| 196 for (const auto& controller : crtc_controllers_) | 196 for (const auto& controller : crtc_controllers_) |
| 197 status &= controller->MoveCursor(location); | 197 status &= controller->MoveCursor(location); |
| 198 | 198 |
| 199 return status; | 199 return status; |
| 200 } | 200 } |
| 201 | 201 |
| 202 void HardwareDisplayController::AddCrtc( | 202 void HardwareDisplayController::AddCrtc( |
| 203 std::unique_ptr<CrtcController> controller) { | 203 std::unique_ptr<CrtcController> controller) { |
| 204 scoped_refptr<DrmDevice> drm = controller->drm(); | 204 scoped_refptr<DrmDevice> drm = controller->drm(); |
| 205 owned_hardware_planes_[drm.get()] = | 205 |
| 206 base::MakeUnique<HardwareDisplayPlaneList>(); | 206 std::unique_ptr<HardwareDisplayPlaneList>& owned_planes = |
| 207 owned_hardware_planes_[drm.get()]; |
| 208 if (!owned_planes) |
| 209 owned_planes.reset(new HardwareDisplayPlaneList()); |
| 207 | 210 |
| 208 // Check if this controller owns any planes and ensure we keep track of them. | 211 // Check if this controller owns any planes and ensure we keep track of them. |
| 209 const std::vector<std::unique_ptr<HardwareDisplayPlane>>& all_planes = | 212 const std::vector<std::unique_ptr<HardwareDisplayPlane>>& all_planes = |
| 210 drm->plane_manager()->planes(); | 213 drm->plane_manager()->planes(); |
| 211 HardwareDisplayPlaneList* crtc_plane_list = | 214 HardwareDisplayPlaneList* crtc_plane_list = owned_planes.get(); |
| 212 owned_hardware_planes_[drm.get()].get(); | |
| 213 uint32_t crtc = controller->crtc(); | 215 uint32_t crtc = controller->crtc(); |
| 214 for (const auto& plane : all_planes) { | 216 for (const auto& plane : all_planes) { |
| 215 if (plane->in_use() && (plane->owning_crtc() == crtc)) | 217 if (plane->in_use() && (plane->owning_crtc() == crtc)) |
| 216 crtc_plane_list->old_plane_list.push_back(plane.get()); | 218 crtc_plane_list->old_plane_list.push_back(plane.get()); |
| 217 } | 219 } |
| 218 | 220 |
| 219 crtc_controllers_.push_back(std::move(controller)); | 221 crtc_controllers_.push_back(std::move(controller)); |
| 220 } | 222 } |
| 221 | 223 |
| 222 std::unique_ptr<CrtcController> HardwareDisplayController::RemoveCrtc( | 224 std::unique_ptr<CrtcController> HardwareDisplayController::RemoveCrtc( |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 | 295 |
| 294 scoped_refptr<DrmDevice> HardwareDisplayController::GetAllocationDrmDevice() | 296 scoped_refptr<DrmDevice> HardwareDisplayController::GetAllocationDrmDevice() |
| 295 const { | 297 const { |
| 296 DCHECK(!crtc_controllers_.empty()); | 298 DCHECK(!crtc_controllers_.empty()); |
| 297 // TODO(dnicoara) When we support mirroring across DRM devices, figure out | 299 // TODO(dnicoara) When we support mirroring across DRM devices, figure out |
| 298 // which device should be used for allocations. | 300 // which device should be used for allocations. |
| 299 return crtc_controllers_[0]->drm(); | 301 return crtc_controllers_[0]->drm(); |
| 300 } | 302 } |
| 301 | 303 |
| 302 } // namespace ui | 304 } // namespace ui |
| OLD | NEW |