summaryrefslogtreecommitdiff
path: root/kms++/drmpropobject.cpp
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2016-06-11 21:46:24 +0300
committerTomi Valkeinen <tomi.valkeinen@ti.com>2016-06-11 21:46:24 +0300
commit9916712a62169606d845510028a3ea6f84bd442f (patch)
treeaca4e1bec39500812111c43a8ecee862edae0002 /kms++/drmpropobject.cpp
parent736b295100ce441e800457bcbd08cb36db543ff2 (diff)
kms++: organize into subdirs
Diffstat (limited to 'kms++/drmpropobject.cpp')
-rw-r--r--kms++/drmpropobject.cpp86
1 files changed, 0 insertions, 86 deletions
diff --git a/kms++/drmpropobject.cpp b/kms++/drmpropobject.cpp
deleted file mode 100644
index 50f87a7..0000000
--- a/kms++/drmpropobject.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-#include <string.h>
-#include <iostream>
-#include <stdexcept>
-
-#include <xf86drm.h>
-#include <xf86drmMode.h>
-
-#include "kms++.h"
-
-using namespace std;
-
-namespace kms
-{
-
-DrmPropObject::DrmPropObject(Card& card, uint32_t object_type)
- : DrmObject(card, object_type)
-{
-}
-
-DrmPropObject::DrmPropObject(Card& card, uint32_t id, uint32_t object_type, uint32_t idx)
- : DrmObject(card, id, object_type, idx)
-{
- refresh_props();
-}
-
-DrmPropObject::~DrmPropObject()
-{
-
-}
-
-void DrmPropObject::refresh_props()
-{
- auto props = drmModeObjectGetProperties(card().fd(), this->id(), this->object_type());
-
- if (props == nullptr)
- return;
-
- for (unsigned i = 0; i < props->count_props; ++i) {
- uint32_t prop_id = props->props[i];
- uint64_t prop_value = props->prop_values[i];
-
- m_prop_values[prop_id] = prop_value;
- }
-
- drmModeFreeObjectProperties(props);
-}
-
-uint64_t DrmPropObject::get_prop_value(uint32_t id) const
-{
- return m_prop_values.at(id);
-}
-
-uint64_t DrmPropObject::get_prop_value(const string& name) const
-{
- for (auto pair : m_prop_values) {
- auto prop = card().get_prop(pair.first);
- if (name == prop->name())
- return m_prop_values.at(prop->id());
- }
-
- throw invalid_argument("property not found: " + name);
-}
-
-unique_ptr<Blob> DrmPropObject::get_prop_value_as_blob(const string& name) const
-{
- uint32_t blob_id = (uint32_t)get_prop_value(name);
-
- return unique_ptr<Blob>(new Blob(card(), blob_id));
-}
-
-int DrmPropObject::set_prop_value(uint32_t id, uint64_t value)
-{
- return drmModeObjectSetProperty(card().fd(), this->id(), this->object_type(), id, value);
-}
-
-int DrmPropObject::set_prop_value(const string &name, uint64_t value)
-{
- Property* prop = card().get_prop(name);
-
- if (prop == nullptr)
- throw invalid_argument("property not found: " + name);
-
- return set_prop_value(prop->id(), value);
-}
-
-}