From f63f1b1a16269ddcce75a61d540429fe3d41cfc8 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Thu, 10 Jan 2019 13:59:34 +0200 Subject: Card: improve DRM card selection Add new Card constructor: Card(const std::string& driver, uint32_t idx) which can be used to open Nth card for the given driver. The default constructor behavior is: - If KMSXX_DEVICE env variable is set, the card device with that path is opened. - If KMSXX_DRIVER env variable is set, the card with the given driver name and index is opened. The format is either "drvname" or "drvname:idx". - If neither env variable is given, open /dev/dri/card0 Signed-off-by: Tomi Valkeinen --- kms++/inc/kms++/card.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'kms++/inc') diff --git a/kms++/inc/kms++/card.h b/kms++/inc/kms++/card.h index 77f97a3..b96e1c1 100644 --- a/kms++/inc/kms++/card.h +++ b/kms++/inc/kms++/card.h @@ -14,7 +14,8 @@ class Card friend class Framebuffer; public: Card(); - Card(const std::string& device); + Card(const std::string& dev_path); + Card(const std::string& driver, uint32_t idx); virtual ~Card(); Card(const Card& other) = delete; @@ -54,6 +55,7 @@ public: const std::string& version_name() const { return m_version_name; } private: + void setup(); void restore_modes(); std::map m_obmap; -- cgit v1.2.3