Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(293)

Side by Side Diff: ui/display/chromeos/display_configurator.h

Issue 2427843002: Delay display configuration after waking up from suspend with multi displays (Closed)
Patch Set: Nits Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ui/display/chromeos/display_configurator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef UI_DISPLAY_CHROMEOS_DISPLAY_CONFIGURATOR_H_ 5 #ifndef UI_DISPLAY_CHROMEOS_DISPLAY_CONFIGURATOR_H_
6 #define UI_DISPLAY_CHROMEOS_DISPLAY_CONFIGURATOR_H_ 6 #define UI_DISPLAY_CHROMEOS_DISPLAY_CONFIGURATOR_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 // Helper class used by tests. 128 // Helper class used by tests.
129 class TestApi { 129 class TestApi {
130 public: 130 public:
131 TestApi(DisplayConfigurator* configurator) : configurator_(configurator) {} 131 TestApi(DisplayConfigurator* configurator) : configurator_(configurator) {}
132 ~TestApi() {} 132 ~TestApi() {}
133 133
134 // If |configure_timer_| is started, stops the timer, runs 134 // If |configure_timer_| is started, stops the timer, runs
135 // ConfigureDisplays(), and returns true; returns false otherwise. 135 // ConfigureDisplays(), and returns true; returns false otherwise.
136 bool TriggerConfigureTimeout() WARN_UNUSED_RESULT; 136 bool TriggerConfigureTimeout() WARN_UNUSED_RESULT;
137 137
138 // Gets the current delay of the |configure_timer_| if it's running, or zero
139 // time delta otherwise.
140 base::TimeDelta GetConfigureDelay() const;
141
138 private: 142 private:
139 DisplayConfigurator* configurator_; // not owned 143 DisplayConfigurator* configurator_; // not owned
140 144
141 DISALLOW_COPY_AND_ASSIGN(TestApi); 145 DISALLOW_COPY_AND_ASSIGN(TestApi);
142 }; 146 };
143 147
144 // Flags that can be passed to SetDisplayPower(). 148 // Flags that can be passed to SetDisplayPower().
145 static const int kSetDisplayPowerNoFlags; 149 static const int kSetDisplayPowerNoFlags;
146 // Configure displays even if the passed-in state matches |power_state_|. 150 // Configure displays even if the passed-in state matches |power_state_|.
147 static const int kSetDisplayPowerForceProbe; 151 static const int kSetDisplayPowerForceProbe;
148 // Do not change the state if multiple displays are connected or if the 152 // Do not change the state if multiple displays are connected or if the
149 // only connected display is external. 153 // only connected display is external.
150 static const int kSetDisplayPowerOnlyIfSingleInternalDisplay; 154 static const int kSetDisplayPowerOnlyIfSingleInternalDisplay;
151 155
152 // Gap between screens so cursor at bottom of active display doesn't 156 // Gap between screens so cursor at bottom of active display doesn't
153 // partially appear on top of inactive display. Higher numbers guard 157 // partially appear on top of inactive display. Higher numbers guard
154 // against larger cursors, but also waste more memory. 158 // against larger cursors, but also waste more memory.
155 // For simplicity, this is hard-coded to avoid the complexity of always 159 // For simplicity, this is hard-coded to avoid the complexity of always
156 // determining the DPI of the screen and rationalizing which screen we 160 // determining the DPI of the screen and rationalizing which screen we
157 // need to use for the DPI calculation. 161 // need to use for the DPI calculation.
158 // See crbug.com/130188 for initial discussion. 162 // See crbug.com/130188 for initial discussion.
159 static const int kVerticalGap = 60; 163 static const int kVerticalGap = 60;
160 164
165 // The delay to perform configuration after RRNotify. See the comment for
166 // |configure_timer_|.
167 static const int kConfigureDelayMs = 500;
168
169 // The delay to perform configuration after waking up from suspend when in
170 // multi display mode. Should be bigger than |kConfigureDelayMs|. Generally
171 // big enough for external displays to be detected and added.
172 // crbug.com/614624.
173 static const int kResumeConfigureMultiDisplayDelayMs = 2000;
174
161 // Returns the mode within |display| that matches the given size with highest 175 // Returns the mode within |display| that matches the given size with highest
162 // refresh rate. Returns None if no matching display was found. 176 // refresh rate. Returns None if no matching display was found.
163 static const DisplayMode* FindDisplayModeMatchingSize( 177 static const DisplayMode* FindDisplayModeMatchingSize(
164 const DisplaySnapshot& display, 178 const DisplaySnapshot& display,
165 const gfx::Size& size); 179 const gfx::Size& size);
166 180
167 DisplayConfigurator(); 181 DisplayConfigurator();
168 ~DisplayConfigurator() override; 182 ~DisplayConfigurator() override;
169 183
170 MultipleDisplayState display_state() const { return current_display_state_; } 184 MultipleDisplayState display_state() const { return current_display_state_; }
171 chromeos::DisplayPowerState requested_power_state() const { 185 chromeos::DisplayPowerState requested_power_state() const {
172 return requested_power_state_; 186 return requested_power_state_;
173 } 187 }
174 const gfx::Size framebuffer_size() const { return framebuffer_size_; } 188 const gfx::Size framebuffer_size() const { return framebuffer_size_; }
175 const std::vector<DisplaySnapshot*>& cached_displays() const { 189 const std::vector<DisplaySnapshot*>& cached_displays() const {
176 return cached_displays_; 190 return cached_displays_;
177 } 191 }
192 void set_state_controller(StateController* controller) {
193 state_controller_ = controller;
194 }
195 void set_mirroring_controller(SoftwareMirroringController* controller) {
196 mirroring_controller_ = controller;
197 }
198 void set_configure_display(bool configure_display) {
199 configure_display_ = configure_display;
200 }
201 chromeos::DisplayPowerState current_power_state() const {
202 return current_power_state_;
203 }
178 204
179 // Called when an external process no longer needs to control the display 205 // Called when an external process no longer needs to control the display
180 // and Chrome can take control. 206 // and Chrome can take control.
181 void TakeControl(const DisplayControlCallback& callback); 207 void TakeControl(const DisplayControlCallback& callback);
182 208
183 // Called when an external process needs to control the display and thus 209 // Called when an external process needs to control the display and thus
184 // Chrome should relinquish it. 210 // Chrome should relinquish it.
185 void RelinquishControl(const DisplayControlCallback& callback); 211 void RelinquishControl(const DisplayControlCallback& callback);
186 212
187 void set_state_controller(StateController* controller) {
188 state_controller_ = controller;
189 }
190 void set_mirroring_controller(SoftwareMirroringController* controller) {
191 mirroring_controller_ = controller;
192 }
193
194 // Replaces |native_display_delegate_| with the delegate passed in and sets 213 // Replaces |native_display_delegate_| with the delegate passed in and sets
195 // |configure_display_| to true. Should be called before Init(). 214 // |configure_display_| to true. Should be called before Init().
196 void SetDelegateForTesting( 215 void SetDelegateForTesting(
197 std::unique_ptr<NativeDisplayDelegate> display_delegate); 216 std::unique_ptr<NativeDisplayDelegate> display_delegate);
198 217
199 // Sets the initial value of |power_state_|. Must be called before Start(). 218 // Sets the initial value of |power_state_|. Must be called before Start().
200 void SetInitialDisplayPower(chromeos::DisplayPowerState power_state); 219 void SetInitialDisplayPower(chromeos::DisplayPowerState power_state);
201 220
202 // Initialization, must be called right after constructor. 221 // Initialization, must be called right after constructor.
203 // |is_panel_fitting_enabled| indicates hardware panel fitting support. 222 // |is_panel_fitting_enabled| indicates hardware panel fitting support.
(...skipping 26 matching lines...) Expand all
230 249
231 // NativeDisplayDelegate::Observer overrides: 250 // NativeDisplayDelegate::Observer overrides:
232 void OnConfigurationChanged() override; 251 void OnConfigurationChanged() override;
233 252
234 void AddObserver(Observer* observer); 253 void AddObserver(Observer* observer);
235 void RemoveObserver(Observer* observer); 254 void RemoveObserver(Observer* observer);
236 255
237 // Sets all the displays into pre-suspend mode; usually this means 256 // Sets all the displays into pre-suspend mode; usually this means
238 // configure them for their resume state. This allows faster resume on 257 // configure them for their resume state. This allows faster resume on
239 // machines where display configuration is slow. On completion of the display 258 // machines where display configuration is slow. On completion of the display
240 // configuration |callback| is executed. 259 // configuration |callback| is executed synchronously or asynchronously.
241 void SuspendDisplays(const ConfigurationCallback& callback); 260 void SuspendDisplays(const ConfigurationCallback& callback);
242 261
243 // Reprobes displays to handle changes made while the system was 262 // Reprobes displays to handle changes made while the system was
244 // suspended. 263 // suspended.
245 void ResumeDisplays(); 264 void ResumeDisplays();
246 265
247 // Registers a client for display protection and requests a client id. Returns 266 // Registers a client for display protection and requests a client id. Returns
248 // 0 if requesting failed. 267 // 0 if requesting failed.
249 ContentProtectionClientId RegisterContentProtectionClient(); 268 ContentProtectionClientId RegisterContentProtectionClient();
250 269
(...skipping 24 matching lines...) Expand all
275 bool SetColorCalibrationProfile(int64_t display_id, 294 bool SetColorCalibrationProfile(int64_t display_id,
276 ui::ColorCalibrationProfile new_profile); 295 ui::ColorCalibrationProfile new_profile);
277 296
278 // Enables/disables virtual display. 297 // Enables/disables virtual display.
279 int64_t AddVirtualDisplay(const gfx::Size& display_size); 298 int64_t AddVirtualDisplay(const gfx::Size& display_size);
280 bool RemoveVirtualDisplay(int64_t display_id); 299 bool RemoveVirtualDisplay(int64_t display_id);
281 300
282 // Returns true if there is at least one display on. 301 // Returns true if there is at least one display on.
283 bool IsDisplayOn() const; 302 bool IsDisplayOn() const;
284 303
285 void set_configure_display(bool configure_display) {
286 configure_display_ = configure_display;
287 }
288
289 // Sets the gamma, degamma and correction matrix for |display_id| to the 304 // Sets the gamma, degamma and correction matrix for |display_id| to the
290 // values in |degamma_lut|, |gamma_lut| and |correction_matrix|. 305 // values in |degamma_lut|, |gamma_lut| and |correction_matrix|.
291 bool SetColorCorrection(int64_t display_id, 306 bool SetColorCorrection(int64_t display_id,
292 const std::vector<GammaRampRGBEntry>& degamma_lut, 307 const std::vector<GammaRampRGBEntry>& degamma_lut,
293 const std::vector<GammaRampRGBEntry>& gamma_lut, 308 const std::vector<GammaRampRGBEntry>& gamma_lut,
294 const std::vector<float>& correction_matrix); 309 const std::vector<float>& correction_matrix);
295 310
296 private: 311 private:
297 class DisplayLayoutManagerImpl; 312 class DisplayLayoutManagerImpl;
298 313
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 479
465 // This must be the last variable. 480 // This must be the last variable.
466 base::WeakPtrFactory<DisplayConfigurator> weak_ptr_factory_; 481 base::WeakPtrFactory<DisplayConfigurator> weak_ptr_factory_;
467 482
468 DISALLOW_COPY_AND_ASSIGN(DisplayConfigurator); 483 DISALLOW_COPY_AND_ASSIGN(DisplayConfigurator);
469 }; 484 };
470 485
471 } // namespace ui 486 } // namespace ui
472 487
473 #endif // UI_DISPLAY_CHROMEOS_DISPLAY_CONFIGURATOR_H_ 488 #endif // UI_DISPLAY_CHROMEOS_DISPLAY_CONFIGURATOR_H_
OLDNEW
« no previous file with comments | « no previous file | ui/display/chromeos/display_configurator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698