external/drm_hwcomposer
Révision | 2c0e2c3e7d7695fe010da66c46bdc031aad0c2cd (tree) |
---|---|
l'heure | 2018-11-02 16:06:13 |
Auteur | Mauro Rossi <issor.oruam@gmai...> |
Commiter | Chih-Wei Huang |
Take Connection state into account. (v2)
(v2) porting of original commit 76fb87e675 of android-ia master
with additional external connector types and removal of redundant HDMIA internal
(v1) There are various places where we should be really taking connection
state into account before querying the properties or assuming it
as primary. This patch fixes them.
BUG=None.
TEST=System boots up and shows UI.
(v1) Signed-off-by: Jim Bish <jim.bish@intel.com>
@@ -69,8 +69,7 @@ void DrmConnector::set_display(int display) { | ||
69 | 69 | |
70 | 70 | bool DrmConnector::internal() const { |
71 | 71 | return type_ == DRM_MODE_CONNECTOR_LVDS || type_ == DRM_MODE_CONNECTOR_eDP || |
72 | - type_ == DRM_MODE_CONNECTOR_DSI || type_ == DRM_MODE_CONNECTOR_VIRTUAL || | |
73 | - type_ == DRM_MODE_CONNECTOR_HDMIA; | |
72 | + type_ == DRM_MODE_CONNECTOR_DSI || type_ == DRM_MODE_CONNECTOR_VIRTUAL; | |
74 | 73 | } |
75 | 74 | |
76 | 75 | bool DrmConnector::external() const { |
@@ -159,7 +159,7 @@ int DrmResources::Init() { | ||
159 | 159 | |
160 | 160 | // First look for primary amongst internal connectors |
161 | 161 | for (auto &conn : connectors_) { |
162 | - if (conn->internal() && !found_primary) { | |
162 | + if (conn->state() == DRM_MODE_CONNECTED && conn->internal() && !found_primary) { | |
163 | 163 | conn->set_display(0); |
164 | 164 | found_primary = true; |
165 | 165 | } else { |
@@ -170,7 +170,7 @@ int DrmResources::Init() { | ||
170 | 170 | |
171 | 171 | // Then look for primary amongst external connectors |
172 | 172 | for (auto &conn : connectors_) { |
173 | - if (conn->external() && !found_primary) { | |
173 | + if (conn->state() == DRM_MODE_CONNECTED && conn->external() && !found_primary) { | |
174 | 174 | conn->set_display(0); |
175 | 175 | found_primary = true; |
176 | 176 | } |
@@ -292,6 +292,11 @@ int DrmResources::TryEncoderForDisplay(int display, DrmEncoder *enc) { | ||
292 | 292 | |
293 | 293 | int DrmResources::CreateDisplayPipe(DrmConnector *connector) { |
294 | 294 | int display = connector->display(); |
295 | + | |
296 | + // skip not connected | |
297 | + if (connector->state() == DRM_MODE_DISCONNECTED) | |
298 | + return 0; | |
299 | + | |
295 | 300 | /* Try to use current setup first */ |
296 | 301 | if (connector->encoder()) { |
297 | 302 | int ret = TryEncoderForDisplay(display, connector->encoder()); |