summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Foss <robert.foss@collabora.com>2016-01-12 15:41:53 -0600
committerRobert Foss <robert.foss@collabora.com>2017-03-13 17:27:57 -0400
commitc657bc178b3a7aa6706f5aef50f75d156926a89e (patch)
treec1d4d15f4793534f250715eb8992d72c6f917ce3
parentf7e78bf459d48deea7a2c530dfeaaaddcf4b63de (diff)
downloaddrm_hwcomposer-hwc2_fence_v3.tar.gz
drm_hwcomposer-hwc2_fence_v3.tar.xz
drm_hwcomposer: Add HDMI connector as a valid typehwc2_fence_v3
Accept DRM_MODE_CONNECTOR_HDMIA connector type. Look for primary DrmConnector amongst external connectors after looking for primary amongst internal ones first. Change-Id: I494bc5759cc699a83611374d3650d0c8625fedfb Signed-off-by: Robert Foss <robert.foss@collabora.com>
-rw-r--r--drmconnector.cpp10
-rw-r--r--drmconnector.h4
-rw-r--r--drmresources.cpp16
3 files changed, 26 insertions, 4 deletions
diff --git a/drmconnector.cpp b/drmconnector.cpp
index 38b4f9b..a71683f 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 e1488bb..5601e06 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 0578cc6..17c912a 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);