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 #ifndef CHROMEOS_DISPLAY_OUTPUT_CONFIGURATOR_H_ | 5 #ifndef CHROMEOS_DISPLAY_OUTPUT_CONFIGURATOR_H_ |
6 #define CHROMEOS_DISPLAY_OUTPUT_CONFIGURATOR_H_ | 6 #define CHROMEOS_DISPLAY_OUTPUT_CONFIGURATOR_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 RROutput output; | 49 RROutput output; |
50 | 50 |
51 // CRTC that should be used for this output. Not necessarily the CRTC | 51 // CRTC that should be used for this output. Not necessarily the CRTC |
52 // that XRandR reports is currently being used. | 52 // that XRandR reports is currently being used. |
53 RRCrtc crtc; | 53 RRCrtc crtc; |
54 | 54 |
55 RRMode current_mode; | 55 RRMode current_mode; |
56 RRMode native_mode; | 56 RRMode native_mode; |
57 RRMode mirror_mode; | 57 RRMode mirror_mode; |
| 58 RRMode selected_mode; |
58 | 59 |
59 int y; | 60 int y; |
60 int height; | 61 int height; |
61 | 62 |
62 bool is_internal; | 63 bool is_internal; |
63 bool is_aspect_preserving_scaling; | 64 bool is_aspect_preserving_scaling; |
64 | 65 |
65 // XInput device ID or 0 if this output isn't a touchscreen. | 66 // XInput device ID or 0 if this output isn't a touchscreen. |
66 int touch_device_id; | 67 int touch_device_id; |
67 | 68 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 108 |
108 // Interface for classes that make decisions about which output state | 109 // Interface for classes that make decisions about which output state |
109 // should be used. | 110 // should be used. |
110 class StateController { | 111 class StateController { |
111 public: | 112 public: |
112 virtual ~StateController() {} | 113 virtual ~StateController() {} |
113 | 114 |
114 // Called when displays are detected. | 115 // Called when displays are detected. |
115 virtual OutputState GetStateForDisplayIds( | 116 virtual OutputState GetStateForDisplayIds( |
116 const std::vector<int64>& display_ids) const = 0; | 117 const std::vector<int64>& display_ids) const = 0; |
| 118 |
| 119 // Queries the resolution (|width|x|height|) in pixels |
| 120 // to select output mode for the given display id. |
| 121 virtual bool GetResolutionForDisplayId(int64 display_id, |
| 122 int* width, |
| 123 int* height) const = 0; |
117 }; | 124 }; |
118 | 125 |
119 // Interface for classes that implement software based mirroring. | 126 // Interface for classes that implement software based mirroring. |
120 class SoftwareMirroringController { | 127 class SoftwareMirroringController { |
121 public: | 128 public: |
122 virtual ~SoftwareMirroringController() {} | 129 virtual ~SoftwareMirroringController() {} |
123 | 130 |
124 // Called when the hardware mirroring failed. | 131 // Called when the hardware mirroring failed. |
125 virtual void SetSoftwareMirroring(bool enabled) = 0; | 132 virtual void SetSoftwareMirroring(bool enabled) = 0; |
126 }; | 133 }; |
(...skipping 25 matching lines...) Expand all Loading... |
152 virtual void SyncWithServer() = 0; | 159 virtual void SyncWithServer() = 0; |
153 | 160 |
154 // Sets the window's background color to |color_argb|. | 161 // Sets the window's background color to |color_argb|. |
155 virtual void SetBackgroundColor(uint32 color_argb) = 0; | 162 virtual void SetBackgroundColor(uint32 color_argb) = 0; |
156 | 163 |
157 // Enables DPMS and forces it to the "on" state. | 164 // Enables DPMS and forces it to the "on" state. |
158 virtual void ForceDPMSOn() = 0; | 165 virtual void ForceDPMSOn() = 0; |
159 | 166 |
160 // Returns information about the current outputs. | 167 // Returns information about the current outputs. |
161 // This method may block for 60 milliseconds or more. | 168 // This method may block for 60 milliseconds or more. |
162 virtual std::vector<OutputSnapshot> GetOutputs() = 0; | 169 virtual std::vector<OutputSnapshot> GetOutputs( |
| 170 const StateController* state_controller) = 0; |
163 | 171 |
164 // Gets details corresponding to |mode|. Parameters may be NULL. | 172 // Gets details corresponding to |mode|. Parameters may be NULL. |
165 // Returns true on success. | 173 // Returns true on success. |
166 virtual bool GetModeDetails(RRMode mode, | 174 virtual bool GetModeDetails(RRMode mode, |
167 int* width, | 175 int* width, |
168 int* height, | 176 int* height, |
169 bool* interlaced) = 0; | 177 bool* interlaced) = 0; |
170 | 178 |
171 // Calls XRRSetCrtcConfig() with the given options but some of our | 179 // Calls XRRSetCrtcConfig() with the given options but some of our |
172 // default output count and rotation arguments. | 180 // default output count and rotation arguments. |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 void SuspendDisplays(); | 304 void SuspendDisplays(); |
297 | 305 |
298 // Reprobes displays to handle changes made while the system was | 306 // Reprobes displays to handle changes made while the system was |
299 // suspended. | 307 // suspended. |
300 void ResumeDisplays(); | 308 void ResumeDisplays(); |
301 | 309 |
302 const std::map<int, float>& GetMirroredDisplayAreaRatioMap() { | 310 const std::map<int, float>& GetMirroredDisplayAreaRatioMap() { |
303 return mirrored_display_area_ratio_map_; | 311 return mirrored_display_area_ratio_map_; |
304 } | 312 } |
305 | 313 |
| 314 // Configure outputs with |kConfigureDelayMs| delay, |
| 315 // so that time-consuming ConfigureOutputs() won't be called multiple times. |
| 316 void ScheduleConfigureOutputs(); |
| 317 |
306 private: | 318 private: |
307 // Configure outputs. | 319 // Configure outputs. |
308 void ConfigureOutputs(); | 320 void ConfigureOutputs(); |
309 | 321 |
310 // Configure outputs with |kConfigureDelayMs| delay, | |
311 // so that time-consuming ConfigureOutputs() won't be called multiple times. | |
312 void ScheduleConfigureOutputs(); | |
313 | |
314 // Fires OnDisplayModeChanged() event to the observers. | 322 // Fires OnDisplayModeChanged() event to the observers. |
315 void NotifyOnDisplayChanged(); | 323 void NotifyOnDisplayChanged(); |
316 | 324 |
317 // Switches to the state specified in |output_state| and |power_state|. | 325 // Switches to the state specified in |output_state| and |power_state|. |
318 // If the hardware mirroring failed and |mirroring_controller_| is set, | 326 // If the hardware mirroring failed and |mirroring_controller_| is set, |
319 // it switches to |STATE_DUAL_EXTENDED| and calls |SetSoftwareMirroring()| | 327 // it switches to |STATE_DUAL_EXTENDED| and calls |SetSoftwareMirroring()| |
320 // to enable software based mirroing. | 328 // to enable software based mirroing. |
321 // On success, updates |output_state_| and |power_state_| and returns true. | 329 // On success, updates |output_state_| and |power_state_| and returns true. |
322 bool EnterStateOrFallBackToSoftwareMirroring( | 330 bool EnterStateOrFallBackToSoftwareMirroring( |
323 OutputState output_state, | 331 OutputState output_state, |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 scoped_ptr<base::OneShotTimer<OutputConfigurator> > configure_timer_; | 390 scoped_ptr<base::OneShotTimer<OutputConfigurator> > configure_timer_; |
383 | 391 |
384 DISALLOW_COPY_AND_ASSIGN(OutputConfigurator); | 392 DISALLOW_COPY_AND_ASSIGN(OutputConfigurator); |
385 }; | 393 }; |
386 | 394 |
387 typedef std::vector<OutputConfigurator::OutputSnapshot> OutputSnapshotList; | 395 typedef std::vector<OutputConfigurator::OutputSnapshot> OutputSnapshotList; |
388 | 396 |
389 } // namespace chromeos | 397 } // namespace chromeos |
390 | 398 |
391 #endif // CHROMEOS_DISPLAY_OUTPUT_CONFIGURATOR_H_ | 399 #endif // CHROMEOS_DISPLAY_OUTPUT_CONFIGURATOR_H_ |
OLD | NEW |