card: move DRM version data to CardVersion
authorTomi Valkeinen <tomi.valkeinen@ti.com>
Tue, 27 Aug 2019 14:33:57 +0000 (17:33 +0300)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Wed, 2 Oct 2019 09:19:18 +0000 (12:19 +0300)
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
kms++/inc/kms++/card.h
kms++/src/card.cpp

index 099d5b5..e734689 100644 (file)
 
 namespace kms
 {
+struct CardVersion
+{
+       int major;
+       int minor;
+       int patchlevel;
+       std::string name;
+       std::string date;
+       std::string desc;
+};
+
 class Card
 {
        friend class Framebuffer;
@@ -54,7 +64,8 @@ public:
 
        int disable_all();
 
-       const std::string& version_name() const { return m_version_name; }
+       const std::string& version_name() const { return m_version.name; }
+       const CardVersion& version() const { return m_version; }
 
 private:
        void setup();
@@ -76,11 +87,6 @@ private:
        bool m_has_universal_planes;
        bool m_has_dumb;
 
-       int m_version_major;
-       int m_version_minor;
-       int m_version_patchlevel;
-       std::string m_version_name;
-       std::string m_version_date;
-       std::string m_version_desc;
+       CardVersion m_version;
 };
 }
index 8de8b82..1509a98 100644 (file)
@@ -151,12 +151,12 @@ Card::Card(const std::string& driver, uint32_t idx)
 void Card::setup()
 {
        drmVersionPtr ver = drmGetVersion(m_fd);
-       m_version_major = ver->version_major;
-       m_version_minor = ver->version_minor;
-       m_version_patchlevel = ver->version_patchlevel;
-       m_version_name = string(ver->name, ver->name_len);
-       m_version_date = string(ver->date, ver->date_len);
-       m_version_desc = string(ver->desc, ver->desc_len);
+       m_version.major = ver->version_major;
+       m_version.minor = ver->version_minor;
+       m_version.patchlevel = ver->version_patchlevel;
+       m_version.name = string(ver->name, ver->name_len);
+       m_version.date = string(ver->date, ver->date_len);
+       m_version.desc = string(ver->desc, ver->desc_len);
        drmFreeVersion(ver);
 
        int r;