• 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 
11 struct ConnectorPriv;
12 
13 enum class ConnectorStatus
14 {
15 	Unknown,
16 	Connected,
17 	Disconnected,
18 };
19 
20 class Connector : public DrmPropObject
21 {
22 	friend class Card;
23 public:
24 	void refresh();
25 
26 	Videomode get_default_mode() const;
27 
28 	Videomode get_mode(const std::string& mode) const;
29 	Videomode get_mode(unsigned xres, unsigned yres, float vrefresh, bool ilace) const;
30 
31 	Crtc* get_current_crtc() const;
32 	std::vector<Crtc*> get_possible_crtcs() const;
33 
34 	// true if connected or unknown
35 	bool connected() const;
36 	ConnectorStatus connector_status() const;
37 
fullname()38 	const std::string& fullname() const { return m_fullname; }
39 	uint32_t connector_type() const;
40 	uint32_t connector_type_id() const;
41 	uint32_t mmWidth() const;
42 	uint32_t mmHeight() const;
43 	uint32_t subpixel() const;
44 	const std::string& subpixel_str() const;
45 	std::vector<Videomode> get_modes() const;
46 	std::vector<Encoder*> get_encoders() const;
47 private:
48 	Connector(Card& card, uint32_t id, uint32_t idx);
49 	~Connector();
50 
51 	void setup();
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 }
63