drm_hwcomposer: Add supported formats list to DrmPlane
There are some use-cases for checking formats supported by given
plane. drmModePlane already contains reqired data, so it simply could
be saved into DrmPlane, no need to query any additional stuff.
Signed-off-by: Roman Kovalivskyi <roman.kovalivskyi@globallogic.com>
diff --git a/drm/DrmPlane.cpp b/drm/DrmPlane.cpp
index 1fb1316..f994252 100644
--- a/drm/DrmPlane.cpp
+++ b/drm/DrmPlane.cpp
@@ -29,7 +29,10 @@
namespace android {
DrmPlane::DrmPlane(DrmDevice *drm, drmModePlanePtr p)
- : drm_(drm), id_(p->plane_id), possible_crtc_mask_(p->possible_crtcs) {
+ : drm_(drm),
+ id_(p->plane_id),
+ possible_crtc_mask_(p->possible_crtcs),
+ formats_(p->formats, p->formats + p->count_formats) {
}
int DrmPlane::Init() {
@@ -153,6 +156,11 @@
return type_;
}
+bool DrmPlane::IsFormatSupported(uint32_t format) const {
+ return std::find(std::begin(formats_), std::end(formats_), format) !=
+ std::end(formats_);
+}
+
const DrmProperty &DrmPlane::crtc_property() const {
return crtc_property_;
}