From 3ea1d4ebea22a60e8e849897d88780e2eb0f6eb9 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Fri, 9 Oct 2015 12:32:38 +0300 Subject: libkms: Add Plane::supports_format --- libkms++/plane.cpp | 11 +++++++++++ libkms++/plane.h | 1 + 2 files changed, 12 insertions(+) (limited to 'libkms++') diff --git a/libkms++/plane.cpp b/libkms++/plane.cpp index b9884e2..93567f1 100644 --- a/libkms++/plane.cpp +++ b/libkms++/plane.cpp @@ -57,6 +57,17 @@ bool Plane::supports_crtc(Crtc* crtc) const return m_priv->drm_plane->possible_crtcs & (1 << crtc->idx()); } +bool Plane::supports_format(PixelFormat fmt) const +{ + auto p = m_priv->drm_plane; + + for (unsigned i = 0; i < p->count_formats; ++i) + if ((uint32_t)fmt == p->formats[i]) + return true; + + return false; +} + PlaneType Plane::plane_type() const { if (card().has_has_universal_planes()) diff --git a/libkms++/plane.h b/libkms++/plane.h index 671e150..0c232c0 100644 --- a/libkms++/plane.h +++ b/libkms++/plane.h @@ -21,6 +21,7 @@ public: void print_short() const; bool supports_crtc(Crtc* crtc) const; + bool supports_format(PixelFormat fmt) const; PlaneType plane_type() const; -- cgit v1.2.3