OSDN Git Service

Force framebuffer target
[android-x86/external-drm_hwcomposer.git] / drmproperty.cpp
index 0acea17..6f65dac 100644 (file)
@@ -33,16 +33,10 @@ DrmProperty::DrmPropertyEnum::~DrmPropertyEnum() {
 }
 
 DrmProperty::DrmProperty(drmModePropertyPtr p, uint64_t value)
-    : id_(0), flags_(0), name_("") {
+    : id_(0), type_(DRM_PROPERTY_TYPE_INVALID), flags_(0), name_("") {
   Init(p, value);
 }
 
-DrmProperty::DrmProperty() : id_(0), flags_(0), name_(""), value_(0) {
-}
-
-DrmProperty::~DrmProperty() {
-}
-
 void DrmProperty::Init(drmModePropertyPtr p, uint64_t value) {
   id_ = p->prop_id;
   flags_ = p->flags;
@@ -62,6 +56,10 @@ void DrmProperty::Init(drmModePropertyPtr p, uint64_t value) {
     type_ = DRM_PROPERTY_TYPE_INT;
   else if (flags_ & DRM_MODE_PROP_ENUM)
     type_ = DRM_PROPERTY_TYPE_ENUM;
+  else if (flags_ & DRM_MODE_PROP_OBJECT)
+    type_ = DRM_PROPERTY_TYPE_OBJECT;
+  else if (flags_ & DRM_MODE_PROP_BLOB)
+    type_ = DRM_PROPERTY_TYPE_BLOB;
 }
 
 uint32_t DrmProperty::id() const {
@@ -73,6 +71,11 @@ std::string DrmProperty::name() const {
 }
 
 int DrmProperty::value(uint64_t *value) const {
+  if (type_ == DRM_PROPERTY_TYPE_BLOB) {
+    *value = value_;
+    return 0;
+  }
+
   if (values_.size() == 0)
     return -ENOENT;
 
@@ -88,6 +91,10 @@ int DrmProperty::value(uint64_t *value) const {
       *value = enums_[value_].value_;
       return 0;
 
+    case DRM_PROPERTY_TYPE_OBJECT:
+      *value = value_;
+      return 0;
+
     default:
       return -EINVAL;
   }