drm_hwcomposer: support more connector types
according to the drm_connector_enum_list defined
in the kernel file drivers/gpu/drm/drm_connector.c
Otherwise for the new connector type, the connector
name will be "None" to be printed in the logcat, like this:
12-13 05:38:06.263 383 383 I hwc-backend: Backend 'generic' for 'None' and driver 'omapdrm' was successfully set
with this change, it will be fixed with the connector type like this:
12-13 06:01:57.672 342 342 I hwc-backend: Backend 'generic' for 'DPI-1' and driver 'omapdrm' was successfully set
Also updated the internal() and external() functions
to make the newly added SPI and USB are valid types
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
diff --git a/drm/DrmConnector.cpp b/drm/DrmConnector.cpp
index 5b3c697..32b6d24 100644
--- a/drm/DrmConnector.cpp
+++ b/drm/DrmConnector.cpp
@@ -28,9 +28,17 @@
#include "DrmDevice.h"
#include "utils/log.h"
+#ifndef DRM_MODE_CONNECTOR_SPI
+#define DRM_MODE_CONNECTOR_SPI 19
+#endif
+
+#ifndef DRM_MODE_CONNECTOR_USB
+#define DRM_MODE_CONNECTOR_USB 20
+#endif
+
namespace android {
-constexpr size_t kTypesCount = 17;
+constexpr size_t kTypesCount = 21;
DrmConnector::DrmConnector(DrmDevice *drm, drmModeConnectorPtr c,
DrmEncoder *current_encoder,
@@ -120,14 +128,15 @@
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 || type_ == DRM_MODE_CONNECTOR_DPI;
+ type_ == DRM_MODE_CONNECTOR_VIRTUAL ||
+ type_ == DRM_MODE_CONNECTOR_DPI || type_ == DRM_MODE_CONNECTOR_SPI;
}
bool DrmConnector::external() const {
return type_ == DRM_MODE_CONNECTOR_HDMIA ||
type_ == DRM_MODE_CONNECTOR_DisplayPort ||
type_ == DRM_MODE_CONNECTOR_DVID || type_ == DRM_MODE_CONNECTOR_DVII ||
- type_ == DRM_MODE_CONNECTOR_VGA;
+ type_ == DRM_MODE_CONNECTOR_VGA || type_ == DRM_MODE_CONNECTOR_USB;
}
bool DrmConnector::writeback() const {
@@ -144,9 +153,10 @@
std::string DrmConnector::name() const {
constexpr std::array<const char *, kTypesCount> kNames =
- {"None", "VGA", "DVI-I", "DVI-D", "DVI-A", "Composite",
- "SVIDEO", "LVDS", "Component", "DIN", "DP", "HDMI-A",
- "HDMI-B", "TV", "eDP", "Virtual", "DSI"};
+ {"None", "VGA", "DVI-I", "DVI-D", "DVI-A", "Composite",
+ "SVIDEO", "LVDS", "Component", "DIN", "DP", "HDMI-A",
+ "HDMI-B", "TV", "eDP", "Virtual", "DSI", "DPI",
+ "Writeback", "SPI", "USB"};
if (type_ < kTypesCount) {
std::ostringstream name_buf;