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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 248 to_populate->height = 0; | 248 to_populate->height = 0; |
| 249 to_populate->y = 0; | 249 to_populate->y = 0; |
| 250 } | 250 } |
| 251 // Find the native_mode and leave the mirror_mode for the pass after the | 251 // Find the native_mode and leave the mirror_mode for the pass after the |
| 252 // loop. | 252 // loop. |
| 253 if (output_info->nmode > 0) | 253 if (output_info->nmode > 0) |
| 254 to_populate->native_mode = output_info->modes[0]; | 254 to_populate->native_mode = output_info->modes[0]; |
| 255 to_populate->mirror_mode = 0; | 255 to_populate->mirror_mode = 0; |
| 256 | 256 |
| 257 // See if this output refers to an internal display. | 257 // See if this output refers to an internal display. |
| 258 const std::string name(output_info->name); | |
| 258 to_populate->is_internal = | 259 to_populate->is_internal = |
| 259 OutputConfigurator::IsInternalOutputName( | 260 name.find(kInternal_LVDS) == 0 || name.find(kInternal_eDP) == 0; |
|
Josh Horwich
2012/09/25 00:25:35
nit: Should we add a TODO(oshima) comment here to
oshima
2012/09/25 01:43:18
Done.
| |
| 260 std::string(output_info->name)); | |
| 261 | 261 |
| 262 VLOG(1) << "Found display #" << found_count | 262 VLOG(1) << "Found display #" << found_count |
| 263 << " with output " << (int)to_populate->output | 263 << " with output " << (int)to_populate->output |
| 264 << " crtc " << (int)to_populate->crtc | 264 << " crtc " << (int)to_populate->crtc |
| 265 << " current mode " << (int)to_populate->current_mode; | 265 << " current mode " << (int)to_populate->current_mode; |
| 266 ++found_count; | 266 ++found_count; |
| 267 } else { | 267 } else { |
| 268 XRRFreeOutputInfo(output_info); | 268 XRRFreeOutputInfo(output_info); |
| 269 } | 269 } |
| 270 } | 270 } |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 368 state = STATE_HEADLESS; | 368 state = STATE_HEADLESS; |
| 369 break; | 369 break; |
| 370 case 1: | 370 case 1: |
| 371 state = STATE_SINGLE; | 371 state = STATE_SINGLE; |
| 372 break; | 372 break; |
| 373 case 2: { | 373 case 2: { |
| 374 bool mirror_supported = (0 != outputs[0].mirror_mode) && | 374 bool mirror_supported = (0 != outputs[0].mirror_mode) && |
| 375 (0 != outputs[1].mirror_mode); | 375 (0 != outputs[1].mirror_mode); |
| 376 switch (current_state) { | 376 switch (current_state) { |
| 377 case STATE_DUAL_PRIMARY_ONLY: | 377 case STATE_DUAL_PRIMARY_ONLY: |
| 378 state = | 378 // TODO(oshima): Temporarily disable extended |
| 379 mirror_supported ? STATE_DUAL_MIRROR : STATE_DUAL_PRIMARY_ONLY; | 379 // desktop. crbug.com/152003. |
| 380 state = STATE_DUAL_SECONDARY_ONLY; | |
| 381 break; | |
| 382 case STATE_DUAL_SECONDARY_ONLY: | |
| 383 state = mirror_supported ? | |
| 384 STATE_DUAL_MIRROR : STATE_DUAL_PRIMARY_ONLY; | |
| 380 break; | 385 break; |
| 381 case STATE_DUAL_MIRROR: | 386 case STATE_DUAL_MIRROR: |
| 382 state = STATE_DUAL_PRIMARY_ONLY; | 387 state = STATE_DUAL_PRIMARY_ONLY; |
| 383 break; | 388 break; |
| 384 default: | 389 default: |
| 385 // Unknown so just request something safe. | 390 // Unknown so just request something safe. |
| 386 state = STATE_DUAL_PRIMARY_ONLY; | 391 state = STATE_DUAL_PRIMARY_ONLY; |
| 387 } | 392 } |
| 388 break; | 393 break; |
| 389 } | 394 } |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 827 void OutputConfigurator::AddObserver(Observer* observer) { | 832 void OutputConfigurator::AddObserver(Observer* observer) { |
| 828 observers_.AddObserver(observer); | 833 observers_.AddObserver(observer); |
| 829 } | 834 } |
| 830 | 835 |
| 831 void OutputConfigurator::RemoveObserver(Observer* observer) { | 836 void OutputConfigurator::RemoveObserver(Observer* observer) { |
| 832 observers_.RemoveObserver(observer); | 837 observers_.RemoveObserver(observer); |
| 833 } | 838 } |
| 834 | 839 |
| 835 // static | 840 // static |
| 836 bool OutputConfigurator::IsInternalOutputName(const std::string& name) { | 841 bool OutputConfigurator::IsInternalOutputName(const std::string& name) { |
| 837 return name.find(kInternal_LVDS) == 0 || name.find(kInternal_eDP) == 0; | 842 // TODO(oshima): There is only one display for m23 and no need to |
| 843 // distinguish internal display. | |
| 844 return false; | |
| 838 } | 845 } |
| 839 | 846 |
| 840 void OutputConfigurator::NotifyOnDisplayChanged() { | 847 void OutputConfigurator::NotifyOnDisplayChanged() { |
| 841 notification_timer_.reset(); | 848 notification_timer_.reset(); |
| 842 FOR_EACH_OBSERVER(Observer, observers_, OnDisplayModeChanged()); | 849 FOR_EACH_OBSERVER(Observer, observers_, OnDisplayModeChanged()); |
| 843 } | 850 } |
| 844 | 851 |
| 845 } // namespace chromeos | 852 } // namespace chromeos |
| OLD | NEW |