1 #pragma once 2 3 #include <cstdint> 4 #include <vector> 5 #include <map> 6 7 #include "decls.h" 8 #include "pipeline.h" 9 10 namespace kms 11 { 12 class Card 13 { 14 friend class Framebuffer; 15 public: 16 Card(); 17 Card(const std::string& device); 18 virtual ~Card(); 19 20 Card(const Card& other) = delete; 21 Card& operator=(const Card& other) = delete; 22 fd()23 int fd() const { return m_fd; } 24 25 void drop_master(); 26 27 Connector* get_first_connected_connector() const; 28 29 DrmObject* get_object(uint32_t id) const; 30 Connector* get_connector(uint32_t id) const; 31 Crtc* get_crtc(uint32_t id) const; 32 Encoder* get_encoder(uint32_t id) const; 33 Plane* get_plane(uint32_t id) const; 34 Property* get_prop(uint32_t id) const; 35 master()36 bool master() const { return m_master; } has_atomic()37 bool has_atomic() const { return m_has_atomic; } has_has_universal_planes()38 bool has_has_universal_planes() const { return m_has_universal_planes; } 39 get_connectors()40 const std::vector<Connector*> get_connectors() const { return m_connectors; } get_encoders()41 const std::vector<Encoder*> get_encoders() const { return m_encoders; } get_crtcs()42 const std::vector<Crtc*> get_crtcs() const { return m_crtcs; } get_planes()43 const std::vector<Plane*> get_planes() const { return m_planes; } get_properties()44 const std::vector<Property*> get_properties() const { return m_properties; } 45 46 const std::vector<DrmObject*> get_objects() const; 47 48 std::vector<Pipeline> get_connected_pipelines(); 49 50 void call_page_flip_handlers(); 51 52 int disable_all(); 53 54 private: 55 void restore_modes(); 56 57 std::map<uint32_t, DrmObject*> m_obmap; 58 59 std::vector<Connector*> m_connectors; 60 std::vector<Encoder*> m_encoders; 61 std::vector<Crtc*> m_crtcs; 62 std::vector<Plane*> m_planes; 63 std::vector<Property*> m_properties; 64 std::vector<Framebuffer*> m_framebuffers; 65 66 int m_fd; 67 bool m_master; 68 69 bool m_has_atomic; 70 bool m_has_universal_planes; 71 }; 72 } 73