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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 virtual void OnDisplayModeChangeFailed(OutputState failed_new_state) {} | 71 virtual void OnDisplayModeChangeFailed(OutputState failed_new_state) {} |
72 }; | 72 }; |
73 | 73 |
74 class Delegate { | 74 class Delegate { |
75 public: | 75 public: |
76 // Called when displays are detected. | 76 // Called when displays are detected. |
77 virtual OutputState GetStateForOutputs( | 77 virtual OutputState GetStateForOutputs( |
78 const std::vector<OutputInfo>& outputs) const = 0; | 78 const std::vector<OutputInfo>& outputs) const = 0; |
79 }; | 79 }; |
80 | 80 |
| 81 // Flags that can be passed to SetDisplayPower(). |
| 82 static const int kSetDisplayPowerNoFlags = 0; |
| 83 // Configure displays even if the passed-in state matches |power_state_|. |
| 84 static const int kSetDisplayPowerForceProbe = 1 << 0; |
| 85 // Do not change the state if multiple displays are connected or if the |
| 86 // only connected display is external. |
| 87 static const int kSetDisplayPowerOnlyIfSingleInternalDisplay = 1 << 1; |
| 88 |
81 OutputConfigurator(); | 89 OutputConfigurator(); |
82 virtual ~OutputConfigurator(); | 90 virtual ~OutputConfigurator(); |
83 | 91 |
84 int connected_output_count() const { return connected_output_count_; } | 92 int connected_output_count() const { return connected_output_count_; } |
85 | 93 |
86 OutputState output_state() const { return output_state_; } | 94 OutputState output_state() const { return output_state_; } |
87 | 95 |
88 void set_display_power_state(DisplayPowerState power_state) { | 96 void set_display_power_state(DisplayPowerState power_state) { |
89 power_state_ = power_state; | 97 power_state_ = power_state; |
90 } | 98 } |
(...skipping 10 matching lines...) Expand all Loading... |
101 | 109 |
102 // Detects displays first time from unknown state. | 110 // Detects displays first time from unknown state. |
103 void Start(); | 111 void Start(); |
104 | 112 |
105 // Stop handling display configuration events/requests. | 113 // Stop handling display configuration events/requests. |
106 void Stop(); | 114 void Stop(); |
107 | 115 |
108 // Called when powerd notifies us that some set of displays should be turned | 116 // Called when powerd notifies us that some set of displays should be turned |
109 // on or off. This requires enabling or disabling the CRTC associated with | 117 // on or off. This requires enabling or disabling the CRTC associated with |
110 // the display(s) in question so that the low power state is engaged. | 118 // the display(s) in question so that the low power state is engaged. |
111 // If |force_probe| is true, the displays will be configured even if | 119 // |flags| contains bitwise-or-ed kSetDisplayPower* values. |
112 // |power_state| matches |power_state_|. | 120 bool SetDisplayPower(DisplayPowerState power_state, int flags); |
113 bool SetDisplayPower(DisplayPowerState power_state, bool force_probe); | |
114 | 121 |
115 // Force switching the display mode to |new_state|. Returns false if | 122 // Force switching the display mode to |new_state|. Returns false if |
116 // it was called in a single-head or headless mode. | 123 // it was called in a single-head or headless mode. |
117 bool SetDisplayMode(OutputState new_state); | 124 bool SetDisplayMode(OutputState new_state); |
118 | 125 |
119 // Called when an RRNotify event is received. The implementation is | 126 // Called when an RRNotify event is received. The implementation is |
120 // interested in the cases of RRNotify events which correspond to output | 127 // interested in the cases of RRNotify events which correspond to output |
121 // add/remove events. Note that Output add/remove events are sent in response | 128 // add/remove events. Note that Output add/remove events are sent in response |
122 // to our own reconfiguration operations so spurious events are common. | 129 // to our own reconfiguration operations so spurious events are common. |
123 // Spurious events will have no effect. | 130 // Spurious events will have no effect. |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 | 260 |
254 // Indicates the time at which |output_state_| was entered. | 261 // Indicates the time at which |output_state_| was entered. |
255 base::TimeTicks last_enter_state_time_; | 262 base::TimeTicks last_enter_state_time_; |
256 | 263 |
257 DISALLOW_COPY_AND_ASSIGN(OutputConfigurator); | 264 DISALLOW_COPY_AND_ASSIGN(OutputConfigurator); |
258 }; | 265 }; |
259 | 266 |
260 } // namespace chromeos | 267 } // namespace chromeos |
261 | 268 |
262 #endif // CHROMEOS_DISPLAY_OUTPUT_CONFIGURATOR_H_ | 269 #endif // CHROMEOS_DISPLAY_OUTPUT_CONFIGURATOR_H_ |
OLD | NEW |