OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chromeos/display/output_configurator.h" | 5 #include "chromeos/display/output_configurator.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include <X11/Xatom.h> | 9 #include <X11/Xatom.h> |
10 #include <X11/Xlib.h> | 10 #include <X11/Xlib.h> |
(...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1134 ConfigureCTM(display, outputs[0].touch_device_id, ctm); | 1134 ConfigureCTM(display, outputs[0].touch_device_id, ctm); |
1135 } | 1135 } |
1136 break; | 1136 break; |
1137 } | 1137 } |
1138 case 2: { | 1138 case 2: { |
1139 RRCrtc primary_crtc = | 1139 RRCrtc primary_crtc = |
1140 GetNextCrtcAfter(display, screen, outputs[0].output, None); | 1140 GetNextCrtcAfter(display, screen, outputs[0].output, None); |
1141 RRCrtc secondary_crtc = | 1141 RRCrtc secondary_crtc = |
1142 GetNextCrtcAfter(display, screen, outputs[1].output, primary_crtc); | 1142 GetNextCrtcAfter(display, screen, outputs[1].output, primary_crtc); |
1143 | 1143 |
1144 // Workaround for crbug.com/148365: leave internal display on for | |
1145 // internal-off, external-on so user can move cursor (and hence | |
1146 // windows) onto internal display even when it's off. | |
oshima
2013/03/25 22:20:40
I'm probably missing something but it sounds to me
Daniel Erat
2013/03/26 03:19:15
Yes, I was confused by this too. The old code see
| |
1147 bool primary_power_on = power_state == DISPLAY_POWER_ALL_ON || | 1144 bool primary_power_on = power_state == DISPLAY_POWER_ALL_ON || |
1145 (power_state == DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON && | |
1146 !outputs[0].is_internal) || | |
1148 (power_state == DISPLAY_POWER_INTERNAL_ON_EXTERNAL_OFF && | 1147 (power_state == DISPLAY_POWER_INTERNAL_ON_EXTERNAL_OFF && |
1149 outputs[0].is_internal); | 1148 outputs[0].is_internal); |
1150 bool secondary_power_on = power_state == DISPLAY_POWER_ALL_ON || | 1149 bool secondary_power_on = power_state == DISPLAY_POWER_ALL_ON || |
1150 (power_state == DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON && | |
1151 !outputs[1].is_internal) || | |
1151 (power_state == DISPLAY_POWER_INTERNAL_ON_EXTERNAL_OFF && | 1152 (power_state == DISPLAY_POWER_INTERNAL_ON_EXTERNAL_OFF && |
1152 outputs[1].is_internal); | 1153 outputs[1].is_internal); |
1153 | 1154 |
1154 if (output_state == STATE_DUAL_MIRROR) { | 1155 if (output_state == STATE_DUAL_MIRROR) { |
1155 XRRModeInfo* mode_info = ModeInfoForID(screen, outputs[0].mirror_mode); | 1156 XRRModeInfo* mode_info = ModeInfoForID(screen, outputs[0].mirror_mode); |
1156 if (mode_info == NULL) { | 1157 if (mode_info == NULL) { |
1157 UMA_HISTOGRAM_COUNTS("Display.EnterState.mirror_failures", 1); | 1158 UMA_HISTOGRAM_COUNTS("Display.EnterState.mirror_failures", 1); |
1158 return false; | 1159 return false; |
1159 } | 1160 } |
1160 | 1161 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1196 | 1197 |
1197 int primary_height = primary_mode_info->height; | 1198 int primary_height = primary_mode_info->height; |
1198 int secondary_height = secondary_mode_info->height; | 1199 int secondary_height = secondary_mode_info->height; |
1199 CrtcConfig config1(primary_crtc, 0, 0, | 1200 CrtcConfig config1(primary_crtc, 0, 0, |
1200 primary_power_on ? outputs[0].native_mode : None, | 1201 primary_power_on ? outputs[0].native_mode : None, |
1201 outputs[0].output); | 1202 outputs[0].output); |
1202 CrtcConfig config2(secondary_crtc, 0, 0, | 1203 CrtcConfig config2(secondary_crtc, 0, 0, |
1203 secondary_power_on ? outputs[1].native_mode : None, | 1204 secondary_power_on ? outputs[1].native_mode : None, |
1204 outputs[1].output); | 1205 outputs[1].output); |
1205 | 1206 |
1206 if (output_state == STATE_DUAL_EXTENDED) | 1207 if (output_state == STATE_DUAL_EXTENDED) { |
oshima
2013/03/25 22:20:40
If we have two displays and not mirrored, it must
Daniel Erat
2013/03/26 03:19:15
Yeah, I think the only other state is one represen
| |
1207 config2.y = primary_height + kVerticalGap; | 1208 if (primary_power_on) |
1208 else | 1209 config2.y = primary_height + kVerticalGap; |
1209 config1.y = secondary_height + kVerticalGap; | 1210 } else { |
1211 if (secondary_power_on) | |
1212 config1.y = secondary_height + kVerticalGap; | |
1213 } | |
1210 | 1214 |
1211 int width = std::max<int>( | 1215 int width = std::max<int>( |
1212 primary_mode_info->width, secondary_mode_info->width); | 1216 primary_mode_info->width, secondary_mode_info->width); |
1213 int height = primary_height + secondary_height + kVerticalGap; | 1217 int height = primary_height + secondary_height + kVerticalGap; |
1214 | 1218 |
1219 if (primary_power_on && !secondary_power_on) { | |
1220 width = primary_mode_info->width; | |
1221 height = primary_height; | |
1222 } else if (!primary_power_on && secondary_power_on) { | |
1223 width = secondary_mode_info->width; | |
1224 height = secondary_height; | |
1225 } | |
1226 | |
1215 CreateFrameBuffer(display, screen, window, width, height, &config1, | 1227 CreateFrameBuffer(display, screen, window, width, height, &config1, |
1216 &config2); | 1228 &config2); |
1217 | 1229 |
1218 ConfigureCrtc(display, screen, &config1); | 1230 ConfigureCrtc(display, screen, &config1); |
1219 ConfigureCrtc(display, screen, &config2); | 1231 ConfigureCrtc(display, screen, &config2); |
1220 | 1232 |
1221 if (outputs[0].touch_device_id != None) { | 1233 if (outputs[0].touch_device_id != None) { |
1222 CoordinateTransformation ctm; | 1234 CoordinateTransformation ctm; |
1223 ctm.x_scale = static_cast<float>(primary_mode_info->width) / width; | 1235 ctm.x_scale = static_cast<float>(primary_mode_info->width) / width; |
1224 ctm.x_offset = static_cast<float>(config1.x) / width; | 1236 ctm.x_offset = static_cast<float>(config1.x) / width; |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1332 // static | 1344 // static |
1333 RRMode OutputConfigurator::GetOutputNativeMode( | 1345 RRMode OutputConfigurator::GetOutputNativeMode( |
1334 const XRROutputInfo* output_info) { | 1346 const XRROutputInfo* output_info) { |
1335 if (output_info->nmode <= 0) | 1347 if (output_info->nmode <= 0) |
1336 return None; | 1348 return None; |
1337 | 1349 |
1338 return output_info->modes[0]; | 1350 return output_info->modes[0]; |
1339 } | 1351 } |
1340 | 1352 |
1341 } // namespace chromeos | 1353 } // namespace chromeos |
OLD | NEW |