| 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 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 void EmptyFlipCallback(gfx::SwapResult) {} | 28 void EmptyFlipCallback(gfx::SwapResult) {} |
| 29 | 29 |
| 30 } // namespace | 30 } // namespace |
| 31 | 31 |
| 32 HardwareDisplayController::HardwareDisplayController( | 32 HardwareDisplayController::HardwareDisplayController( |
| 33 scoped_ptr<CrtcController> controller, | 33 scoped_ptr<CrtcController> controller, |
| 34 const gfx::Point& origin) | 34 const gfx::Point& origin) |
| 35 : origin_(origin), | 35 : origin_(origin), |
| 36 is_disabled_(controller->is_disabled()) { | 36 is_disabled_(controller->is_disabled()) { |
| 37 AddCrtc(controller.Pass()); | 37 AddCrtc(std::move(controller)); |
| 38 } | 38 } |
| 39 | 39 |
| 40 HardwareDisplayController::~HardwareDisplayController() { | 40 HardwareDisplayController::~HardwareDisplayController() { |
| 41 // Reset the cursor. | 41 // Reset the cursor. |
| 42 UnsetCursor(); | 42 UnsetCursor(); |
| 43 } | 43 } |
| 44 | 44 |
| 45 bool HardwareDisplayController::Modeset(const OverlayPlane& primary, | 45 bool HardwareDisplayController::Modeset(const OverlayPlane& primary, |
| 46 drmModeModeInfo mode) { | 46 drmModeModeInfo mode) { |
| 47 TRACE_EVENT0("drm", "HDC::Modeset"); | 47 TRACE_EVENT0("drm", "HDC::Modeset"); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 const std::vector<scoped_ptr<HardwareDisplayPlane>>& all_planes = | 194 const std::vector<scoped_ptr<HardwareDisplayPlane>>& all_planes = |
| 195 drm->plane_manager()->planes(); | 195 drm->plane_manager()->planes(); |
| 196 HardwareDisplayPlaneList* crtc_plane_list = | 196 HardwareDisplayPlaneList* crtc_plane_list = |
| 197 owned_hardware_planes_.get(drm.get()); | 197 owned_hardware_planes_.get(drm.get()); |
| 198 uint32_t crtc = controller->crtc(); | 198 uint32_t crtc = controller->crtc(); |
| 199 for (const auto& plane : all_planes) { | 199 for (const auto& plane : all_planes) { |
| 200 if (plane->in_use() && (plane->owning_crtc() == crtc)) | 200 if (plane->in_use() && (plane->owning_crtc() == crtc)) |
| 201 crtc_plane_list->old_plane_list.push_back(plane.get()); | 201 crtc_plane_list->old_plane_list.push_back(plane.get()); |
| 202 } | 202 } |
| 203 | 203 |
| 204 crtc_controllers_.push_back(controller.Pass()); | 204 crtc_controllers_.push_back(std::move(controller)); |
| 205 } | 205 } |
| 206 | 206 |
| 207 scoped_ptr<CrtcController> HardwareDisplayController::RemoveCrtc( | 207 scoped_ptr<CrtcController> HardwareDisplayController::RemoveCrtc( |
| 208 const scoped_refptr<DrmDevice>& drm, | 208 const scoped_refptr<DrmDevice>& drm, |
| 209 uint32_t crtc) { | 209 uint32_t crtc) { |
| 210 for (auto it = crtc_controllers_.begin(); it != crtc_controllers_.end(); | 210 for (auto it = crtc_controllers_.begin(); it != crtc_controllers_.end(); |
| 211 ++it) { | 211 ++it) { |
| 212 if ((*it)->drm() == drm && (*it)->crtc() == crtc) { | 212 if ((*it)->drm() == drm && (*it)->crtc() == crtc) { |
| 213 scoped_ptr<CrtcController> controller(std::move(*it)); | 213 scoped_ptr<CrtcController> controller(std::move(*it)); |
| 214 crtc_controllers_.erase(it); | 214 crtc_controllers_.erase(it); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 228 owned_hardware_planes_.get(drm.get()); | 228 owned_hardware_planes_.get(drm.get()); |
| 229 all_planes.swap(plane_list->old_plane_list); | 229 all_planes.swap(plane_list->old_plane_list); |
| 230 for (auto* plane : all_planes) { | 230 for (auto* plane : all_planes) { |
| 231 if (plane->owning_crtc() != crtc) | 231 if (plane->owning_crtc() != crtc) |
| 232 plane_list->old_plane_list.push_back(plane); | 232 plane_list->old_plane_list.push_back(plane); |
| 233 } | 233 } |
| 234 } else { | 234 } else { |
| 235 owned_hardware_planes_.erase(controller->drm().get()); | 235 owned_hardware_planes_.erase(controller->drm().get()); |
| 236 } | 236 } |
| 237 | 237 |
| 238 return controller.Pass(); | 238 return controller; |
| 239 } | 239 } |
| 240 } | 240 } |
| 241 | 241 |
| 242 return nullptr; | 242 return nullptr; |
| 243 } | 243 } |
| 244 | 244 |
| 245 bool HardwareDisplayController::HasCrtc(const scoped_refptr<DrmDevice>& drm, | 245 bool HardwareDisplayController::HasCrtc(const scoped_refptr<DrmDevice>& drm, |
| 246 uint32_t crtc) const { | 246 uint32_t crtc) const { |
| 247 for (const auto& controller : crtc_controllers_) { | 247 for (const auto& controller : crtc_controllers_) { |
| 248 if (controller->drm() == drm && controller->crtc() == crtc) | 248 if (controller->drm() == drm && controller->crtc() == crtc) |
| (...skipping 29 matching lines...) Expand all Loading... |
| 278 | 278 |
| 279 scoped_refptr<DrmDevice> HardwareDisplayController::GetAllocationDrmDevice() | 279 scoped_refptr<DrmDevice> HardwareDisplayController::GetAllocationDrmDevice() |
| 280 const { | 280 const { |
| 281 DCHECK(!crtc_controllers_.empty()); | 281 DCHECK(!crtc_controllers_.empty()); |
| 282 // TODO(dnicoara) When we support mirroring across DRM devices, figure out | 282 // TODO(dnicoara) When we support mirroring across DRM devices, figure out |
| 283 // which device should be used for allocations. | 283 // which device should be used for allocations. |
| 284 return crtc_controllers_[0]->drm(); | 284 return crtc_controllers_[0]->drm(); |
| 285 } | 285 } |
| 286 | 286 |
| 287 } // namespace ui | 287 } // namespace ui |
| OLD | NEW |