Skip to contentSkip to conversation

drm_hwcomposer: Add HDMI connector as a valid type

PATCH Applied Rob Herring 2 participants 2 messages Nov 1, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm_hwcomposer: Add HDMI connector as a valid type

From: Robert Foss <[email protected]>

Accept DRM_MODE_CONNECTOR_HDMIA connector type.

Look for primary DrmConnector amongst external connectors after looking for primary amongst internal ones first.

---
This is needed to get dev boards like DB410c to work.

 drmconnector.cpp | 10 +++++++++-
 drmconnector.h   |  4 +++-
 drmresources.cpp | 16 ++++++++++++++--
 3 files changed, 26 insertions(+), 4 deletions(-)
drmconnector.cpp +9 -1
index ccb38e2f00dc..247f56bde748 100644
@@ -67,11 +67,19 @@ void DrmConnector::set_display(int display) {
   display_ = display;
 }
 
-bool DrmConnector::built_in() const {
+bool DrmConnector::internal() const {
   return type_ == DRM_MODE_CONNECTOR_LVDS || type_ == DRM_MODE_CONNECTOR_eDP ||
          type_ == DRM_MODE_CONNECTOR_DSI || type_ == DRM_MODE_CONNECTOR_VIRTUAL;
 }
 
+bool DrmConnector::external() const {
+  return type_ == DRM_MODE_CONNECTOR_HDMIA;
+}
+
+bool DrmConnector::valid_type() const {
+  return internal() || external();
+}
+
 int DrmConnector::UpdateModes() {
   int fd = drm_->fd();
 
drmconnector.h +3 -1
index e1488bb42a9a..5601e069f003 100644
@@ -44,7 +44,9 @@ class DrmConnector {
   int display() const;
   void set_display(int display);
 
-  bool built_in() const;
+  bool internal() const;
+  bool external() const;
+  bool valid_type() const;
 
   int UpdateModes();
 
drmresources.cpp +14 -2
index 67a853c587b3..32dd37636e73 100644
@@ -154,16 +154,28 @@ int DrmResources::Init() {
       break;
     }
 
-    if (conn->built_in() && !found_primary) {
+    connectors_.emplace_back(std::move(conn));
+  }
+
+  // First look for primary amongst internal connectors
+  for (auto &conn : connectors_) {
+    if (conn->internal() && !found_primary) {
       conn->set_display(0);
       found_primary = true;
     } else {
       conn->set_display(display_num);
       ++display_num;
     }
+  }
 
-    connectors_.emplace_back(std::move(conn));
+  // Then look for primary amongst external connectors
+  for (auto &conn : connectors_) {
+    if (conn->external() && !found_primary) {
+      conn->set_display(0);
+      found_primary = true;
+    }
   }
+
   if (res)
     drmModeFreeResources(res);
 
Signature · 6 lines
2.14.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Applied
#1 lore raw

Hi Rob,

Pushed to master.

Rob.

Quoted 84 lines · Rob Herring

From: Robert Foss <[email protected]>

Accept DRM_MODE_CONNECTOR_HDMIA connector type.

Look for primary DrmConnector amongst external connectors after looking for primary amongst internal ones first.

---
This is needed to get dev boards like DB410c to work.

 drmconnector.cpp | 10 +++++++++-
 drmconnector.h   |  4 +++-
 drmresources.cpp | 16 ++++++++++++++--
 3 files changed, 26 insertions(+), 4 deletions(-)
drmconnector.cpp +1 -1
index ccb38e2f00dc..247f56bde748 100644
@@ -67,11 +67,19 @@ void DrmConnector::set_display(int display) {
   display_ = display;
 }
 
-bool DrmConnector::built_in() const {
+bool DrmConnector::internal() const {
   return type_ == DRM_MODE_CONNECTOR_LVDS || type_ ==

DRM_MODE_CONNECTOR_eDP ||

          type_ == DRM_MODE_CONNECTOR_DSI || type_ ==

DRM_MODE_CONNECTOR_VIRTUAL;
}

drmconnector.cpp +8 -0
+bool DrmConnector::external() const {
+  return type_ == DRM_MODE_CONNECTOR_HDMIA;
+}
+
+bool DrmConnector::valid_type() const {
+  return internal() || external();
+}
+
 int DrmConnector::UpdateModes() {
   int fd = drm_->fd();
drmconnector.h +3 -1
index e1488bb42a9a..5601e069f003 100644
@@ -44,7 +44,9 @@ class DrmConnector {
   int display() const;
   void set_display(int display);
 
-  bool built_in() const;
+  bool internal() const;
+  bool external() const;
+  bool valid_type() const;
 
   int UpdateModes();
 
drmresources.cpp +8 -2
index 67a853c587b3..32dd37636e73 100644
@@ -154,16 +154,28 @@ int DrmResources::Init() {
       break;
     }
 
-    if (conn->built_in() && !found_primary) {
+    connectors_.emplace_back(std::move(conn));
+  }
+
+  // First look for primary amongst internal connectors
+  for (auto &conn : connectors_) {
+    if (conn->internal() && !found_primary) {
       conn->set_display(0);
       found_primary = true;
     } else {
       conn->set_display(display_num);
       ++display_num;
     }
+  }
 
-    connectors_.emplace_back(std::move(conn));
+  // Then look for primary amongst external connectors

drmresources.cpp int DrmResources::Init() { · line 181

Quoted 10 lines
drmresources.cpp +6 -0
+  for (auto &conn : connectors_) {
+    if (conn->external() && !found_primary) {
+      conn->set_display(0);
+      found_primary = true;
+    }
   }
+
   if (res)
     drmModeFreeResources(res);
 

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel