libkms++/encoder: Add methods for getting details of the DRM object
authorJyri Sarha <jsarha@ti.com>
Tue, 20 Oct 2015 13:47:46 +0000 (16:47 +0300)
committerJyri Sarha <jsarha@ti.com>
Tue, 20 Oct 2015 16:18:32 +0000 (19:18 +0300)
libkms++/encoder.cpp
libkms++/encoder.h

index 81eba719ff46d45772c74e96333f5fe287bc9b2c..6f79e4fba6446b1db1382ed77dc4daf17dacd10b 100644 (file)
@@ -18,6 +18,18 @@ struct EncoderPriv
        drmModeEncoderPtr drm_encoder;
 };
 
+static const map<int, string> encoder_types = {
+#define DEF_ENC(c) { DRM_MODE_ENCODER_##c, #c }
+       DEF_ENC(NONE),
+       DEF_ENC(DAC),
+       DEF_ENC(TMDS),
+       DEF_ENC(LVDS),
+       DEF_ENC(TVDAC),
+       DEF_ENC(VIRTUAL),
+       DEF_ENC(DSI),
+#undef DEF_ENC
+};
+
 Encoder::Encoder(Card &card, uint32_t id)
        :DrmObject(card, id, DRM_MODE_OBJECT_ENCODER)
 {
@@ -63,4 +75,10 @@ vector<Crtc*> Encoder::get_possible_crtcs() const
 
        return crtcs;
 }
+
+const string& Encoder::get_encoder_type() const
+{
+       return encoder_types.at(m_priv->drm_encoder->encoder_type);
+}
+
 }
index 77e4e3e77001ea57fe6eff0f53e6f226aa91a4a3..609e136da80fa5cde34ae7477baa2a2a592860da 100644 (file)
@@ -17,6 +17,7 @@ public:
        Crtc* get_crtc() const;
        std::vector<Crtc*> get_possible_crtcs() const;
 
+       const std::string& get_encoder_type() const;
 private:
        Encoder(Card& card, uint32_t id);
        ~Encoder();