From 009828beac9bfe9c36d336a4de0d297f90aece52 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Mon, 28 Sep 2015 01:13:34 +0300 Subject: Initial version --- libkms++/plane.cpp | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 libkms++/plane.cpp (limited to 'libkms++/plane.cpp') diff --git a/libkms++/plane.cpp b/libkms++/plane.cpp new file mode 100644 index 0000000..afb9c78 --- /dev/null +++ b/libkms++/plane.cpp @@ -0,0 +1,64 @@ +#include +#include +#include +#include +#include +#include +#include + +#include "kms++.h" + +using namespace std; + +namespace kms +{ + +struct PlanePriv +{ + drmModePlanePtr drm_plane; +}; + +Plane::Plane(Card &card, uint32_t id) + :DrmObject(card, id, DRM_MODE_OBJECT_PLANE) +{ + m_priv = new PlanePriv(); + m_priv->drm_plane = drmModeGetPlane(this->card().fd(), this->id()); + assert(m_priv->drm_plane); +} + +Plane::~Plane() +{ + drmModeFreePlane(m_priv->drm_plane); + delete m_priv; +} + +void Plane::print_short() const +{ + auto p = m_priv->drm_plane; + + printf("Plane %d, %d modes, %d,%d -> %dx%d\n", id(), + p->count_formats, + p->crtc_x, p->crtc_y, p->x, p->y); + + printf("\t"); + for (unsigned i = 0; i < p->count_formats; ++i) { + uint32_t f = p->formats[i]; + printf("%c%c%c%c ", + (f >> 0) & 0xff, + (f >> 8) & 0xff, + (f >> 16) & 0xff, + (f >> 24) & 0xff); + } + printf("\n"); +} + +bool Plane::supports_crtc(Crtc* crtc) const +{ + return m_priv->drm_plane->possible_crtcs & (1 << crtc->idx()); +} + +PlaneType Plane::plane_type() const +{ + return (PlaneType)get_prop_value("type"); +} +} -- cgit v1.2.3