summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3115684)
raw | patch | inline | side by side (parent: 3115684)
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | |
Mon, 13 Mar 2017 09:08:40 +0000 (11:08 +0200) | ||
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | |
Mon, 13 Mar 2017 09:08:40 +0000 (11:08 +0200) |
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
kms++/inc/kms++/plane.h | patch | blob | history | |
kms++/src/plane.cpp | patch | blob | history |
index 26f3951915f06ddda63a4b632d9627757da83b0e..27e819b8380271f82f7996d9e06ba733e3b844fe 100644 (file)
--- a/kms++/inc/kms++/plane.h
+++ b/kms++/inc/kms++/plane.h
PlaneType plane_type() const;
+ std::vector<Crtc*> get_possible_crtcs() const;
std::vector<PixelFormat> get_formats() const;
uint32_t crtc_id() const;
uint32_t fb_id() const;
diff --git a/kms++/src/plane.cpp b/kms++/src/plane.cpp
index e19910bc2258422bc90700be2583da25c7e785c4..f68c8d062bfff17bc24862fff04710bcaa428595 100644 (file)
--- a/kms++/src/plane.cpp
+++ b/kms++/src/plane.cpp
#include <cassert>
#include <xf86drm.h>
#include <xf86drmMode.h>
+#include <algorithm>
#include <kms++/kms++.h>
}
}
+vector<Crtc*> Plane::get_possible_crtcs() const
+{
+ unsigned idx = 0;
+ vector<Crtc*> v;
+ auto crtcs = card().get_crtcs();
+
+ for (uint32_t crtc_mask = m_priv->drm_plane->possible_crtcs;
+ crtc_mask;
+ idx++, crtc_mask >>= 1) {
+
+ if ((crtc_mask & 1) == 0)
+ continue;
+
+ auto iter = find_if(crtcs.begin(), crtcs.end(), [idx](Crtc* crtc) { return crtc->idx() == idx; });
+
+ if (iter == crtcs.end())
+ throw runtime_error("get_possible_crtcs: crtc missing");
+
+ v.push_back(*iter);
+ }
+
+ return v;
+}
+
vector<PixelFormat> Plane::get_formats() const
{
auto p = m_priv->drm_plane;