• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #pragma once
2 
3 #include <vector>
4 
5 #include "drmpropobject.h"
6 #include "videomode.h"
7 
8 namespace kms
9 {
10 struct ConnectorPriv;
11 
12 enum class ConnectorStatus {
13 	Unknown,
14 	Connected,
15 	Disconnected,
16 };
17 
18 class Connector : public DrmPropObject
19 {
20 	friend class Card;
21 
22 public:
23 	void refresh();
24 
25 	Videomode get_default_mode() const;
26 
27 	Videomode get_mode(const std::string& mode) const;
28 	Videomode get_mode(unsigned xres, unsigned yres, float vrefresh, bool ilace) const;
29 
30 	Crtc* get_current_crtc() const;
31 	std::vector<Crtc*> get_possible_crtcs() const;
32 
33 	// true if connected or unknown
34 	bool connected() const;
35 	ConnectorStatus connector_status() const;
36 
fullname()37 	const std::string& fullname() const { return m_fullname; }
38 	uint32_t connector_type() const;
39 	uint32_t connector_type_id() const;
40 	uint32_t mmWidth() const;
41 	uint32_t mmHeight() const;
42 	uint32_t subpixel() const;
43 	const std::string& subpixel_str() const;
44 	std::vector<Videomode> get_modes() const;
45 	std::vector<Encoder*> get_encoders() const;
46 
47 private:
48 	Connector(Card& card, uint32_t id, uint32_t idx);
49 	~Connector() override;
50 
51 	void setup() override;
52 	void restore_mode();
53 
54 	ConnectorPriv* m_priv;
55 
56 	std::string m_fullname;
57 
58 	Encoder* m_current_encoder;
59 
60 	Crtc* m_saved_crtc;
61 };
62 } // namespace kms
63