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 size_t* width, |
| 123 size_t* 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 24 matching lines...) Expand all Loading... |
151 // Flushes all pending requests and waits for replies. | 158 // Flushes all pending requests and waits for replies. |
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 virtual std::vector<OutputSnapshot> GetOutputs() = 0; | 168 virtual std::vector<OutputSnapshot> GetOutputs( |
| 169 const StateController* state_controller) = 0; |
162 | 170 |
163 // Gets details corresponding to |mode|. Parameters may be NULL. | 171 // Gets details corresponding to |mode|. Parameters may be NULL. |
164 // Returns true on success. | 172 // Returns true on success. |
165 virtual bool GetModeDetails(RRMode mode, | 173 virtual bool GetModeDetails(RRMode mode, |
166 int* width, | 174 int* width, |
167 int* height, | 175 int* height, |
168 bool* interlaced) = 0; | 176 bool* interlaced) = 0; |
169 | 177 |
170 // Calls XRRSetCrtcConfig() with the given options but some of our | 178 // Calls XRRSetCrtcConfig() with the given options but some of our |
171 // default output count and rotation arguments. | 179 // default output count and rotation arguments. |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 void SuspendDisplays(); | 303 void SuspendDisplays(); |
296 | 304 |
297 // Reprobes displays to handle changes made while the system was | 305 // Reprobes displays to handle changes made while the system was |
298 // suspended. | 306 // suspended. |
299 void ResumeDisplays(); | 307 void ResumeDisplays(); |
300 | 308 |
301 const std::map<int, float>& GetMirroredDisplayAreaRatioMap() { | 309 const std::map<int, float>& GetMirroredDisplayAreaRatioMap() { |
302 return mirrored_display_area_ratio_map_; | 310 return mirrored_display_area_ratio_map_; |
303 } | 311 } |
304 | 312 |
| 313 // Configure outputs with |kConfigureDelayMs| delay, |
| 314 // so that time-consuming ConfigureOutputs() won't be called multiple times. |
| 315 void ScheduleConfigureOutputs(); |
| 316 |
305 private: | 317 private: |
306 // Configure outputs. | 318 // Configure outputs. |
307 void ConfigureOutputs(); | 319 void ConfigureOutputs(); |
308 | 320 |
309 // Configure outputs with |kConfigureDelayMs| delay, | |
310 // so that time-consuming ConfigureOutputs() won't be called multiple times. | |
311 void ScheduleConfigureOutputs(); | |
312 | |
313 // Fires OnDisplayModeChanged() event to the observers. | 321 // Fires OnDisplayModeChanged() event to the observers. |
314 void NotifyOnDisplayChanged(); | 322 void NotifyOnDisplayChanged(); |
315 | 323 |
316 // Switches to the state specified in |output_state| and |power_state|. | 324 // Switches to the state specified in |output_state| and |power_state|. |
317 // If the hardware mirroring failed and |mirroring_controller_| is set, | 325 // If the hardware mirroring failed and |mirroring_controller_| is set, |
318 // it switches to |STATE_DUAL_EXTENDED| and calls |SetSoftwareMirroring()| | 326 // it switches to |STATE_DUAL_EXTENDED| and calls |SetSoftwareMirroring()| |
319 // to enable software based mirroing. | 327 // to enable software based mirroing. |
320 // On success, updates |output_state_| and |power_state_| and returns true. | 328 // On success, updates |output_state_| and |power_state_| and returns true. |
321 bool EnterStateOrFallBackToSoftwareMirroring( | 329 bool EnterStateOrFallBackToSoftwareMirroring( |
322 OutputState output_state, | 330 OutputState output_state, |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 scoped_ptr<base::OneShotTimer<OutputConfigurator> > configure_timer_; | 389 scoped_ptr<base::OneShotTimer<OutputConfigurator> > configure_timer_; |
382 | 390 |
383 DISALLOW_COPY_AND_ASSIGN(OutputConfigurator); | 391 DISALLOW_COPY_AND_ASSIGN(OutputConfigurator); |
384 }; | 392 }; |
385 | 393 |
386 typedef std::vector<OutputConfigurator::OutputSnapshot> OutputSnapshotList; | 394 typedef std::vector<OutputConfigurator::OutputSnapshot> OutputSnapshotList; |
387 | 395 |
388 } // namespace chromeos | 396 } // namespace chromeos |
389 | 397 |
390 #endif // CHROMEOS_DISPLAY_OUTPUT_CONFIGURATOR_H_ | 398 #endif // CHROMEOS_DISPLAY_OUTPUT_CONFIGURATOR_H_ |
OLD | NEW |