25261be4e73520ad69b5ed2aa73edaecc7775734
[android/external-libkmsxx.git] / libkms++ / card.h
1 #pragma once
3 #include <cstdint>
4 #include <vector>
5 #include <map>
7 #include "decls.h"
8 #include "pipeline.h"
10 namespace kms
11 {
12 class Card
13 {
14 public:
15         Card();
16         ~Card();
18         Card(const Card& other) = delete;
19         Card& operator=(const Card& other) = delete;
21         int fd() const { return m_fd; }
23         Connector* get_first_connected_connector() const;
25         DrmObject* get_object(uint32_t id) const;
26         Connector* get_connector(uint32_t id) const;
27         Crtc* get_crtc(uint32_t id) const;
28         Crtc* get_crtc_by_index(uint32_t idx) const;
29         Encoder* get_encoder(uint32_t id) const;
30         Property* get_prop(uint32_t id) const;
31         Property* get_prop(const std::string& name) const;
32         Plane* get_plane(uint32_t id) const;
34         bool master() const { return m_master; }
35         bool has_atomic() const { return m_has_atomic; }
36         bool has_has_universal_planes() const { return m_has_universal_planes; }
38         void print_short() const;
40         std::vector<Connector*> get_connectors() const;
41         std::vector<Crtc*> get_crtcs() const;
42         std::vector<DrmObject*> get_objects() const;
43         std::vector<Plane*> get_planes() const;
45         std::vector<Pipeline> get_connected_pipelines();
47         void call_page_flip_handlers();
49 private:
50         void restore_modes();
52         std::map<uint32_t, DrmObject*> m_obmap;
54         std::vector<Connector*> m_connectors;
55         std::vector<Encoder*> m_encoders;
56         std::vector<Crtc*> m_crtcs;
57         std::vector<Plane*> m_planes;
58         std::vector<Property*> m_properties;
60         int m_fd;
61         bool m_master;
63         bool m_has_atomic;
64         bool m_has_universal_planes;
65 };
66 }