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

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: derat's comments Created 4 years, 2 months 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
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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 151
152 // Gap between screens so cursor at bottom of active display doesn't 152 // Gap between screens so cursor at bottom of active display doesn't
153 // partially appear on top of inactive display. Higher numbers guard 153 // partially appear on top of inactive display. Higher numbers guard
154 // against larger cursors, but also waste more memory. 154 // against larger cursors, but also waste more memory.
155 // For simplicity, this is hard-coded to avoid the complexity of always 155 // For simplicity, this is hard-coded to avoid the complexity of always
156 // determining the DPI of the screen and rationalizing which screen we 156 // determining the DPI of the screen and rationalizing which screen we
157 // need to use for the DPI calculation. 157 // need to use for the DPI calculation.
158 // See crbug.com/130188 for initial discussion. 158 // See crbug.com/130188 for initial discussion.
159 static const int kVerticalGap = 60; 159 static const int kVerticalGap = 60;
160 160
161 // The delay to perform configuration after RRNotify. See the comment for
162 // |configure_timer_|.
163 static const int kConfigureDelayMs = 500;
164
165 // The delay to perform configuration after waking up from suspend when in
166 // multi display mode. Should be bigger than |kConfigureDelayMs|. Generally
167 // big enough for external displays to be detected and added.
168 // crbug.com/614624.
169 static const int kResumeConfigureMultiDisplayDelayMs = 2000;
170
161 // Returns the mode within |display| that matches the given size with highest 171 // Returns the mode within |display| that matches the given size with highest
162 // refresh rate. Returns None if no matching display was found. 172 // refresh rate. Returns None if no matching display was found.
163 static const DisplayMode* FindDisplayModeMatchingSize( 173 static const DisplayMode* FindDisplayModeMatchingSize(
164 const DisplaySnapshot& display, 174 const DisplaySnapshot& display,
165 const gfx::Size& size); 175 const gfx::Size& size);
166 176
167 DisplayConfigurator(); 177 DisplayConfigurator();
168 ~DisplayConfigurator() override; 178 ~DisplayConfigurator() override;
169 179
170 MultipleDisplayState display_state() const { return current_display_state_; } 180 MultipleDisplayState display_state() const { return current_display_state_; }
171 chromeos::DisplayPowerState requested_power_state() const { 181 chromeos::DisplayPowerState requested_power_state() const {
172 return requested_power_state_; 182 return requested_power_state_;
173 } 183 }
174 const gfx::Size framebuffer_size() const { return framebuffer_size_; } 184 const gfx::Size framebuffer_size() const { return framebuffer_size_; }
175 const std::vector<DisplaySnapshot*>& cached_displays() const { 185 const std::vector<DisplaySnapshot*>& cached_displays() const {
176 return cached_displays_; 186 return cached_displays_;
177 } 187 }
188 void set_state_controller(StateController* controller) {
189 state_controller_ = controller;
190 }
191 void set_mirroring_controller(SoftwareMirroringController* controller) {
192 mirroring_controller_ = controller;
193 }
194 void set_configure_display(bool configure_display) {
195 configure_display_ = configure_display;
196 }
197 chromeos::DisplayPowerState current_power_state() const {
198 return current_power_state_;
199 }
178 200
179 // Called when an external process no longer needs to control the display 201 // Called when an external process no longer needs to control the display
180 // and Chrome can take control. 202 // and Chrome can take control.
181 void TakeControl(const DisplayControlCallback& callback); 203 void TakeControl(const DisplayControlCallback& callback);
182 204
183 // Called when an external process needs to control the display and thus 205 // Called when an external process needs to control the display and thus
184 // Chrome should relinquish it. 206 // Chrome should relinquish it.
185 void RelinquishControl(const DisplayControlCallback& callback); 207 void RelinquishControl(const DisplayControlCallback& callback);
186 208
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 209 // Replaces |native_display_delegate_| with the delegate passed in and sets
195 // |configure_display_| to true. Should be called before Init(). 210 // |configure_display_| to true. Should be called before Init().
196 void SetDelegateForTesting( 211 void SetDelegateForTesting(
197 std::unique_ptr<NativeDisplayDelegate> display_delegate); 212 std::unique_ptr<NativeDisplayDelegate> display_delegate);
198 213
199 // Sets the initial value of |power_state_|. Must be called before Start(). 214 // Sets the initial value of |power_state_|. Must be called before Start().
200 void SetInitialDisplayPower(chromeos::DisplayPowerState power_state); 215 void SetInitialDisplayPower(chromeos::DisplayPowerState power_state);
201 216
202 // Initialization, must be called right after constructor. 217 // Initialization, must be called right after constructor.
203 // |is_panel_fitting_enabled| indicates hardware panel fitting support. 218 // |is_panel_fitting_enabled| indicates hardware panel fitting support.
(...skipping 30 matching lines...) Expand all
234 void AddObserver(Observer* observer); 249 void AddObserver(Observer* observer);
235 void RemoveObserver(Observer* observer); 250 void RemoveObserver(Observer* observer);
236 251
237 // Sets all the displays into pre-suspend mode; usually this means 252 // Sets all the displays into pre-suspend mode; usually this means
238 // configure them for their resume state. This allows faster resume on 253 // configure them for their resume state. This allows faster resume on
239 // machines where display configuration is slow. On completion of the display 254 // machines where display configuration is slow. On completion of the display
240 // configuration |callback| is executed. 255 // configuration |callback| is executed.
241 void SuspendDisplays(const ConfigurationCallback& callback); 256 void SuspendDisplays(const ConfigurationCallback& callback);
242 257
243 // Reprobes displays to handle changes made while the system was 258 // Reprobes displays to handle changes made while the system was
244 // suspended. 259 // suspended. ResumeDisplaysWithCallback() invokes |callback| when display
260 // configuration is complete.
245 void ResumeDisplays(); 261 void ResumeDisplays();
262 void ResumeDisplaysWithCallback(const ConfigurationCallback& callback);
Daniel Erat 2016/10/24 16:31:04 instead of having two methods, please just make Re
afakhry 2016/10/25 00:37:10 Done. base::DoNothing() won't work though, it's
246 263
247 // Registers a client for display protection and requests a client id. Returns 264 // Registers a client for display protection and requests a client id. Returns
248 // 0 if requesting failed. 265 // 0 if requesting failed.
249 ContentProtectionClientId RegisterContentProtectionClient(); 266 ContentProtectionClientId RegisterContentProtectionClient();
250 267
251 // Unregisters the client. 268 // Unregisters the client.
252 void UnregisterContentProtectionClient(ContentProtectionClientId client_id); 269 void UnregisterContentProtectionClient(ContentProtectionClientId client_id);
253 270
254 // Queries link status and protection status. |callback| is used to respond 271 // Queries link status and protection status. |callback| is used to respond
255 // to the query. 272 // to the query.
(...skipping 19 matching lines...) Expand all
275 bool SetColorCalibrationProfile(int64_t display_id, 292 bool SetColorCalibrationProfile(int64_t display_id,
276 ui::ColorCalibrationProfile new_profile); 293 ui::ColorCalibrationProfile new_profile);
277 294
278 // Enables/disables virtual display. 295 // Enables/disables virtual display.
279 int64_t AddVirtualDisplay(const gfx::Size& display_size); 296 int64_t AddVirtualDisplay(const gfx::Size& display_size);
280 bool RemoveVirtualDisplay(int64_t display_id); 297 bool RemoveVirtualDisplay(int64_t display_id);
281 298
282 // Returns true if there is at least one display on. 299 // Returns true if there is at least one display on.
283 bool IsDisplayOn() const; 300 bool IsDisplayOn() const;
284 301
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 302 // Sets the gamma, degamma and correction matrix for |display_id| to the
290 // values in |degamma_lut|, |gamma_lut| and |correction_matrix|. 303 // values in |degamma_lut|, |gamma_lut| and |correction_matrix|.
291 bool SetColorCorrection(int64_t display_id, 304 bool SetColorCorrection(int64_t display_id,
292 const std::vector<GammaRampRGBEntry>& degamma_lut, 305 const std::vector<GammaRampRGBEntry>& degamma_lut,
293 const std::vector<GammaRampRGBEntry>& gamma_lut, 306 const std::vector<GammaRampRGBEntry>& gamma_lut,
294 const std::vector<float>& correction_matrix); 307 const std::vector<float>& correction_matrix);
295 308
296 private: 309 private:
297 class DisplayLayoutManagerImpl; 310 class DisplayLayoutManagerImpl;
298 311
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 477
465 // This must be the last variable. 478 // This must be the last variable.
466 base::WeakPtrFactory<DisplayConfigurator> weak_ptr_factory_; 479 base::WeakPtrFactory<DisplayConfigurator> weak_ptr_factory_;
467 480
468 DISALLOW_COPY_AND_ASSIGN(DisplayConfigurator); 481 DISALLOW_COPY_AND_ASSIGN(DisplayConfigurator);
469 }; 482 };
470 483
471 } // namespace ui 484 } // namespace ui
472 485
473 #endif // UI_DISPLAY_CHROMEOS_DISPLAY_CONFIGURATOR_H_ 486 #endif // UI_DISPLAY_CHROMEOS_DISPLAY_CONFIGURATOR_H_
OLDNEW
« no previous file with comments | « no previous file | ui/display/chromeos/display_configurator.cc » ('j') | ui/display/chromeos/display_configurator.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698