drm_hwcomposer: Implement getDisplayPhysicalOrientation()
Implement ComposerClient::getDisplayPhysicalOrientation() by querying
the DRM display panel orientation property and translating the result to
the correct common::Transform enum value.
The result is used by SurfaceFlinger to correctly rotate the image
before displaying it to the user.
Signed-off-by: Tim Van Patten <timvp@google.com>
diff --git a/drm/DrmProperty.cpp b/drm/DrmProperty.cpp
index 031918a..0ea9143 100644
--- a/drm/DrmProperty.cpp
+++ b/drm/DrmProperty.cpp
@@ -125,4 +125,22 @@
return true;
}
+std::optional<std::string> DrmProperty::GetEnumNameFromValue(
+ uint64_t value) const {
+ if (enums_.empty()) {
+ ALOGE("No enum values for property: %s", name_.c_str());
+ return {};
+ }
+
+ for (const auto &it : enums_) {
+ if (it.value == value) {
+ return it.name;
+ }
+ }
+
+ ALOGE("Property '%s' has no matching enum for value: %lu", name_.c_str(),
+ value);
+ return {};
+}
+
} // namespace android