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 "third_party/skia/include/core/SkCanvas.h" | 9 #include "third_party/skia/include/core/SkCanvas.h" |
10 #include "ui/gfx/geometry/point.h" | 10 #include "ui/gfx/geometry/point.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 origin == controller->origin()) { | 114 origin == controller->origin()) { |
115 if (controller->IsDisabled()) { | 115 if (controller->IsDisabled()) { |
116 HardwareDisplayControllers::iterator mirror = | 116 HardwareDisplayControllers::iterator mirror = |
117 FindActiveDisplayControllerByLocation(modeset_bounds); | 117 FindActiveDisplayControllerByLocation(modeset_bounds); |
118 // If there is an active controller at the same location then start mirror | 118 // If there is an active controller at the same location then start mirror |
119 // mode. | 119 // mode. |
120 if (mirror != controllers_.end()) | 120 if (mirror != controllers_.end()) |
121 return HandleMirrorMode(it, mirror, crtc, connector); | 121 return HandleMirrorMode(it, mirror, crtc, connector); |
122 } | 122 } |
123 | 123 |
| 124 // Just re-enable the controller to re-use the current state. |
| 125 bool enabled = controller->Enable(); |
124 FOR_EACH_OBSERVER(DisplayChangeObserver, observers_, | 126 FOR_EACH_OBSERVER(DisplayChangeObserver, observers_, |
125 OnDisplayChanged(controller)); | 127 OnDisplayChanged(controller)); |
126 // Just re-enable the controller to re-use the current state. | 128 |
127 return controller->Enable(); | 129 return enabled; |
128 } | 130 } |
129 | 131 |
130 // Either the mode or the location of the display changed, so exit mirror | 132 // Either the mode or the location of the display changed, so exit mirror |
131 // mode and configure the display independently. If the caller still wants | 133 // mode and configure the display independently. If the caller still wants |
132 // mirror mode, subsequent calls configuring the other controllers will | 134 // mirror mode, subsequent calls configuring the other controllers will |
133 // restore mirror mode. | 135 // restore mirror mode. |
134 if (controller->IsMirrored()) { | 136 if (controller->IsMirrored()) { |
135 controller = new HardwareDisplayController(controller->RemoveCrtc(crtc)); | 137 controller = new HardwareDisplayController(controller->RemoveCrtc(crtc)); |
136 controllers_.push_back(controller); | 138 controllers_.push_back(controller); |
137 it = controllers_.end() - 1; | 139 it = controllers_.end() - 1; |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 | 282 |
281 // When things go wrong revert back to the previous configuration since | 283 // When things go wrong revert back to the previous configuration since |
282 // it is expected that the configuration would not have changed if | 284 // it is expected that the configuration would not have changed if |
283 // things fail. | 285 // things fail. |
284 (*original)->AddCrtc((*mirror)->RemoveCrtc(crtc)); | 286 (*original)->AddCrtc((*mirror)->RemoveCrtc(crtc)); |
285 (*original)->Enable(); | 287 (*original)->Enable(); |
286 return false; | 288 return false; |
287 } | 289 } |
288 | 290 |
289 } // namespace ui | 291 } // namespace ui |
OLD | NEW |