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 <cmath> | 7 #include <cmath> |
| 8 #include <cstdarg> | 8 #include <cstdarg> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 93 actions += action; | 93 actions += action; |
| 94 action = va_arg(arg_list, const char*); | 94 action = va_arg(arg_list, const char*); |
| 95 } | 95 } |
| 96 va_end(arg_list); | 96 va_end(arg_list); |
| 97 return actions; | 97 return actions; |
| 98 } | 98 } |
| 99 | 99 |
| 100 class TestDelegate : public OutputConfigurator::Delegate { | 100 class TestDelegate : public OutputConfigurator::Delegate { |
| 101 public: | 101 public: |
| 102 static const int kXRandREventBase = 10; | 102 static const int kXRandREventBase = 10; |
| 103 static const int kMaxTestWidth = 2560; | |
| 104 static const int kMaxTestHeight = 1600; | |
| 103 | 105 |
| 104 TestDelegate() | 106 TestDelegate() |
| 105 : configure_crtc_result_(true), | 107 : max_configurable_pixels_(kMaxTestWidth * kMaxTestHeight), |
|
Daniel Erat
2014/01/06 17:15:29
please make this default to 0 and document that 0
dsodman
2014/01/08 20:55:36
Done.
dsodman
2014/01/08 20:55:36
Done.
| |
| 106 hdcp_state_(HDCP_STATE_UNDESIRED) {} | 108 hdcp_state_(HDCP_STATE_UNDESIRED) {} |
| 107 virtual ~TestDelegate() {} | 109 virtual ~TestDelegate() {} |
| 108 | 110 |
| 109 const std::vector<OutputConfigurator::OutputSnapshot>& outputs() const { | 111 const std::vector<OutputConfigurator::OutputSnapshot>& outputs() const { |
| 110 return outputs_; | 112 return outputs_; |
| 111 } | 113 } |
| 112 void set_outputs( | 114 void set_outputs( |
| 113 const std::vector<OutputConfigurator::OutputSnapshot>& outputs) { | 115 const std::vector<OutputConfigurator::OutputSnapshot>& outputs) { |
| 114 outputs_ = outputs; | 116 outputs_ = outputs; |
| 115 } | 117 } |
| 116 | 118 |
| 117 void set_configure_crtc_result(bool result) { | 119 void set_max_configurable_pixels(long pixels) { |
|
Daniel Erat
2014/01/06 17:15:29
why long? int seems like it should be big enough,
dsodman
2014/01/08 20:55:36
Done.
| |
| 118 configure_crtc_result_ = result; | 120 max_configurable_pixels_ = pixels; |
| 119 } | 121 } |
| 120 | 122 |
| 121 void set_hdcp_state(HDCPState state) { hdcp_state_ = state; } | 123 void set_hdcp_state(HDCPState state) { hdcp_state_ = state; } |
| 122 | 124 |
| 123 // Returns a comma-separated string describing the actions that were | 125 // Returns a comma-separated string describing the actions that were |
| 124 // requested since the previous call to GetActionsAndClear() (i.e. | 126 // requested since the previous call to GetActionsAndClear() (i.e. |
| 125 // results are non-repeatable). | 127 // results are non-repeatable). |
| 126 std::string GetActionsAndClear() { | 128 std::string GetActionsAndClear() { |
| 127 std::string actions = actions_; | 129 std::string actions = actions_; |
| 128 actions_.clear(); | 130 actions_.clear(); |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 147 virtual void SetBackgroundColor(uint32 color_argb) OVERRIDE { | 149 virtual void SetBackgroundColor(uint32 color_argb) OVERRIDE { |
| 148 AppendAction(GetBackgroundAction(color_argb)); | 150 AppendAction(GetBackgroundAction(color_argb)); |
| 149 } | 151 } |
| 150 virtual void ForceDPMSOn() OVERRIDE { AppendAction(kForceDPMS); } | 152 virtual void ForceDPMSOn() OVERRIDE { AppendAction(kForceDPMS); } |
| 151 virtual std::vector<OutputConfigurator::OutputSnapshot> GetOutputs() | 153 virtual std::vector<OutputConfigurator::OutputSnapshot> GetOutputs() |
| 152 OVERRIDE { | 154 OVERRIDE { |
| 153 return outputs_; | 155 return outputs_; |
| 154 } | 156 } |
| 155 virtual void AddOutputMode(RROutput output, RRMode mode) OVERRIDE { | 157 virtual void AddOutputMode(RROutput output, RRMode mode) OVERRIDE { |
| 156 AppendAction(GetAddOutputModeAction(output, mode)); | 158 AppendAction(GetAddOutputModeAction(output, mode)); |
| 159 outputs_[output-1].mode_infos[mode] = OutputConfigurator::ModeInfo( | |
|
Daniel Erat
2014/01/06 17:15:29
please don't add an undocumented assumption that o
dsodman
2014/01/08 20:55:36
Done.
| |
| 160 0, 0, false, 0.0); | |
| 157 } | 161 } |
| 158 virtual bool ConfigureCrtc(RRCrtc crtc, | 162 virtual bool ConfigureCrtc(RRCrtc crtc, |
| 159 RRMode mode, | 163 RRMode mode, |
| 160 RROutput output, | 164 RROutput output, |
| 161 int x, | 165 int x, |
| 162 int y) OVERRIDE { | 166 int y) OVERRIDE { |
| 163 AppendAction(GetCrtcAction(crtc, x, y, mode, output)); | 167 AppendAction(GetCrtcAction(crtc, x, y, mode, output)); |
| 164 return configure_crtc_result_; | 168 if (mode == 0) |
| 169 return true; | |
| 170 | |
| 171 const OutputConfigurator::ModeInfo mode_info = | |
| 172 outputs_[output-1].mode_infos.find(mode)->second; | |
| 173 | |
| 174 return mode_info.width * mode_info.height <= max_configurable_pixels_; | |
| 165 } | 175 } |
| 166 virtual void CreateFrameBuffer( | 176 virtual void CreateFrameBuffer( |
| 167 int width, | 177 int width, |
| 168 int height, | 178 int height, |
| 169 const std::vector<OutputConfigurator::OutputSnapshot>& outputs) OVERRIDE { | 179 const std::vector<OutputConfigurator::OutputSnapshot>& outputs) OVERRIDE { |
| 170 AppendAction( | 180 AppendAction( |
| 171 GetFramebufferAction(width, | 181 GetFramebufferAction(width, |
| 172 height, | 182 height, |
| 173 outputs.size() >= 1 ? outputs[0].crtc : 0, | 183 outputs.size() >= 1 ? outputs[0].crtc : 0, |
| 174 outputs.size() >= 2 ? outputs[1].crtc : 0)); | 184 outputs.size() >= 2 ? outputs[1].crtc : 0)); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 215 std::map<RRMode, ModeDetails> modes_; | 225 std::map<RRMode, ModeDetails> modes_; |
| 216 | 226 |
| 217 // Most-recently-configured transformation matrices, keyed by touch device ID. | 227 // Most-recently-configured transformation matrices, keyed by touch device ID. |
| 218 std::map<int, OutputConfigurator::CoordinateTransformation> ctms_; | 228 std::map<int, OutputConfigurator::CoordinateTransformation> ctms_; |
| 219 | 229 |
| 220 // Outputs to be returned by GetOutputs(). | 230 // Outputs to be returned by GetOutputs(). |
| 221 std::vector<OutputConfigurator::OutputSnapshot> outputs_; | 231 std::vector<OutputConfigurator::OutputSnapshot> outputs_; |
| 222 | 232 |
| 223 std::string actions_; | 233 std::string actions_; |
| 224 | 234 |
| 225 // Return value returned by ConfigureCrtc(). | 235 // Simulate pixel-clk limitations |
|
Daniel Erat
2014/01/06 17:15:29
nit: avoid abbreviations ("pixel clock"?)
also de
dsodman
2014/01/08 20:55:36
Done.
| |
| 226 bool configure_crtc_result_; | 236 long max_configurable_pixels_; |
| 227 | 237 |
| 228 // Result value of GetHDCPState(). | 238 // Result value of GetHDCPState(). |
| 229 HDCPState hdcp_state_; | 239 HDCPState hdcp_state_; |
| 230 | 240 |
| 231 DISALLOW_COPY_AND_ASSIGN(TestDelegate); | 241 DISALLOW_COPY_AND_ASSIGN(TestDelegate); |
| 232 }; | 242 }; |
| 233 | 243 |
| 234 class TestObserver : public OutputConfigurator::Observer { | 244 class TestObserver : public OutputConfigurator::Observer { |
| 235 public: | 245 public: |
| 236 explicit TestObserver(OutputConfigurator* configurator) | 246 explicit TestObserver(OutputConfigurator* configurator) |
| (...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 867 configurator_.SetDisplayPower(DISPLAY_POWER_ALL_OFF, | 877 configurator_.SetDisplayPower(DISPLAY_POWER_ALL_OFF, |
| 868 OutputConfigurator::kSetDisplayPowerNoFlags); | 878 OutputConfigurator::kSetDisplayPowerNoFlags); |
| 869 EXPECT_EQ(JoinActions(kGrab, kUngrab, NULL), delegate_->GetActionsAndClear()); | 879 EXPECT_EQ(JoinActions(kGrab, kUngrab, NULL), delegate_->GetActionsAndClear()); |
| 870 configurator_.SetDisplayPower(DISPLAY_POWER_ALL_ON, | 880 configurator_.SetDisplayPower(DISPLAY_POWER_ALL_ON, |
| 871 OutputConfigurator::kSetDisplayPowerNoFlags); | 881 OutputConfigurator::kSetDisplayPowerNoFlags); |
| 872 EXPECT_EQ(JoinActions(kGrab, kForceDPMS, kUngrab, NULL), | 882 EXPECT_EQ(JoinActions(kGrab, kForceDPMS, kUngrab, NULL), |
| 873 delegate_->GetActionsAndClear()); | 883 delegate_->GetActionsAndClear()); |
| 874 | 884 |
| 875 // Connect an external display and check that it's configured correctly. | 885 // Connect an external display and check that it's configured correctly. |
| 876 outputs_[0] = outputs_[1]; | 886 outputs_[0] = outputs_[1]; |
| 887 // Some of the stub routines use the output field to know which output_ | |
| 888 // it is dealing with | |
| 889 outputs_[0].output = 1; | |
| 877 UpdateOutputs(1, true); | 890 UpdateOutputs(1, true); |
| 878 EXPECT_EQ(JoinActions(kUpdateXRandR, kGrab, | 891 EXPECT_EQ(JoinActions(kUpdateXRandR, kGrab, |
| 879 GetFramebufferAction(kBigModeWidth, kBigModeHeight, | 892 GetFramebufferAction(kBigModeWidth, kBigModeHeight, |
| 880 outputs_[0].crtc, 0).c_str(), | 893 outputs_[0].crtc, 0).c_str(), |
| 881 GetCrtcAction(outputs_[0].crtc, 0, 0, kBigModeId, | 894 GetCrtcAction(outputs_[0].crtc, 0, 0, kBigModeId, |
| 882 outputs_[0].output).c_str(), | 895 outputs_[0].output).c_str(), |
| 883 kUngrab, kProjectingOff, NULL), | 896 kUngrab, kProjectingOff, NULL), |
| 884 delegate_->GetActionsAndClear()); | 897 delegate_->GetActionsAndClear()); |
| 885 } | 898 } |
| 886 | 899 |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1012 kUngrab, kProjectingOff, NULL), | 1025 kUngrab, kProjectingOff, NULL), |
| 1013 delegate_->GetActionsAndClear()); | 1026 delegate_->GetActionsAndClear()); |
| 1014 | 1027 |
| 1015 // An additional event about the second output being disconnected should | 1028 // An additional event about the second output being disconnected should |
| 1016 // be ignored. | 1029 // be ignored. |
| 1017 test_api_.SendOutputChangeEvent( | 1030 test_api_.SendOutputChangeEvent( |
| 1018 outputs_[1].output, outputs_[1].crtc, outputs_[1].current_mode, false); | 1031 outputs_[1].output, outputs_[1].crtc, outputs_[1].current_mode, false); |
| 1019 EXPECT_FALSE(test_api_.TriggerConfigureTimeout()); | 1032 EXPECT_FALSE(test_api_.TriggerConfigureTimeout()); |
| 1020 EXPECT_EQ(kNoActions, delegate_->GetActionsAndClear()); | 1033 EXPECT_EQ(kNoActions, delegate_->GetActionsAndClear()); |
| 1021 | 1034 |
| 1022 // Tell the delegate to report failure, which should result in the | 1035 // Lower the limit for which the delegate will succeed, which should result |
| 1023 // second output sticking with its native mode. | 1036 // in the second output sticking with its native mode. |
| 1024 delegate_->set_configure_crtc_result(false); | 1037 delegate_->set_max_configurable_pixels(0); |
| 1025 UpdateOutputs(2, true); | 1038 UpdateOutputs(2, true); |
| 1026 EXPECT_EQ(JoinActions(kUpdateXRandR, kGrab, | 1039 EXPECT_EQ(JoinActions(kUpdateXRandR, kGrab, |
| 1027 GetFramebufferAction(kSmallModeWidth, kSmallModeHeight, | 1040 GetFramebufferAction(kSmallModeWidth, kSmallModeHeight, |
| 1028 outputs_[0].crtc, outputs_[1].crtc).c_str(), | 1041 outputs_[0].crtc, outputs_[1].crtc).c_str(), |
| 1029 GetCrtcAction(outputs_[0].crtc, 0, 0, kSmallModeId, | 1042 GetCrtcAction(outputs_[0].crtc, 0, 0, kSmallModeId, |
| 1030 outputs_[0].output).c_str(), | 1043 outputs_[0].output).c_str(), |
| 1031 GetCrtcAction(outputs_[1].crtc, 0, 0, kSmallModeId, | 1044 GetCrtcAction(outputs_[1].crtc, 0, 0, kSmallModeId, |
| 1032 outputs_[1].output).c_str(), | 1045 outputs_[1].output).c_str(), |
| 1033 kUngrab, kProjectingOn, NULL), | 1046 kUngrab, kProjectingOn, NULL), |
| 1034 delegate_->GetActionsAndClear()); | 1047 delegate_->GetActionsAndClear()); |
| 1035 | 1048 |
| 1036 // An change event reporting a mode change on the second output should | 1049 // A change event reporting a mode change on the second output should |
| 1037 // trigger another reconfigure. | 1050 // trigger another reconfigure. |
| 1038 delegate_->set_configure_crtc_result(true); | 1051 delegate_->set_max_configurable_pixels( |
| 1052 TestDelegate::kMaxTestWidth * TestDelegate::kMaxTestHeight); | |
| 1039 test_api_.SendOutputChangeEvent( | 1053 test_api_.SendOutputChangeEvent( |
| 1040 outputs_[1].output, outputs_[1].crtc, outputs_[1].mirror_mode, true); | 1054 outputs_[1].output, outputs_[1].crtc, outputs_[1].mirror_mode, true); |
| 1041 EXPECT_TRUE(test_api_.TriggerConfigureTimeout()); | 1055 EXPECT_TRUE(test_api_.TriggerConfigureTimeout()); |
| 1042 EXPECT_EQ(JoinActions(kGrab, | 1056 EXPECT_EQ(JoinActions(kGrab, |
| 1043 GetFramebufferAction(kSmallModeWidth, kSmallModeHeight, | 1057 GetFramebufferAction(kSmallModeWidth, kSmallModeHeight, |
| 1044 outputs_[0].crtc, outputs_[1].crtc).c_str(), | 1058 outputs_[0].crtc, outputs_[1].crtc).c_str(), |
| 1045 GetCrtcAction(outputs_[0].crtc, 0, 0, kSmallModeId, | 1059 GetCrtcAction(outputs_[0].crtc, 0, 0, kSmallModeId, |
| 1046 outputs_[0].output).c_str(), | 1060 outputs_[0].output).c_str(), |
| 1047 GetCrtcAction(outputs_[1].crtc, 0, 0, kSmallModeId, | 1061 GetCrtcAction(outputs_[1].crtc, 0, 0, kSmallModeId, |
| 1048 outputs_[1].output).c_str(), | 1062 outputs_[1].output).c_str(), |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 1065 ASSERT_EQ(static_cast<size_t>(2), cached->size()); | 1079 ASSERT_EQ(static_cast<size_t>(2), cached->size()); |
| 1066 EXPECT_EQ(outputs_[0].current_mode, (*cached)[0].current_mode); | 1080 EXPECT_EQ(outputs_[0].current_mode, (*cached)[0].current_mode); |
| 1067 EXPECT_EQ(outputs_[1].current_mode, (*cached)[1].current_mode); | 1081 EXPECT_EQ(outputs_[1].current_mode, (*cached)[1].current_mode); |
| 1068 } | 1082 } |
| 1069 | 1083 |
| 1070 TEST_F(OutputConfiguratorTest, PanelFitting) { | 1084 TEST_F(OutputConfiguratorTest, PanelFitting) { |
| 1071 // Configure the internal display to support only the big mode and the | 1085 // Configure the internal display to support only the big mode and the |
| 1072 // external display to support only the small mode. | 1086 // external display to support only the small mode. |
| 1073 outputs_[0].current_mode = kBigModeId; | 1087 outputs_[0].current_mode = kBigModeId; |
| 1074 outputs_[0].native_mode = kBigModeId; | 1088 outputs_[0].native_mode = kBigModeId; |
| 1089 outputs_[0].mirror_mode = kBigModeId; | |
|
Daniel Erat
2014/01/06 17:15:29
OutputConfigurator is responsible for choosing the
dsodman
2014/01/08 20:55:36
Thanks for the explanation. This is indeed not ne
| |
| 1075 outputs_[0].mode_infos.clear(); | 1090 outputs_[0].mode_infos.clear(); |
| 1076 outputs_[0].mode_infos[kBigModeId] = OutputConfigurator::ModeInfo( | 1091 outputs_[0].mode_infos[kBigModeId] = OutputConfigurator::ModeInfo( |
| 1077 kBigModeWidth, kBigModeHeight, false, 60.0); | 1092 kBigModeWidth, kBigModeHeight, false, 60.0); |
| 1078 | 1093 |
| 1079 outputs_[1].current_mode = kSmallModeId; | 1094 outputs_[1].current_mode = kSmallModeId; |
| 1080 outputs_[1].native_mode = kSmallModeId; | 1095 outputs_[1].native_mode = kSmallModeId; |
| 1096 outputs_[1].mirror_mode = kSmallModeId; | |
| 1081 outputs_[1].mode_infos.clear(); | 1097 outputs_[1].mode_infos.clear(); |
| 1082 outputs_[1].mode_infos[kSmallModeId] = OutputConfigurator::ModeInfo( | 1098 outputs_[1].mode_infos[kSmallModeId] = OutputConfigurator::ModeInfo( |
| 1083 kSmallModeWidth, kSmallModeHeight, false, 60.0); | 1099 kSmallModeWidth, kSmallModeHeight, false, 60.0); |
| 1084 | 1100 |
| 1085 // The small mode should be added to the internal output when requesting | 1101 // The small mode should be added to the internal output when requesting |
| 1086 // mirrored mode. | 1102 // mirrored mode. |
| 1087 UpdateOutputs(2, false); | 1103 UpdateOutputs(2, false); |
| 1088 state_controller_.set_state(STATE_DUAL_MIRROR); | 1104 state_controller_.set_state(STATE_DUAL_MIRROR); |
| 1089 configurator_.Init(true /* is_panel_fitting_enabled */); | 1105 configurator_.Init(true /* is_panel_fitting_enabled */); |
| 1090 configurator_.Start(0); | 1106 configurator_.Start(0); |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1256 EXPECT_EQ(kSmallModeHeight + OutputConfigurator::kVerticalGap, | 1272 EXPECT_EQ(kSmallModeHeight + OutputConfigurator::kVerticalGap, |
| 1257 round((kDualHeight - 1) * ctm2.y_offset)); | 1273 round((kDualHeight - 1) * ctm2.y_offset)); |
| 1258 | 1274 |
| 1259 EXPECT_EQ(kSmallModeWidth - 1, round((kDualWidth - 1) * ctm1.x_scale)); | 1275 EXPECT_EQ(kSmallModeWidth - 1, round((kDualWidth - 1) * ctm1.x_scale)); |
| 1260 EXPECT_EQ(0, round((kDualWidth - 1) * ctm1.x_offset)); | 1276 EXPECT_EQ(0, round((kDualWidth - 1) * ctm1.x_offset)); |
| 1261 | 1277 |
| 1262 EXPECT_EQ(kBigModeWidth - 1, round((kDualWidth - 1) * ctm2.x_scale)); | 1278 EXPECT_EQ(kBigModeWidth - 1, round((kDualWidth - 1) * ctm2.x_scale)); |
| 1263 EXPECT_EQ(0, round((kDualWidth - 1) * ctm2.x_offset)); | 1279 EXPECT_EQ(0, round((kDualWidth - 1) * ctm2.x_offset)); |
| 1264 } | 1280 } |
| 1265 | 1281 |
| 1282 TEST_F(OutputConfiguratorTest, HandleConfigureCrtcFailure) { | |
| 1283 OutputConfigurator::OutputSnapshot *output; | |
|
Daniel Erat
2014/01/06 17:15:29
nit: '*' goes on left side of space
dsodman
2014/01/08 20:55:36
Done.
| |
| 1284 OutputConfigurator::OutputSnapshot backup_output; | |
| 1285 InitWithSingleOutput(); | |
| 1286 test_api_.SendScreenChangeEvent(); | |
| 1287 EXPECT_EQ(kUpdateXRandR, delegate_->GetActionsAndClear()); | |
| 1288 | |
|
Daniel Erat
2014/01/06 17:15:29
nit: delete extra blank line
dsodman
2014/01/08 20:55:36
Done.
| |
| 1289 | |
| 1290 // Save the state of output_[0] so that it can be restored | |
| 1291 // when the test is done | |
|
Daniel Erat
2014/01/06 17:15:29
nit: add trailing period
dsodman
2014/01/08 20:55:36
Done.
| |
| 1292 backup_output = outputs_[0]; | |
| 1293 outputs_[0].mode_infos.clear(); | |
| 1294 | |
| 1295 // Give the mode_info list a few reasonable modes | |
| 1296 output = &outputs_[0]; | |
| 1297 output->mode_infos[11]=OutputConfigurator::ModeInfo(2560, 1600, false, 60.0); | |
|
Daniel Erat
2014/01/06 17:15:29
there should be spaces on either side of the equal
dsodman
2014/01/08 20:55:36
Done.
| |
| 1298 output->mode_infos[12]=OutputConfigurator::ModeInfo(1920, 1080, false, 60.0); | |
| 1299 output->mode_infos[13]=OutputConfigurator::ModeInfo(1920, 1080, false, 40.0); | |
| 1300 output->mode_infos[14]=OutputConfigurator::ModeInfo(1024, 768, false, 60.0); | |
| 1301 | |
| 1302 output = &outputs_[1]; | |
| 1303 output->mode_infos[11]=OutputConfigurator::ModeInfo(2560, 1600, false, 60.0); | |
| 1304 output->mode_infos[12]=OutputConfigurator::ModeInfo(1920, 1080, false, 60.0); | |
| 1305 output->mode_infos[13]=OutputConfigurator::ModeInfo(1920, 1080, false, 40.0); | |
| 1306 output->mode_infos[14]=OutputConfigurator::ModeInfo(1024, 768, false, 60.0); | |
| 1307 | |
| 1308 // This should cause ConfigureCrtc to fail once and get 1920x1080 | |
| 1309 outputs_[0].selected_mode = 11; | |
| 1310 outputs_[0].mirror_mode = 11; | |
| 1311 outputs_[1].selected_mode = 11; | |
| 1312 delegate_->set_max_configurable_pixels(1920*1080); | |
| 1313 | |
| 1314 configurator_.Init(false); | |
|
Daniel Erat
2014/01/06 17:15:29
don't call Init() multiple times; the later call t
dsodman
2014/01/08 20:55:36
Thanks for the explanation. I've tried to update
| |
| 1315 state_controller_.set_state(STATE_SINGLE); | |
| 1316 UpdateOutputs(1, true); | |
| 1317 EXPECT_NE(kNoActions, delegate_->GetActionsAndClear()); | |
| 1318 test_api_.SendOutputChangeEvent( | |
| 1319 outputs_[0].output, outputs_[0].crtc, outputs_[0].selected_mode, true); | |
|
Daniel Erat
2014/01/06 17:15:29
UpdateOutputs() should already do this
| |
| 1320 UpdateOutputs(1, true); | |
| 1321 | |
| 1322 EXPECT_EQ(JoinActions(kUpdateXRandR, kGrab, | |
| 1323 GetFramebufferAction(TestDelegate::kMaxTestWidth, | |
| 1324 TestDelegate::kMaxTestHeight, | |
| 1325 outputs_[0].crtc, 0).c_str(), | |
| 1326 GetCrtcAction(outputs_[0].crtc, 0, 0, 11, | |
| 1327 outputs_[0].output).c_str(), | |
| 1328 GetCrtcAction(outputs_[0].crtc, 0, 0, 12, | |
| 1329 outputs_[0].output).c_str(), | |
| 1330 kUngrab, kProjectingOff, NULL), | |
| 1331 delegate_->GetActionsAndClear()); | |
| 1332 | |
| 1333 configurator_.Init(false); | |
|
Daniel Erat
2014/01/06 17:15:29
remove this too
dsodman
2014/01/08 20:55:36
Done.
| |
| 1334 state_controller_.set_state(STATE_DUAL_MIRROR); | |
| 1335 UpdateOutputs(2, true); | |
| 1336 EXPECT_NE(kNoActions, delegate_->GetActionsAndClear()); | |
| 1337 test_api_.SendOutputChangeEvent( | |
| 1338 outputs_[1].output, outputs_[1].crtc, outputs_[1].selected_mode, true); | |
| 1339 UpdateOutputs(2, true); | |
| 1340 | |
| 1341 EXPECT_EQ(JoinActions(kUpdateXRandR, kGrab, | |
| 1342 GetFramebufferAction(TestDelegate::kMaxTestWidth, | |
| 1343 TestDelegate::kMaxTestHeight, | |
| 1344 outputs_[0].crtc, outputs_[1].crtc).c_str(), | |
| 1345 GetCrtcAction(outputs_[0].crtc, 0, 0, 11, | |
| 1346 outputs_[0].output).c_str(), | |
| 1347 GetCrtcAction(outputs_[0].crtc, 0, 0, 12, | |
| 1348 outputs_[0].output).c_str(), | |
| 1349 kUngrab, kProjectingOn, NULL), | |
| 1350 delegate_->GetActionsAndClear()); | |
| 1351 | |
| 1352 | |
| 1353 delegate_->set_max_configurable_pixels( | |
| 1354 TestDelegate::kMaxTestWidth * TestDelegate::kMaxTestHeight); | |
| 1355 | |
| 1356 outputs_[0] = backup_output; | |
|
Daniel Erat
2014/01/06 17:15:29
you shouldn't need to restore anything at the end
dsodman
2014/01/08 20:55:36
Done.
| |
| 1357 } | |
| 1358 | |
| 1266 } // namespace chromeos | 1359 } // namespace chromeos |
| OLD | NEW |