Chromium Code Reviews| 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/drm_gpu_display_manager.h" | 5 #include "ui/ozone/platform/drm/gpu/drm_gpu_display_manager.h" |
| 6 | 6 |
| 7 #include "ui/display/types/gamma_ramp_rgb_entry.h" | 7 #include "ui/display/types/gamma_ramp_rgb_entry.h" |
| 8 #include "ui/ozone/common/display_util.h" | 8 #include "ui/ozone/common/display_util.h" |
| 9 #include "ui/ozone/platform/drm/common/drm_util.h" | 9 #include "ui/ozone/platform/drm/common/drm_util.h" |
| 10 #include "ui/ozone/platform/drm/gpu/drm_device.h" | 10 #include "ui/ozone/platform/drm/gpu/drm_device.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 77 ScopedVector<DrmDisplay> old_displays(displays_.Pass()); | 77 ScopedVector<DrmDisplay> old_displays(displays_.Pass()); |
| 78 std::vector<DisplaySnapshot_Params> params_list; | 78 std::vector<DisplaySnapshot_Params> params_list; |
| 79 | 79 |
| 80 const DrmDeviceVector& devices = drm_device_manager_->GetDrmDevices(); | 80 const DrmDeviceVector& devices = drm_device_manager_->GetDrmDevices(); |
| 81 // Unique identifier used to create the display id. | 81 // Unique identifier used to create the display id. |
| 82 size_t index = 0; | 82 size_t index = 0; |
| 83 for (const auto& drm : devices) { | 83 for (const auto& drm : devices) { |
| 84 ScopedVector<HardwareDisplayControllerInfo> display_infos = | 84 ScopedVector<HardwareDisplayControllerInfo> display_infos = |
| 85 GetAvailableDisplayControllerInfos(drm->get_fd()); | 85 GetAvailableDisplayControllerInfos(drm->get_fd()); |
| 86 for (auto* display_info : display_infos) { | 86 for (auto* display_info : display_infos) { |
| 87 DisplaySnapshot_Params params = | 87 auto it = std::find_if( |
| 88 CreateDisplaySnapshotParams(display_info, drm->get_fd(), index++); | 88 old_displays.begin(), old_displays.end(), |
|
spang
2015/05/13 19:01:20
I'm not a fan of this.
Can you update displays_ f
dnicoara
2015/05/13 19:10:36
Hmm, it is simpler to create the std::vector<Displ
| |
| 89 DisplayComparator(drm, display_info->crtc()->crtc_id, | |
| 90 display_info->connector()->connector_id)); | |
| 91 gfx::Point origin; | |
| 92 // Because each display has its own surface, display layout isn't tracked | |
| 93 // at the DRM level. We must keep track of the display origins otherwise | |
| 94 // we'll lose the layout information. | |
| 95 if (it != old_displays.end()) | |
| 96 origin = (*it)->origin(); | |
| 97 | |
| 98 DisplaySnapshot_Params params = CreateDisplaySnapshotParams( | |
| 99 display_info, drm->get_fd(), index++, origin); | |
| 89 params_list.push_back(params); | 100 params_list.push_back(params); |
| 90 | 101 |
| 91 displays_.push_back( | 102 displays_.push_back( |
| 92 new DrmDisplay(screen_manager_, params.display_id, drm, | 103 new DrmDisplay(screen_manager_, params.display_id, drm, |
| 93 display_info->crtc()->crtc_id, | 104 display_info->crtc()->crtc_id, |
| 94 display_info->connector()->connector_id, | 105 display_info->connector()->connector_id, |
| 95 GetDrmModeVector(display_info->connector()))); | 106 GetDrmModeVector(display_info->connector()), origin)); |
| 96 } | 107 } |
| 97 } | 108 } |
| 98 | 109 |
| 99 NotifyScreenManager(displays_.get(), old_displays.get()); | 110 NotifyScreenManager(displays_.get(), old_displays.get()); |
| 100 return params_list; | 111 return params_list; |
| 101 } | 112 } |
| 102 | 113 |
| 103 bool DrmGpuDisplayManager::TakeDisplayControl() { | 114 bool DrmGpuDisplayManager::TakeDisplayControl() { |
| 104 const DrmDeviceVector& devices = drm_device_manager_->GetDrmDevices(); | 115 const DrmDeviceVector& devices = drm_device_manager_->GetDrmDevices(); |
| 105 for (const auto& drm : devices) { | 116 for (const auto& drm : devices) { |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 229 | 240 |
| 230 if (it == old_displays.end()) { | 241 if (it == old_displays.end()) { |
| 231 screen_manager_->AddDisplayController(new_displays[i]->drm(), | 242 screen_manager_->AddDisplayController(new_displays[i]->drm(), |
| 232 new_displays[i]->crtc(), | 243 new_displays[i]->crtc(), |
| 233 new_displays[i]->connector()); | 244 new_displays[i]->connector()); |
| 234 } | 245 } |
| 235 } | 246 } |
| 236 } | 247 } |
| 237 | 248 |
| 238 } // namespace ui | 249 } // namespace ui |
| OLD | NEW |