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/dri/screen_manager.h" | 5 #include "ui/ozone/platform/dri/screen_manager.h" |
6 | 6 |
7 #include <xf86drmMode.h> | 7 #include <xf86drmMode.h> |
8 | 8 |
9 #include "ui/gfx/geometry/point.h" | 9 #include "ui/gfx/geometry/point.h" |
10 #include "ui/gfx/geometry/rect.h" | 10 #include "ui/gfx/geometry/rect.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 (*it)->RemoveCrtc(crtc); | 49 (*it)->RemoveCrtc(crtc); |
50 if (!is_mirrored) | 50 if (!is_mirrored) |
51 controllers_.erase(it); | 51 controllers_.erase(it); |
52 } | 52 } |
53 } | 53 } |
54 | 54 |
55 bool ScreenManager::ConfigureDisplayController(uint32_t crtc, | 55 bool ScreenManager::ConfigureDisplayController(uint32_t crtc, |
56 uint32_t connector, | 56 uint32_t connector, |
57 const gfx::Point& origin, | 57 const gfx::Point& origin, |
58 const drmModeModeInfo& mode) { | 58 const drmModeModeInfo& mode) { |
59 gfx::Rect modeset_bounds( | 59 gfx::Rect modeset_bounds(origin.x(), origin.y(), mode.hdisplay, |
60 origin.x(), origin.y(), mode.hdisplay, mode.vdisplay); | 60 mode.vdisplay); |
61 HardwareDisplayControllers::iterator it = FindDisplayController(crtc); | 61 HardwareDisplayControllers::iterator it = FindDisplayController(crtc); |
62 DCHECK(controllers_.end() != it) << "Display controller (crtc=" << crtc | 62 DCHECK(controllers_.end() != it) << "Display controller (crtc=" << crtc |
63 << ") doesn't exist."; | 63 << ") doesn't exist."; |
64 | 64 |
65 HardwareDisplayController* controller = *it; | 65 HardwareDisplayController* controller = *it; |
66 controller = *it; | 66 controller = *it; |
67 // If nothing changed just enable the controller. Note, we perform an exact | 67 // If nothing changed just enable the controller. Note, we perform an exact |
68 // comparison on the mode since the refresh rate may have changed. | 68 // comparison on the mode since the refresh rate may have changed. |
69 if (SameMode(mode, controller->get_mode()) && | 69 if (SameMode(mode, controller->get_mode()) && |
70 origin == controller->origin() && !controller->IsDisabled()) | 70 origin == controller->origin() && !controller->IsDisabled()) |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 156 |
157 DCHECK_NE(0u, displays.size()); | 157 DCHECK_NE(0u, displays.size()); |
158 | 158 |
159 ScopedDrmPropertyPtr dpms( | 159 ScopedDrmPropertyPtr dpms( |
160 dri_->GetProperty(displays[0]->connector(), "DPMS")); | 160 dri_->GetProperty(displays[0]->connector(), "DPMS")); |
161 if (dpms) | 161 if (dpms) |
162 dri_->SetProperty(displays[0]->connector()->connector_id, | 162 dri_->SetProperty(displays[0]->connector()->connector_id, |
163 dpms->prop_id, | 163 dpms->prop_id, |
164 DRM_MODE_DPMS_ON); | 164 DRM_MODE_DPMS_ON); |
165 | 165 |
166 AddDisplayController(dri_, | 166 AddDisplayController(dri_, displays[0]->crtc()->crtc_id, |
167 displays[0]->crtc()->crtc_id, | |
168 displays[0]->connector()->connector_id); | 167 displays[0]->connector()->connector_id); |
169 ConfigureDisplayController(displays[0]->crtc()->crtc_id, | 168 ConfigureDisplayController(displays[0]->crtc()->crtc_id, |
170 displays[0]->connector()->connector_id, | 169 displays[0]->connector()->connector_id, |
171 gfx::Point(), | 170 gfx::Point(), |
172 displays[0]->connector()->modes[0]); | 171 displays[0]->connector()->modes[0]); |
173 } | 172 } |
174 | 173 |
175 bool ScreenManager::ModesetDisplayController( | 174 bool ScreenManager::ModesetDisplayController( |
176 HardwareDisplayController* controller, | 175 HardwareDisplayController* controller, |
177 const gfx::Point& origin, | 176 const gfx::Point& origin, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 | 208 |
210 // When things go wrong revert back to the previous configuration since | 209 // When things go wrong revert back to the previous configuration since |
211 // it is expected that the configuration would not have changed if | 210 // it is expected that the configuration would not have changed if |
212 // things fail. | 211 // things fail. |
213 (*original)->AddCrtc((*mirror)->RemoveCrtc(crtc)); | 212 (*original)->AddCrtc((*mirror)->RemoveCrtc(crtc)); |
214 (*original)->Enable(); | 213 (*original)->Enable(); |
215 return false; | 214 return false; |
216 } | 215 } |
217 | 216 |
218 } // namespace ui | 217 } // namespace ui |
OLD | NEW |