drm_hwcomposer: Add backend-dependent validation for HwcDisplay class
Different DRM/KMS backends have a variable set of limitations, which is
not always exposed via DRM ioctls.
This implementation of backend-dependent validation provides a register
of platform-specific inherited backend class to the map by BackendManager
class. ValidateDisplay function is moved to generic backend
implementantion and separated into 2 additional methods.
The map key is a string that contains the corresponding DRM driver name.
During DrmHwcTwo class initialization the vendor.hwc.backend_override
system property and driver name will be checked and a backend will be set
for the appropriate display. If the map does not have any backend for the
named driver, the generic backend will be used.
Signed-off-by: Matvii Zorin <matvii.zorin@globallogic.com>
diff --git a/drm/drmdevice.cpp b/drm/drmdevice.cpp
index d7fd2f2..91fe158 100644
--- a/drm/drmdevice.cpp
+++ b/drm/drmdevice.cpp
@@ -570,4 +570,16 @@
return GetProperty(connector.id(), DRM_MODE_OBJECT_CONNECTOR, prop_name,
property);
}
+
+const std::string DrmDevice::GetName() const {
+ auto ver = drmGetVersion(fd_.get());
+ if (!ver) {
+ ALOGW("Failed to get drm version for fd=%d", fd_.get());
+ return "generic";
+ }
+
+ std::string name(ver->name);
+ drmFreeVersion(ver);
+ return name;
+}
} // namespace android