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/DrmConnector.h b/drm/DrmConnector.h
index 9186f07..be84ae3 100644
--- a/drm/DrmConnector.h
+++ b/drm/DrmConnector.h
@@ -26,8 +26,7 @@
#include "DrmMode.h"
#include "DrmProperty.h"
#include "DrmUnique.h"
-
-#include "compositor/ColorInfo.h"
+#include "compositor/DisplayInfo.h"
namespace android {
@@ -118,6 +117,10 @@
return writeback_out_fence_;
}
+ auto &GetPanelOrientationProperty() const {
+ return panel_orientation_;
+ }
+
auto IsConnected() const {
return connector_->connection == DRM_MODE_CONNECTED;
}
@@ -130,11 +133,13 @@
return connector_->mmHeight;
};
+ auto GetPanelOrientation() -> std::optional<PanelOrientation>;
+
private:
DrmConnector(DrmModeConnectorUnique connector, DrmDevice *drm, uint32_t index)
: connector_(std::move(connector)),
drm_(drm),
- index_in_res_array_(index){};
+ index_in_res_array_(index) {};
DrmModeConnectorUnique connector_;
DrmDevice *const drm_;
@@ -157,7 +162,9 @@
DrmProperty writeback_pixel_formats_;
DrmProperty writeback_fb_id_;
DrmProperty writeback_out_fence_;
+ DrmProperty panel_orientation_;
std::map<Colorspace, uint64_t> colorspace_enum_map_;
+ std::map<uint64_t, PanelOrientation> panel_orientation_enum_map_;
};
} // namespace android