summaryrefslogtreecommitdiff
path: root/libkms++
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2015-11-06 22:19:44 +0200
committerTomi Valkeinen <tomi.valkeinen@ti.com>2015-11-06 22:19:44 +0200
commitd0c7d0826f14b37ce06582eb3cb20915275caea5 (patch)
treeebe777a00cded84959ea21a3a97d7995f75ff7bb /libkms++
parent7dd018ab42a055a5c3d3c3c3d64690a48a1feb80 (diff)
card: use object vectors
Diffstat (limited to 'libkms++')
-rw-r--r--libkms++/card.cpp19
-rw-r--r--libkms++/card.h2
2 files changed, 5 insertions, 16 deletions
diff --git a/libkms++/card.cpp b/libkms++/card.cpp
index 038d494..06a237f 100644
--- a/libkms++/card.cpp
+++ b/libkms++/card.cpp
@@ -153,11 +153,7 @@ void Card::print_short() const
Property* Card::get_prop(const string& name) const
{
- for (auto pair : m_obmap) {
- auto prop = dynamic_cast<Property*>(pair.second);
- if (!prop)
- continue;
-
+ for (auto prop : m_properties) {
if (name == prop->name())
return prop;
}
@@ -167,10 +163,8 @@ Property* Card::get_prop(const string& name) const
Connector* Card::get_first_connected_connector() const
{
- for(auto pair : m_obmap) {
- auto c = dynamic_cast<Connector*>(pair.second);
-
- if (c && c->connected())
+ for(auto c : m_connectors) {
+ if (c->connected())
return c;
}
@@ -192,12 +186,7 @@ const vector<DrmObject*> Card::get_objects() const
Crtc* Card::get_crtc_by_index(uint32_t idx) const
{
- for(auto pair : m_obmap) {
- auto crtc = dynamic_cast<Crtc*>(pair.second);
- if (crtc && crtc->idx() == idx)
- return crtc;
- }
- throw invalid_argument(string("Crtc #") + to_string(idx) + " not found");
+ return m_crtcs[idx];
}
Connector* Card::get_connector(uint32_t id) const { return dynamic_cast<Connector*>(get_object(id)); }
diff --git a/libkms++/card.h b/libkms++/card.h
index cfc1cf2..7232467 100644
--- a/libkms++/card.h
+++ b/libkms++/card.h
@@ -27,9 +27,9 @@ public:
Crtc* get_crtc(uint32_t id) const;
Crtc* get_crtc_by_index(uint32_t idx) const;
Encoder* get_encoder(uint32_t id) const;
+ Plane* get_plane(uint32_t id) const;
Property* get_prop(uint32_t id) const;
Property* get_prop(const std::string& name) const;
- Plane* get_plane(uint32_t id) const;
bool master() const { return m_master; }
bool has_atomic() const { return m_has_atomic; }