aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Li <benl@squareup.com>2021-05-05 09:23:15 -0700
committerBenjamin Li <benl@squareup.com>2021-05-07 16:28:30 -0700
commit9127dc88344d7c62037b4b4305c9c73da6826981 (patch)
tree07415bced7d39b3edaa432d2b7fdec8252a5a9b4
parent4535e53dc502f06ad5e369cbdc680c753baabd30 (diff)
downloaddrm_hwcomposer-9127dc88344d7c62037b4b4305c9c73da6826981.tar.gz
drm_hwcomposer: add DRM_PROPERTY_TYPE_BITMASK
Bitmask properties are integers that additionally have strings associated with each bit. For example, the "rotation" property's bits are described as "rotate-90", "reflect-x", and so on. The bitmask integer is not actually passed to us -- instead, the interface for enums is used, except that more than one value can be set. This means we must query using the associated strings, rather than use bit index mappings provided as constants in the public kernel header drm_mode.h. Signed-off-by: Benjamin Li <benl@squareup.com>
-rw-r--r--drm/DrmProperty.cpp3
-rw-r--r--drm/DrmProperty.h1
2 files changed, 4 insertions, 0 deletions
diff --git a/drm/DrmProperty.cpp b/drm/DrmProperty.cpp
index 4c5f44f..8e6f7e5 100644
--- a/drm/DrmProperty.cpp
+++ b/drm/DrmProperty.cpp
@@ -57,6 +57,8 @@ void DrmProperty::Init(drmModePropertyPtr p, uint64_t value) {
type_ = DRM_PROPERTY_TYPE_OBJECT;
else if (flags_ & DRM_MODE_PROP_BLOB)
type_ = DRM_PROPERTY_TYPE_BLOB;
+ else if (flags_ & DRM_MODE_PROP_BITMASK)
+ type_ = DRM_PROPERTY_TYPE_BITMASK;
}
uint32_t DrmProperty::id() const {
@@ -87,6 +89,7 @@ std::tuple<int, uint64_t> DrmProperty::value() const {
case DRM_PROPERTY_TYPE_OBJECT:
return std::make_tuple(0, value_);
+ case DRM_PROPERTY_TYPE_BITMASK:
default:
return std::make_tuple(-EINVAL, 0);
}
diff --git a/drm/DrmProperty.h b/drm/DrmProperty.h
index 3f4d15e..70678fd 100644
--- a/drm/DrmProperty.h
+++ b/drm/DrmProperty.h
@@ -30,6 +30,7 @@ enum DrmPropertyType {
DRM_PROPERTY_TYPE_ENUM,
DRM_PROPERTY_TYPE_OBJECT,
DRM_PROPERTY_TYPE_BLOB,
+ DRM_PROPERTY_TYPE_BITMASK,
DRM_PROPERTY_TYPE_INVALID,
};