Index: chromeos/display/output_configurator.cc |
diff --git a/chromeos/display/output_configurator.cc b/chromeos/display/output_configurator.cc |
index 67da273b64965469c0b9d252e2e64e3c8ab16158..b6ba2d62516bf6a867e1400edf2b3196d0ca803e 100644 |
--- a/chromeos/display/output_configurator.cc |
+++ b/chromeos/display/output_configurator.cc |
@@ -945,18 +945,42 @@ bool OutputConfigurator::EnterState( |
delegate_->CreateFrameBuffer(width, height, updated_outputs); |
for (size_t i = 0; i < updated_outputs.size(); ++i) { |
const OutputSnapshot& output = updated_outputs[i]; |
- if (delegate_->ConfigureCrtc(output.crtc, output.current_mode, |
- output.output, output.x, output.y)) { |
- if (output.touch_device_id) |
- delegate_->ConfigureCTM(output.touch_device_id, output.transform); |
- cached_outputs_[i] = updated_outputs[i]; |
- } else { |
+ while (!delegate_->ConfigureCrtc(output.crtc, output.current_mode, |
+ output.output, output.x, output.y)) { |
LOG(WARNING) << "Unable to configure CRTC " << output.crtc << ":" |
<< " mode=" << output.current_mode |
<< " output=" << output.output |
<< " x=" << output.x |
<< " y=" << output.y; |
+ |
+ int best_mode_pixels = 0; |
Daniel Erat
2014/01/06 17:15:29
nit: add a comment before this line summarizing wh
dsodman
2014/01/08 20:55:36
Done.
|
+ const ModeInfo mode_info = |
+ output.mode_infos.find(output.current_mode)->second; |
Daniel Erat
2014/01/06 17:15:29
nit: do this instead?
const ModeInfo* mode_info
dsodman
2014/01/08 20:55:36
Done.
|
+ int current_mode_pixels = mode_info.width * mode_info.height; |
+ for (ModeInfoMap::const_iterator it = output.mode_infos.begin(); |
+ it != output.mode_infos.end(); it++) { |
+ int pixel_count = it->second.width * it->second.height; |
+ if ((pixel_count < current_mode_pixels) && |
+ (pixel_count > best_mode_pixels)) { |
+ updated_outputs[i].current_mode = it->first; |
+ best_mode_pixels = current_mode_pixels; |
Daniel Erat
2014/01/06 17:15:29
shouldn't this be:
best_mode_pixels = pixel_cou
dsodman
2014/01/08 20:55:36
Thanks for catching this. You are right. I also
|
+ } |
+ } |
+ |
+ if (best_mode_pixels == 0) |
+ break; |
} |
+ |
+ // if we are trying to set mirror mode and one of the modeset's fails, |
Daniel Erat
2014/01/06 17:15:29
nit: s/if/If/
dsodman
2014/01/08 20:55:36
Done.
|
+ // then the two monitors will be mis-matched. In this case, return |
+ // false to let the observer's be aware |
Daniel Erat
2014/01/06 17:15:29
nit: s/observer's/observers/, also add trailing pe
dsodman
2014/01/08 20:55:36
Done.
|
+ if (output_state == STATE_DUAL_MIRROR) |
Daniel Erat
2014/01/06 17:15:29
style guide requires curly brackets on the outermo
dsodman
2014/01/08 20:55:36
Done.
|
+ if (output_power[i] && output.current_mode != output.mirror_mode) |
+ return false; |
Daniel Erat
2014/01/06 17:15:29
shouldn't you only return after you've finished it
dsodman
2014/01/08 20:55:36
Done.
|
+ |
+ if (output.touch_device_id) |
+ delegate_->ConfigureCTM(output.touch_device_id, output.transform); |
Daniel Erat
2014/01/06 17:15:29
shouldn't this come before the previous return sta
|
+ cached_outputs_[i] = updated_outputs[i]; |
Daniel Erat
2014/01/06 17:15:29
i think that this also needs to happen before the
dsodman
2014/01/08 20:55:36
Done.
|
} |
} |