summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 32255b8)
raw | patch | inline | side by side (parent: 32255b8)
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | |
Fri, 20 Oct 2017 08:33:31 +0000 (11:33 +0300) | ||
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | |
Fri, 20 Oct 2017 08:33:31 +0000 (11:33 +0300) |
kms++/src/connector.cpp | patch | blob | history |
index 91414317556b32f5f3c8bd59f6c2f89ac4b8d68c..47759be108b830aa1a9dc2efbe102c3f656dde86 100644 (file)
--- a/kms++/src/connector.cpp
+++ b/kms++/src/connector.cpp
{
auto c = m_priv->drm_connector;
- for (int i = 0; i < c->count_modes; i++)
- if (mode == c->modes[i].name)
- return drm_mode_to_video_mode(c->modes[i]);
+ size_t idx = mode.find('@');
- throw invalid_argument(mode + ": mode not found");
+ string name = idx == string::npos ? mode : mode.substr(0, idx);
+ float vrefresh = idx == string::npos ? 0.0 : stod(mode.substr(idx + 1));
+
+ for (int i = 0; i < c->count_modes; i++) {
+ Videomode m = drm_mode_to_video_mode(c->modes[i]);
+
+ if (m.name != name)
+ continue;
+
+ if (vrefresh && vrefresh != m.calculated_vrefresh())
+ continue;
+
+ return m;
+ }
+
+ throw invalid_argument(mode + ": mode not found");
}
Videomode Connector::get_mode(unsigned xres, unsigned yres, float vrefresh, bool ilace) const