1 #pragma once
2 
3 #include <vector>
4 
5 #include "drmpropobject.h"
6 
7 namespace kms
8 {
9 
10 struct CrtcPriv;
11 
12 class Crtc : public DrmPropObject
13 {
14 	friend class Card;
15 	friend class Connector;
16 public:
17 	void refresh();
18 
get_possible_planes()19 	const std::vector<Plane*>& get_possible_planes() const { return m_possible_planes; }
20 
21 	int set_mode(Connector* conn, const Videomode& mode);
22 	int set_mode(Connector* conn, Framebuffer& fb, const Videomode& mode);
23 
24 	int set_plane(Plane *plane, Framebuffer &fb,
25 		      int32_t dst_x, int32_t dst_y, uint32_t dst_w, uint32_t dst_h,
26 		      float src_x, float src_y, float src_w, float src_h);
27 	int disable_mode();
28 
29 	int disable_plane(Plane* plane);
30 
31 	Plane* get_primary_plane();
32 
33 	int page_flip(Framebuffer& fb, void *data);
34 
35 	uint32_t buffer_id() const;
36 	uint32_t x() const;
37 	uint32_t y() const;
38 	uint32_t width() const;
39 	uint32_t height() const;
40 	int mode_valid() const;
41 	Videomode mode() const;
42 	int gamma_size() const;
43 private:
44 	Crtc(Card& card, uint32_t id, uint32_t idx);
45 	~Crtc();
46 
47 	void setup();
48 	void restore_mode(Connector *conn);
49 
50 	CrtcPriv* m_priv;
51 
52 	std::vector<Plane*> m_possible_planes;
53 };
54 }
55