Chromium Code Reviews| 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 <X11/Xlib.h> | 7 #include <X11/Xlib.h> |
| 8 #include <X11/extensions/dpms.h> | 8 #include <X11/extensions/dpms.h> |
| 9 #include <X11/extensions/Xrandr.h> | 9 #include <X11/extensions/Xrandr.h> |
| 10 | 10 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 114 two_index += 1; | 114 two_index += 1; |
| 115 } | 115 } |
| 116 } | 116 } |
| 117 } | 117 } |
| 118 } | 118 } |
| 119 XRRFreeOutputInfo(primary); | 119 XRRFreeOutputInfo(primary); |
| 120 XRRFreeOutputInfo(secondary); | 120 XRRFreeOutputInfo(secondary); |
| 121 return found; | 121 return found; |
| 122 } | 122 } |
| 123 | 123 |
| 124 // Should be called if the internal (built-in) output didn't advertise a mode | |
| 125 // which would be capable to support mirror mode. | |
| 126 // Relies on hardware panel fitting support, | |
| 127 // should not be called if it is not available. | |
| 128 // Tries to add the native mode of the external output to the internal output, | |
| 129 // assuming panel fitter hardware will take care of scaling and letterboxing. | |
| 130 // The RROutput IDs |out_one| and |out_two| are used to look up the modes and | |
| 131 // configure the internal output, | |
| 132 // |out_one_mode| and |out_two_mode| are the out-parameters for the modes | |
| 133 // on the two outputs which will have same resolution. | |
| 134 // Returns false if it fails to configure the internal output appropriately. | |
| 135 static bool AddMirrorModeToInternalOutput(Display* display, | |
| 136 XRRScreenResources* screen, | |
| 137 RROutput out_one, | |
|
cwolfe
2012/09/18 13:27:47
Would prefer output_* for these names. I initially
ynovikov
2012/09/21 18:48:27
Done.
| |
| 138 RROutput out_two, | |
| 139 RRMode* out_one_mode, | |
| 140 RRMode* out_two_mode) { | |
| 141 XRROutputInfo* out_one_info = XRRGetOutputInfo(display, screen, out_one); | |
| 142 XRROutputInfo* out_two_info = XRRGetOutputInfo(display, screen, out_two); | |
| 143 bool success = false; | |
| 144 | |
| 145 // Both outputs should be connected in mirror mode | |
| 146 if (out_one_info->connection == RR_Connected && | |
| 147 out_two_info->connection == RR_Connected) { | |
| 148 bool one_is_internal = OutputConfigurator::IsInternalOutputName( | |
|
cwolfe
2012/09/18 13:27:47
Make this a member of OutputConfigurator to shorte
ynovikov
2012/09/18 15:16:21
I like the idea of IsInternalOutput(output_one_inf
oshima
2012/09/18 21:11:31
Fine with me.
ynovikov
2012/09/21 18:48:27
Done.
| |
| 149 std::string(out_one_info->name)); | |
| 150 bool two_is_internal = OutputConfigurator::IsInternalOutputName( | |
| 151 std::string(out_two_info->name)); | |
| 152 | |
| 153 XRROutputInfo* internal_info = NULL; | |
| 154 XRROutputInfo* external_info = NULL; | |
| 155 | |
| 156 bool there_is_one_internal_output = true; | |
|
cwolfe
2012/09/18 13:27:47
found_internal_output with a comment that it will
ynovikov
2012/09/18 15:16:21
I think your suggestion will make the code more ob
cwolfe
2012/09/18 20:55:50
Fair enough. I was first going to suggest a bool f
ynovikov
2012/09/21 18:48:27
Done.
| |
| 157 | |
| 158 // Make sure exactly one of the outputs is internal | |
|
cwolfe
2012/09/18 13:27:47
Since it would simplify this, I suggest we ignore
oshima
2012/09/18 14:31:11
with some log message in case it indeed detects tw
ynovikov
2012/09/18 15:16:21
I agree with Oshima that two-internal-outputs case
cwolfe
2012/09/18 20:55:50
To (possibly) clarify, I was leaning toward "if th
oshima
2012/09/18 21:11:31
I don't think we have to support two internal disp
ynovikov
2012/09/21 18:48:27
Done.
| |
| 159 if (one_is_internal && !two_is_internal) { | |
| 160 internal_info = out_one_info; | |
| 161 external_info = out_two_info; | |
| 162 } else if (!one_is_internal && two_is_internal) { | |
| 163 internal_info = out_two_info; | |
| 164 external_info = out_one_info; | |
| 165 } else { | |
| 166 there_is_one_internal_output = false; | |
| 167 } | |
| 168 | |
| 169 if (there_is_one_internal_output) { | |
| 170 RRMode internal_ideal_mode_id = | |
| 171 OutputConfigurator::GetOutputNativeMode(internal_info); | |
| 172 RRMode external_ideal_mode_id = | |
| 173 OutputConfigurator::GetOutputNativeMode(external_info); | |
| 174 | |
| 175 if (internal_ideal_mode_id != None && external_ideal_mode_id != None) { | |
| 176 XRRModeInfo* internal_ideal_mode = | |
| 177 ModeInfoForID(screen, internal_ideal_mode_id); | |
| 178 XRRModeInfo* external_ideal_mode = | |
| 179 ModeInfoForID(screen, external_ideal_mode_id); | |
| 180 | |
| 181 // Panel fitting will not work if the internal output maximal resolution | |
| 182 // is lower than that of the external output | |
| 183 if (internal_ideal_mode->width >= external_ideal_mode->width && | |
| 184 internal_ideal_mode->height >= external_ideal_mode->height) { | |
| 185 XRRAddOutputMode(display, one_is_internal ? out_one : out_two, | |
| 186 external_ideal_mode_id); | |
| 187 | |
| 188 *out_one_mode = *out_two_mode = external_ideal_mode_id; | |
|
cwolfe
2012/09/18 13:27:47
Merge those parameters?
ynovikov
2012/09/18 15:16:21
Their identity is implementation dependent, if in
cwolfe
2012/09/18 20:55:50
Fair enough.
On 2012/09/18 15:16:21, ynovikov wro
ynovikov
2012/09/21 18:48:27
Done.
| |
| 189 success = true; | |
| 190 } | |
| 191 } | |
| 192 } | |
| 193 } | |
| 194 | |
| 195 XRRFreeOutputInfo(out_one_info); | |
| 196 XRRFreeOutputInfo(out_two_info); | |
| 197 | |
| 198 return success; | |
| 199 } | |
| 200 | |
| 124 // A helper to call XRRSetCrtcConfig with the given options but some of our | 201 // A helper to call XRRSetCrtcConfig with the given options but some of our |
| 125 // default output count and rotation arguments. | 202 // default output count and rotation arguments. |
| 126 static void ConfigureCrtc(Display* display, | 203 static void ConfigureCrtc(Display* display, |
| 127 XRRScreenResources* screen, | 204 XRRScreenResources* screen, |
| 128 RRCrtc crtc, | 205 RRCrtc crtc, |
| 129 int x, | 206 int x, |
| 130 int y, | 207 int y, |
| 131 RRMode mode, | 208 RRMode mode, |
| 132 RROutput output) { | 209 RROutput output) { |
| 133 VLOG(1) << "ConfigureCrtc crtc: " << crtc | 210 VLOG(1) << "ConfigureCrtc crtc: " << crtc |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 201 int height; | 278 int height; |
| 202 int y; | 279 int y; |
| 203 RRMode native_mode; | 280 RRMode native_mode; |
| 204 RRMode mirror_mode; | 281 RRMode mirror_mode; |
| 205 bool is_internal; | 282 bool is_internal; |
| 206 } OutputSnapshot; | 283 } OutputSnapshot; |
| 207 | 284 |
| 208 static int GetDualOutputs(Display* display, | 285 static int GetDualOutputs(Display* display, |
| 209 XRRScreenResources* screen, | 286 XRRScreenResources* screen, |
| 210 OutputSnapshot* one, | 287 OutputSnapshot* one, |
| 211 OutputSnapshot* two) { | 288 OutputSnapshot* two, |
| 289 bool is_panel_fitting_supported) { | |
|
cwolfe
2012/09/18 13:27:47
Would it be clearer to make these functions member
ynovikov
2012/09/18 15:16:21
Perhaps it would, I am not sure why these function
ynovikov
2012/09/21 18:48:27
Done.
| |
| 212 int found_count = 0; | 290 int found_count = 0; |
| 213 XRROutputInfo* one_info = NULL; | 291 XRROutputInfo* one_info = NULL; |
| 214 XRROutputInfo* two_info = NULL; | 292 XRROutputInfo* two_info = NULL; |
| 215 | 293 |
| 216 for (int i = 0; (i < screen->noutput) && (found_count < 2); ++i) { | 294 for (int i = 0; (i < screen->noutput) && (found_count < 2); ++i) { |
| 217 RROutput this_id = screen->outputs[i]; | 295 RROutput this_id = screen->outputs[i]; |
| 218 XRROutputInfo* output_info = XRRGetOutputInfo(display, screen, this_id); | 296 XRROutputInfo* output_info = XRRGetOutputInfo(display, screen, this_id); |
| 219 bool is_connected = (RR_Connected == output_info->connection); | 297 bool is_connected = (RR_Connected == output_info->connection); |
| 220 | 298 |
| 221 if (is_connected) { | 299 if (is_connected) { |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 239 to_populate->height = crtc_info->height; | 317 to_populate->height = crtc_info->height; |
| 240 to_populate->y = crtc_info->y; | 318 to_populate->y = crtc_info->y; |
| 241 XRRFreeCrtcInfo(crtc_info); | 319 XRRFreeCrtcInfo(crtc_info); |
| 242 } else { | 320 } else { |
| 243 to_populate->current_mode = 0; | 321 to_populate->current_mode = 0; |
| 244 to_populate->height = 0; | 322 to_populate->height = 0; |
| 245 to_populate->y = 0; | 323 to_populate->y = 0; |
| 246 } | 324 } |
| 247 // Find the native_mode and leave the mirror_mode for the pass after the | 325 // Find the native_mode and leave the mirror_mode for the pass after the |
| 248 // loop. | 326 // loop. |
| 249 if (output_info->nmode > 0) | 327 to_populate->native_mode = |
| 250 to_populate->native_mode = output_info->modes[0]; | 328 OutputConfigurator::GetOutputNativeMode(output_info); |
| 251 to_populate->mirror_mode = 0; | 329 to_populate->mirror_mode = 0; |
| 252 | 330 |
| 253 // See if this output refers to an internal display. | 331 // See if this output refers to an internal display. |
| 254 to_populate->is_internal = | 332 to_populate->is_internal = |
| 255 OutputConfigurator::IsInternalOutputName( | 333 OutputConfigurator::IsInternalOutputName( |
| 256 std::string(output_info->name)); | 334 std::string(output_info->name)); |
| 257 | 335 |
| 258 VLOG(1) << "Found display #" << found_count | 336 VLOG(1) << "Found display #" << found_count |
| 259 << " with output " << (int)to_populate->output | 337 << " with output " << (int)to_populate->output |
| 260 << " crtc " << (int)to_populate->crtc | 338 << " crtc " << (int)to_populate->crtc |
| 261 << " current mode " << (int)to_populate->current_mode; | 339 << " current mode " << (int)to_populate->current_mode; |
| 262 ++found_count; | 340 ++found_count; |
| 263 } else { | 341 } else { |
| 264 XRRFreeOutputInfo(output_info); | 342 XRRFreeOutputInfo(output_info); |
| 265 } | 343 } |
| 266 } | 344 } |
| 267 | 345 |
| 268 if (2 == found_count) { | 346 if (2 == found_count) { |
| 269 // Find the mirror modes (if there are any). | 347 // Find the mirror modes (if there are any). |
| 270 bool can_mirror = FindMirrorModeForOutputs(display, | 348 bool can_mirror = FindMirrorModeForOutputs(display, |
| 271 screen, | 349 screen, |
| 272 one->output, | 350 one->output, |
| 273 two->output, | 351 two->output, |
| 274 &one->mirror_mode, | 352 &one->mirror_mode, |
| 275 &two->mirror_mode); | 353 &two->mirror_mode); |
| 276 if (!can_mirror) { | 354 if (!can_mirror) { |
| 277 // We can't mirror so set mirror_mode to 0. | 355 bool can_add_mirror_mode = false; |
| 278 one->mirror_mode = 0; | 356 if (is_panel_fitting_supported) { |
| 279 two->mirror_mode = 0; | 357 can_add_mirror_mode = |
|
cwolfe
2012/09/18 13:27:47
added_mirror_mode?
ynovikov
2012/09/18 15:16:21
Sounds good to me, how about mirror_mode_found for
cwolfe
2012/09/18 20:55:50
SGTM
On 2012/09/18 15:16:21, ynovikov wrote:
ynovikov
2012/09/21 18:48:27
Done.
| |
| 358 AddMirrorModeToInternalOutput(display, screen, | |
| 359 one->output, two->output, &one->mirror_mode, &two->mirror_mode); | |
| 360 } | |
| 361 if (!can_add_mirror_mode) { | |
| 362 // We can't mirror so set mirror_mode to 0. | |
| 363 one->mirror_mode = 0; | |
| 364 two->mirror_mode = 0; | |
| 365 } | |
| 280 } | 366 } |
| 281 } | 367 } |
| 282 | 368 |
| 283 XRRFreeOutputInfo(one_info); | 369 XRRFreeOutputInfo(one_info); |
| 284 XRRFreeOutputInfo(two_info); | 370 XRRFreeOutputInfo(two_info); |
| 285 return found_count; | 371 return found_count; |
| 286 } | 372 } |
| 287 | 373 |
| 288 static OutputState InferCurrentState(Display* display, | 374 static OutputState InferCurrentState(Display* display, |
| 289 XRRScreenResources* screen, | 375 XRRScreenResources* screen, |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 555 | 641 |
| 556 // "Projecting" is defined as having more than 1 output connected while at | 642 // "Projecting" is defined as having more than 1 output connected while at |
| 557 // least one of them is an internal output. | 643 // least one of them is an internal output. |
| 558 return has_internal_output && (connected_output_count > 1); | 644 return has_internal_output && (connected_output_count > 1); |
| 559 } | 645 } |
| 560 | 646 |
| 561 } // namespace | 647 } // namespace |
| 562 | 648 |
| 563 OutputConfigurator::OutputConfigurator() | 649 OutputConfigurator::OutputConfigurator() |
| 564 : is_running_on_chrome_os_(base::chromeos::IsRunningOnChromeOS()), | 650 : is_running_on_chrome_os_(base::chromeos::IsRunningOnChromeOS()), |
| 651 is_panel_fitting_supported_(false), | |
| 652 connected_output_count_(0), | |
| 565 xrandr_event_base_(0), | 653 xrandr_event_base_(0), |
| 566 output_state_(STATE_INVALID) { | 654 output_state_(STATE_INVALID) { |
| 655 } | |
| 656 | |
| 657 void OutputConfigurator::Init(bool is_panel_fitting_supported) { | |
| 567 if (!is_running_on_chrome_os_) | 658 if (!is_running_on_chrome_os_) |
| 568 return; | 659 return; |
| 569 | 660 |
| 661 is_panel_fitting_supported_ = is_panel_fitting_supported; | |
| 662 | |
| 570 // Cache the initial output state. | 663 // Cache the initial output state. |
| 571 Display* display = base::MessagePumpAuraX11::GetDefaultXDisplay(); | 664 Display* display = base::MessagePumpAuraX11::GetDefaultXDisplay(); |
| 572 CHECK(display != NULL); | 665 CHECK(display != NULL); |
| 573 XGrabServer(display); | 666 XGrabServer(display); |
| 574 Window window = DefaultRootWindow(display); | 667 Window window = DefaultRootWindow(display); |
| 575 XRRScreenResources* screen = GetScreenResourcesAndRecordUMA(display, window); | 668 XRRScreenResources* screen = GetScreenResourcesAndRecordUMA(display, window); |
| 576 CHECK(screen != NULL); | 669 CHECK(screen != NULL); |
| 577 | 670 |
| 578 // Detect our initial state. | 671 // Detect our initial state. |
| 579 OutputSnapshot outputs[2] = { {0}, {0} }; | 672 OutputSnapshot outputs[2] = { {0}, {0} }; |
| 580 connected_output_count_ = | 673 connected_output_count_ = |
| 581 GetDualOutputs(display, screen, &outputs[0], &outputs[1]); | 674 GetDualOutputs(display, screen, &outputs[0], &outputs[1], |
|
cwolfe
2012/09/18 13:27:47
Yeah, I'd prefer making GetDualOutputs a non-stati
ynovikov
2012/09/21 18:48:27
Done.
| |
| 675 is_panel_fitting_supported_); | |
| 582 output_state_ = | 676 output_state_ = |
| 583 InferCurrentState(display, screen, outputs, connected_output_count_); | 677 InferCurrentState(display, screen, outputs, connected_output_count_); |
| 584 // Ensure that we are in a supported state with all connected displays powered | 678 // Ensure that we are in a supported state with all connected displays powered |
| 585 // on. | 679 // on. |
| 586 OutputState starting_state = GetNextState(display, | 680 OutputState starting_state = GetNextState(display, |
| 587 screen, | 681 screen, |
| 588 STATE_INVALID, | 682 STATE_INVALID, |
| 589 outputs, | 683 outputs, |
| 590 connected_output_count_); | 684 connected_output_count_); |
| 591 if (output_state_ != starting_state && | 685 if (output_state_ != starting_state && |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 622 bool did_change = false; | 716 bool did_change = false; |
| 623 Display* display = base::MessagePumpAuraX11::GetDefaultXDisplay(); | 717 Display* display = base::MessagePumpAuraX11::GetDefaultXDisplay(); |
| 624 CHECK(display != NULL); | 718 CHECK(display != NULL); |
| 625 XGrabServer(display); | 719 XGrabServer(display); |
| 626 Window window = DefaultRootWindow(display); | 720 Window window = DefaultRootWindow(display); |
| 627 XRRScreenResources* screen = GetScreenResourcesAndRecordUMA(display, window); | 721 XRRScreenResources* screen = GetScreenResourcesAndRecordUMA(display, window); |
| 628 CHECK(screen != NULL); | 722 CHECK(screen != NULL); |
| 629 | 723 |
| 630 OutputSnapshot outputs[2] = { {0}, {0} }; | 724 OutputSnapshot outputs[2] = { {0}, {0} }; |
| 631 connected_output_count_ = | 725 connected_output_count_ = |
| 632 GetDualOutputs(display, screen, &outputs[0], &outputs[1]); | 726 GetDualOutputs(display, screen, &outputs[0], &outputs[1], |
| 727 is_panel_fitting_supported_); | |
| 633 OutputState original = | 728 OutputState original = |
| 634 InferCurrentState(display, screen, outputs, connected_output_count_); | 729 InferCurrentState(display, screen, outputs, connected_output_count_); |
| 635 OutputState next_state = | 730 OutputState next_state = |
| 636 GetNextState(display, screen, original, outputs, connected_output_count_); | 731 GetNextState(display, screen, original, outputs, connected_output_count_); |
| 637 if (original != next_state && | 732 if (original != next_state && |
| 638 EnterState(display, | 733 EnterState(display, |
| 639 screen, | 734 screen, |
| 640 window, | 735 window, |
| 641 next_state, | 736 next_state, |
| 642 outputs, | 737 outputs, |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 662 bool success = false; | 757 bool success = false; |
| 663 Display* display = base::MessagePumpAuraX11::GetDefaultXDisplay(); | 758 Display* display = base::MessagePumpAuraX11::GetDefaultXDisplay(); |
| 664 CHECK(display != NULL); | 759 CHECK(display != NULL); |
| 665 XGrabServer(display); | 760 XGrabServer(display); |
| 666 Window window = DefaultRootWindow(display); | 761 Window window = DefaultRootWindow(display); |
| 667 XRRScreenResources* screen = GetScreenResourcesAndRecordUMA(display, window); | 762 XRRScreenResources* screen = GetScreenResourcesAndRecordUMA(display, window); |
| 668 CHECK(screen != NULL); | 763 CHECK(screen != NULL); |
| 669 | 764 |
| 670 OutputSnapshot outputs[2] = { {0}, {0} }; | 765 OutputSnapshot outputs[2] = { {0}, {0} }; |
| 671 connected_output_count_ = | 766 connected_output_count_ = |
| 672 GetDualOutputs(display, screen, &outputs[0], &outputs[1]); | 767 GetDualOutputs(display, screen, &outputs[0], &outputs[1], |
| 768 is_panel_fitting_supported_); | |
| 673 output_state_ = | 769 output_state_ = |
| 674 InferCurrentState(display, screen, outputs, connected_output_count_); | 770 InferCurrentState(display, screen, outputs, connected_output_count_); |
| 675 | 771 |
| 676 RRCrtc crtc = None; | 772 RRCrtc crtc = None; |
| 677 // Set the CRTCs based on whether we want to turn the power on or off and | 773 // Set the CRTCs based on whether we want to turn the power on or off and |
| 678 // select the outputs to operate on by name or all_displays. | 774 // select the outputs to operate on by name or all_displays. |
| 679 for (int i = 0; i < connected_output_count_; ++i) { | 775 for (int i = 0; i < connected_output_count_; ++i) { |
| 680 if (all_displays || outputs[i].is_internal || power_on) { | 776 if (all_displays || outputs[i].is_internal || power_on) { |
| 681 const int x = 0; | 777 const int x = 0; |
| 682 const int y = outputs[i].y; | 778 const int y = outputs[i].y; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 722 | 818 |
| 723 Display* display = base::MessagePumpAuraX11::GetDefaultXDisplay(); | 819 Display* display = base::MessagePumpAuraX11::GetDefaultXDisplay(); |
| 724 CHECK(display != NULL); | 820 CHECK(display != NULL); |
| 725 XGrabServer(display); | 821 XGrabServer(display); |
| 726 Window window = DefaultRootWindow(display); | 822 Window window = DefaultRootWindow(display); |
| 727 XRRScreenResources* screen = GetScreenResourcesAndRecordUMA(display, window); | 823 XRRScreenResources* screen = GetScreenResourcesAndRecordUMA(display, window); |
| 728 CHECK(screen != NULL); | 824 CHECK(screen != NULL); |
| 729 | 825 |
| 730 OutputSnapshot outputs[2] = { {0}, {0} }; | 826 OutputSnapshot outputs[2] = { {0}, {0} }; |
| 731 connected_output_count_ = | 827 connected_output_count_ = |
| 732 GetDualOutputs(display, screen, &outputs[0], &outputs[1]); | 828 GetDualOutputs(display, screen, &outputs[0], &outputs[1], |
| 829 is_panel_fitting_supported_); | |
| 733 if (EnterState(display, | 830 if (EnterState(display, |
| 734 screen, | 831 screen, |
| 735 window, | 832 window, |
| 736 new_state, | 833 new_state, |
| 737 outputs, | 834 outputs, |
| 738 connected_output_count_)) { | 835 connected_output_count_)) { |
| 739 output_state_ = new_state; | 836 output_state_ = new_state; |
| 740 } | 837 } |
| 741 | 838 |
| 742 XRRFreeScreenResources(screen); | 839 XRRFreeScreenResources(screen); |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 766 Display* display = base::MessagePumpAuraX11::GetDefaultXDisplay(); | 863 Display* display = base::MessagePumpAuraX11::GetDefaultXDisplay(); |
| 767 CHECK(display != NULL); | 864 CHECK(display != NULL); |
| 768 XGrabServer(display); | 865 XGrabServer(display); |
| 769 Window window = DefaultRootWindow(display); | 866 Window window = DefaultRootWindow(display); |
| 770 XRRScreenResources* screen = | 867 XRRScreenResources* screen = |
| 771 GetScreenResourcesAndRecordUMA(display, window); | 868 GetScreenResourcesAndRecordUMA(display, window); |
| 772 CHECK(screen != NULL); | 869 CHECK(screen != NULL); |
| 773 | 870 |
| 774 OutputSnapshot outputs[2] = { {0}, {0} }; | 871 OutputSnapshot outputs[2] = { {0}, {0} }; |
| 775 int new_output_count = | 872 int new_output_count = |
| 776 GetDualOutputs(display, screen, &outputs[0], &outputs[1]); | 873 GetDualOutputs(display, screen, &outputs[0], &outputs[1], |
| 874 is_panel_fitting_supported_); | |
| 777 if (new_output_count != connected_output_count_) { | 875 if (new_output_count != connected_output_count_) { |
| 778 connected_output_count_ = new_output_count; | 876 connected_output_count_ = new_output_count; |
| 779 OutputState new_state = GetNextState(display, | 877 OutputState new_state = GetNextState(display, |
| 780 screen, | 878 screen, |
| 781 STATE_INVALID, | 879 STATE_INVALID, |
| 782 outputs, | 880 outputs, |
| 783 connected_output_count_); | 881 connected_output_count_); |
| 784 if (EnterState(display, | 882 if (EnterState(display, |
| 785 screen, | 883 screen, |
| 786 window, | 884 window, |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 809 | 907 |
| 810 void OutputConfigurator::RemoveObserver(Observer* observer) { | 908 void OutputConfigurator::RemoveObserver(Observer* observer) { |
| 811 observers_.RemoveObserver(observer); | 909 observers_.RemoveObserver(observer); |
| 812 } | 910 } |
| 813 | 911 |
| 814 // static | 912 // static |
| 815 bool OutputConfigurator::IsInternalOutputName(const std::string& name) { | 913 bool OutputConfigurator::IsInternalOutputName(const std::string& name) { |
| 816 return name.find(kInternal_LVDS) == 0 || name.find(kInternal_eDP) == 0; | 914 return name.find(kInternal_LVDS) == 0 || name.find(kInternal_eDP) == 0; |
| 817 } | 915 } |
| 818 | 916 |
| 917 // static | |
| 918 RRMode OutputConfigurator::GetOutputNativeMode( | |
|
cwolfe
2012/09/18 13:27:47
Seems like this should be "GetOutputPreferredMode"
ynovikov
2012/09/18 15:16:21
No, what this function should return is the Native
cwolfe
2012/09/18 20:55:50
I dislike the implication that we know anything ab
ynovikov
2012/09/21 18:48:27
Done.
| |
| 919 const XRROutputInfo* output_info) { | |
| 920 RRMode native_mode = None; | |
| 921 | |
| 922 if (output_info->nmode > 0) { | |
|
cwolfe
2012/09/18 13:27:47
This is one of the places I actually like early re
oshima
2012/09/18 14:31:11
+1 This matches chrome preferred style.
ynovikov
2012/09/21 18:48:27
Done.
| |
| 923 native_mode = output_info->modes[0]; | |
| 924 } | |
| 925 | |
| 926 return native_mode; | |
| 927 } | |
| 928 | |
| 819 void OutputConfigurator::NotifyOnDisplayChanged() { | 929 void OutputConfigurator::NotifyOnDisplayChanged() { |
| 820 FOR_EACH_OBSERVER(Observer, observers_, OnDisplayModeChanged()); | 930 FOR_EACH_OBSERVER(Observer, observers_, OnDisplayModeChanged()); |
| 821 } | 931 } |
| 822 | 932 |
| 823 } // namespace chromeos | 933 } // namespace chromeos |
| OLD | NEW |