All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH hwc] drm_hwcomposer: Add HDMI connector as a valid type
@ 2017-11-01 17:50 Rob Herring
  2017-11-01 18:06 ` Robert Foss
  0 siblings, 1 reply; 2+ messages in thread
From: Rob Herring @ 2017-11-01 17:50 UTC (permalink / raw)
  To: dri-devel; +Cc: Robert Foss

From: Robert Foss <robert.foss@collabora.com>

Accept DRM_MODE_CONNECTOR_HDMIA connector type.

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

Signed-off-by: Robert Foss <robert.foss@collabora.com>
Signed-off-by: Rob Herring <robh@kernel.org>
---
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(-)

diff --git a/drmconnector.cpp b/drmconnector.cpp
index ccb38e2f00dc..247f56bde748 100644
--- a/drmconnector.cpp
+++ b/drmconnector.cpp
@@ -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();
 
diff --git a/drmconnector.h b/drmconnector.h
index e1488bb42a9a..5601e069f003 100644
--- a/drmconnector.h
+++ b/drmconnector.h
@@ -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();
 
diff --git a/drmresources.cpp b/drmresources.cpp
index 67a853c587b3..32dd37636e73 100644
--- a/drmresources.cpp
+++ b/drmresources.cpp
@@ -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);
 
-- 
2.14.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH hwc] drm_hwcomposer: Add HDMI connector as a valid type
  2017-11-01 17:50 [PATCH hwc] drm_hwcomposer: Add HDMI connector as a valid type Rob Herring
@ 2017-11-01 18:06 ` Robert Foss
  0 siblings, 0 replies; 2+ messages in thread
From: Robert Foss @ 2017-11-01 18:06 UTC (permalink / raw)
  To: Rob Herring, dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 2866 bytes --]

Hi Rob,

Pushed to master.


Rob.

On Wed, 2017-11-01 at 12:50 -0500, Rob Herring wrote:
> From: Robert Foss <robert.foss@collabora.com>
> 
> Accept DRM_MODE_CONNECTOR_HDMIA connector type.
> 
> Look for primary DrmConnector amongst external connectors
> after looking for primary amongst internal ones first.
> 
> Signed-off-by: Robert Foss <robert.foss@collabora.com>
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
> 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(-)
> 
> diff --git a/drmconnector.cpp b/drmconnector.cpp
> index ccb38e2f00dc..247f56bde748 100644
> --- a/drmconnector.cpp
> +++ b/drmconnector.cpp
> @@ -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();
>  
> diff --git a/drmconnector.h b/drmconnector.h
> index e1488bb42a9a..5601e069f003 100644
> --- a/drmconnector.h
> +++ b/drmconnector.h
> @@ -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();
>  
> diff --git a/drmresources.cpp b/drmresources.cpp
> index 67a853c587b3..32dd37636e73 100644
> --- a/drmresources.cpp
> +++ b/drmresources.cpp
> @@ -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);
>  

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-11-01 18:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-01 17:50 [PATCH hwc] drm_hwcomposer: Add HDMI connector as a valid type Rob Herring
2017-11-01 18:06 ` Robert Foss

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.