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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 mode.vdisplay); | 102 mode.vdisplay); |
103 HardwareDisplayControllers::iterator it = FindDisplayController(crtc); | 103 HardwareDisplayControllers::iterator it = FindDisplayController(crtc); |
104 DCHECK(controllers_.end() != it) << "Display controller (crtc=" << crtc | 104 DCHECK(controllers_.end() != it) << "Display controller (crtc=" << crtc |
105 << ") doesn't exist."; | 105 << ") doesn't exist."; |
106 | 106 |
107 HardwareDisplayController* controller = *it; | 107 HardwareDisplayController* controller = *it; |
108 controller = *it; | 108 controller = *it; |
109 // If nothing changed just enable the controller. Note, we perform an exact | 109 // If nothing changed just enable the controller. Note, we perform an exact |
110 // comparison on the mode since the refresh rate may have changed. | 110 // comparison on the mode since the refresh rate may have changed. |
111 if (SameMode(mode, controller->get_mode()) && | 111 if (SameMode(mode, controller->get_mode()) && |
112 origin == controller->origin() && !controller->IsDisabled()) | 112 origin == controller->origin()) { |
| 113 if (controller->IsDisabled()) { |
| 114 HardwareDisplayControllers::iterator mirror = |
| 115 FindActiveDisplayControllerByLocation(modeset_bounds); |
| 116 // If there is an active controller at the same location then start mirror |
| 117 // mode. |
| 118 if (mirror != controllers_.end()) |
| 119 return HandleMirrorMode(it, mirror, crtc, connector); |
| 120 } |
| 121 |
| 122 // Just re-enable the controller to re-use the current state. |
113 return controller->Enable(); | 123 return controller->Enable(); |
| 124 } |
114 | 125 |
115 // Either the mode or the location of the display changed, so exit mirror | 126 // Either the mode or the location of the display changed, so exit mirror |
116 // mode and configure the display independently. If the caller still wants | 127 // mode and configure the display independently. If the caller still wants |
117 // mirror mode, subsequent calls configuring the other controllers will | 128 // mirror mode, subsequent calls configuring the other controllers will |
118 // restore mirror mode. | 129 // restore mirror mode. |
119 if (controller->IsMirrored()) { | 130 if (controller->IsMirrored()) { |
120 controller = new HardwareDisplayController(controller->RemoveCrtc(crtc)); | 131 controller = new HardwareDisplayController(controller->RemoveCrtc(crtc)); |
121 controllers_.push_back(controller); | 132 controllers_.push_back(controller); |
122 it = controllers_.end() - 1; | 133 it = controllers_.end() - 1; |
123 } | 134 } |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 | 262 |
252 // When things go wrong revert back to the previous configuration since | 263 // When things go wrong revert back to the previous configuration since |
253 // it is expected that the configuration would not have changed if | 264 // it is expected that the configuration would not have changed if |
254 // things fail. | 265 // things fail. |
255 (*original)->AddCrtc((*mirror)->RemoveCrtc(crtc)); | 266 (*original)->AddCrtc((*mirror)->RemoveCrtc(crtc)); |
256 (*original)->Enable(); | 267 (*original)->Enable(); |
257 return false; | 268 return false; |
258 } | 269 } |
259 | 270 |
260 } // namespace ui | 271 } // namespace ui |
OLD | NEW |