summaryrefslogtreecommitdiff
path: root/libkms++
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2015-09-30 17:02:35 +0300
committerTomi Valkeinen <tomi.valkeinen@ti.com>2015-09-30 17:02:35 +0300
commit54f21250fdded59e953405291f1778ecc77dd368 (patch)
treeca53099e253d58d91f9affa37b6ff4b6a16b6843 /libkms++
parent72b165a535a4efcb83e8e90639e040c53010dabe (diff)
parented9cb183b240702f74477351cada83d59da3144b (diff)
Merge branch 'master' of git://github.com/jsarha/kmsxx
Diffstat (limited to 'libkms++')
-rw-r--r--libkms++/card.cpp12
-rw-r--r--libkms++/connector.cpp7
-rw-r--r--libkms++/connector.h2
-rw-r--r--libkms++/drmobject.cpp2
4 files changed, 12 insertions, 11 deletions
diff --git a/libkms++/card.cpp b/libkms++/card.cpp
index 626c424..52a0f7a 100644
--- a/libkms++/card.cpp
+++ b/libkms++/card.cpp
@@ -26,8 +26,8 @@ Card::Card()
int fd = open(card, O_RDWR | O_CLOEXEC);
if (fd < 0)
- throw invalid_argument((string(strerror(errno)) +
- " opening " + card).c_str());
+ throw invalid_argument(string(strerror(errno)) + " opening " +
+ card);
m_fd = fd;
int r;
@@ -136,7 +136,7 @@ Property* Card::get_prop(const char *name) const
return prop;
}
- throw invalid_argument("foo");
+ throw invalid_argument(string("Card property ") + name + " not found");
}
Connector* Card::get_first_connected_connector() const
@@ -193,7 +193,7 @@ Crtc* Card::get_crtc_by_index(uint32_t idx) const
if (crtc && crtc->idx() == idx)
return crtc;
}
- throw invalid_argument("fob");
+ throw invalid_argument(string("Crtc #") + to_string(idx) + "not found");
}
Crtc* Card::get_crtc(uint32_t id) const { return dynamic_cast<Crtc*>(get_object(id)); }
@@ -221,7 +221,9 @@ std::vector<kms::Pipeline> Card::get_connected_pipelines()
}
if (!crtc)
- throw invalid_argument("fob");
+ throw invalid_argument(string("Connector #") +
+ to_string(conn->idx()) +
+ " has no possible crtcs");
outputs.push_back(Pipeline { crtc, conn });
}
diff --git a/libkms++/connector.cpp b/libkms++/connector.cpp
index b045b8b..8ff5a5f 100644
--- a/libkms++/connector.cpp
+++ b/libkms++/connector.cpp
@@ -89,16 +89,15 @@ Videomode Connector::get_default_mode() const
return drm_mode_to_video_mode(drmmode);
}
-Videomode Connector::get_mode(const char *mode) const
+Videomode Connector::get_mode(const string& mode) const
{
auto c = m_priv->drm_connector;
- string sMode(mode);
for (int i = 0; i < c->count_modes; i++)
- if (sMode == c->modes[i].name)
+ if (mode == c->modes[i].name)
return drm_mode_to_video_mode(c->modes[i]);
- throw invalid_argument((sMode + ": mode not found").c_str());
+ throw invalid_argument(mode + ": mode not found");
}
bool Connector::connected() const
diff --git a/libkms++/connector.h b/libkms++/connector.h
index 198a6dd..14e6b36 100644
--- a/libkms++/connector.h
+++ b/libkms++/connector.h
@@ -34,7 +34,7 @@ public:
Videomode get_default_mode() const;
- Videomode get_mode(const char *mode) const;
+ Videomode get_mode(const std::string& mode) const;
Crtc* get_current_crtc() const { return m_current_crtc; }
std::vector<Crtc*> get_possible_crtcs() const;
diff --git a/libkms++/drmobject.cpp b/libkms++/drmobject.cpp
index a79370f..f48153a 100644
--- a/libkms++/drmobject.cpp
+++ b/libkms++/drmobject.cpp
@@ -64,6 +64,6 @@ uint64_t DrmObject::get_prop_value(const char *name) const
return m_prop_values.at(prop->id());
}
- throw invalid_argument((string(name) + ": property not found").c_str());
+ throw invalid_argument(string(name) + ": property not found");
}
}