diff options
author | Tomi Valkeinen <tomi.valkeinen@iki.fi> | 2015-10-03 17:45:41 +0300 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@iki.fi> | 2015-10-03 17:49:26 +0300 |
commit | 624dadeeda877972969f2d9096301fcc652822ea (patch) | |
tree | 047410be42e1a941626596d414ae1640253ddb0c | |
parent | 4d1671bc8a3b429ac2c92969dd35ace75dbf8269 (diff) |
Add DrmObject::set_id()
-rw-r--r-- | libkms++/drmobject.cpp | 9 | ||||
-rw-r--r-- | libkms++/drmobject.h | 7 | ||||
-rw-r--r-- | libkms++/dumbframebuffer.cpp | 2 | ||||
-rw-r--r-- | libkms++/extframebuffer.cpp | 3 |
4 files changed, 15 insertions, 6 deletions
diff --git a/libkms++/drmobject.cpp b/libkms++/drmobject.cpp index f48153a..69ea86e 100644 --- a/libkms++/drmobject.cpp +++ b/libkms++/drmobject.cpp @@ -11,12 +11,12 @@ namespace kms { DrmObject::DrmObject(Card& card, uint32_t object_type) - :m_id(-1), m_card(card), m_object_type(object_type) + :m_card(card), m_id(-1), m_object_type(object_type) { } DrmObject::DrmObject(Card& card, uint32_t id, uint32_t object_type, uint32_t idx) - :m_id(id), m_card(card), m_object_type(object_type), m_idx(idx) + :m_card(card), m_id(id), m_object_type(object_type), m_idx(idx) { refresh_props(); } @@ -66,4 +66,9 @@ uint64_t DrmObject::get_prop_value(const char *name) const throw invalid_argument(string(name) + ": property not found"); } + +void DrmObject::set_id(uint32_t id) +{ + m_id = id; +} } diff --git a/libkms++/drmobject.h b/libkms++/drmobject.h index 5c945f9..6c3062c 100644 --- a/libkms++/drmobject.h +++ b/libkms++/drmobject.h @@ -33,12 +33,15 @@ public: uint64_t get_prop_value(const char *name) const; protected: - uint32_t m_id; // protected for Framebuffer... + virtual void set_id(uint32_t id); private: Card& m_card; - std::map<uint32_t, uint64_t> m_prop_values; + + uint32_t m_id; uint32_t m_object_type; uint32_t m_idx; + + std::map<uint32_t, uint64_t> m_prop_values; }; } diff --git a/libkms++/dumbframebuffer.cpp b/libkms++/dumbframebuffer.cpp index 8e77604..285803f 100644 --- a/libkms++/dumbframebuffer.cpp +++ b/libkms++/dumbframebuffer.cpp @@ -136,7 +136,7 @@ void DumbFramebuffer::Create(uint32_t width, uint32_t height, uint32_t format) if (r) throw std::invalid_argument("foo"); - m_id = id; + set_id(id); } void DumbFramebuffer::Destroy() diff --git a/libkms++/extframebuffer.cpp b/libkms++/extframebuffer.cpp index de9d737..8b0af9f 100644 --- a/libkms++/extframebuffer.cpp +++ b/libkms++/extframebuffer.cpp @@ -19,7 +19,8 @@ ExtFramebuffer::ExtFramebuffer(Card& card, uint32_t width, uint32_t height, uint int r = drmModeAddFB(card.fd(), width, height, depth, bpp, stride, handle, &id); if (r) throw invalid_argument("fob"); - m_id = id; + + set_id(id); } ExtFramebuffer::~ExtFramebuffer() |