Chromium Code Reviews| Index: ui/ozone/platform/drm/gpu/hardware_display_controller.cc |
| diff --git a/ui/ozone/platform/drm/gpu/hardware_display_controller.cc b/ui/ozone/platform/drm/gpu/hardware_display_controller.cc |
| index 5ee481931ff3c6f6626260e922775ba847cb378a..aba01cd963b18f420b05a397d9e5c622bb6b60bc 100644 |
| --- a/ui/ozone/platform/drm/gpu/hardware_display_controller.cc |
| +++ b/ui/ozone/platform/drm/gpu/hardware_display_controller.cc |
| @@ -42,8 +42,22 @@ bool HardwareDisplayController::Modeset(const OverlayPlane& primary, |
| TRACE_EVENT0("drm", "HDC::Modeset"); |
| DCHECK(primary.buffer.get()); |
| bool status = true; |
| - for (size_t i = 0; i < crtc_controllers_.size(); ++i) |
| - status &= crtc_controllers_[i]->Modeset(primary, mode); |
| + |
| + scoped_refptr<DrmDevice> drm = GetAllocationDrmDevice(); |
| + HardwareDisplayPlaneList* plane_list = owned_hardware_planes_.get(drm.get()); |
| + // CRTC controllers owned by this HDC might have changed, refresh the list. |
|
dnicoara
2015/08/18 17:07:52
Since the RemoveCrtc() all updates the list for th
kalyank
2015/08/18 23:15:40
Done.
|
| + plane_list->old_plane_list.clear(); |
| + |
| + HardwareDisplayPlaneManager* manager = drm->plane_manager(); |
| + const ScopedVector<HardwareDisplayPlane>& all_planes = manager->planes(); |
| + for (auto* controller : crtc_controllers_) { |
| + status &= controller->Modeset(primary, mode); |
| + uint32_t crtc = controller->crtc(); |
| + for (auto* plane : all_planes) { |
| + if (plane->in_use() && (plane->owning_crtc() == crtc)) |
| + plane_list->old_plane_list.push_back(plane); |
| + } |
| + } |
| is_disabled_ = false; |
| mode_ = mode; |
| @@ -163,8 +177,18 @@ scoped_ptr<CrtcController> HardwareDisplayController::RemoveCrtc( |
| break; |
| } |
| } |
| - if (!found) |
| + if (found) { |
| + std::vector<HardwareDisplayPlane*> all_planes; |
| + HardwareDisplayPlaneList* plane_list = |
| + owned_hardware_planes_.get(drm.get()); |
| + all_planes.swap(plane_list->old_plane_list); |
| + for (auto* plane : all_planes) { |
| + if (plane->owning_crtc() != crtc) |
| + plane_list->old_plane_list.push_back(plane); |
| + } |
| + } else { |
| owned_hardware_planes_.erase(controller->drm().get()); |
| + } |
| return controller.Pass(); |
| } |