From b13bf2e44827f9dea2149f72970239d4a7b0817b Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Thu, 17 Jan 2019 16:18:15 +0200 Subject: card: add has_kms() Signed-off-by: Tomi Valkeinen --- kms++/inc/kms++/card.h | 1 + kms++/src/card.cpp | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'kms++') diff --git a/kms++/inc/kms++/card.h b/kms++/inc/kms++/card.h index 4b0d877..a2c27f8 100644 --- a/kms++/inc/kms++/card.h +++ b/kms++/inc/kms++/card.h @@ -41,6 +41,7 @@ public: bool has_atomic() const { return m_has_atomic; } bool has_has_universal_planes() const { return m_has_universal_planes; } bool has_dumb_buffers() const { return m_has_dumb; } + bool has_kms() const; const std::vector get_connectors() const { return m_connectors; } const std::vector get_encoders() const { return m_encoders; } diff --git a/kms++/src/card.cpp b/kms++/src/card.cpp index f404d3a..85c693b 100644 --- a/kms++/src/card.cpp +++ b/kms++/src/card.cpp @@ -46,8 +46,7 @@ unique_ptr Card::open_modesetting_card() for (const string& path : paths) { unique_ptr card = unique_ptr(new Card(path)); - if (card->get_connectors().size() > 0 && - card->get_crtcs().size() > 0) + if (card->has_kms()) return card; } @@ -259,6 +258,11 @@ void Card::drop_master() m_is_master = false; } +bool Card::has_kms() const +{ + return m_connectors.size() > 0 && m_encoders.size() > 0 && m_crtcs.size() > 0; +} + void Card::restore_modes() { for (auto conn : get_connectors()) -- cgit v1.2.3