1 #ifndef __DEV_H_INCLUDED__
2 #define __DEV_H_INCLUDED__
3 
4 #include <stdint.h>
5 #include <xf86drmMode.h>
6 
7 struct sp_bo;
8 struct sp_dev;
9 
10 struct sp_plane {
11 	struct sp_dev *dev;
12 	drmModePlanePtr plane;
13 	struct sp_bo *bo;
14 	int in_use;
15 	uint32_t format;
16 
17 	/* Property ID's */
18 	uint32_t crtc_pid;
19 	uint32_t fb_pid;
20 	uint32_t zpos_pid;
21 	uint32_t crtc_x_pid;
22 	uint32_t crtc_y_pid;
23 	uint32_t crtc_w_pid;
24 	uint32_t crtc_h_pid;
25 	uint32_t src_x_pid;
26 	uint32_t src_y_pid;
27 	uint32_t src_w_pid;
28 	uint32_t src_h_pid;
29 };
30 
31 struct sp_connector {
32 	drmModeConnectorPtr conn;
33 	uint32_t crtc_id_pid;
34 };
35 
36 struct sp_crtc {
37 	drmModeCrtcPtr crtc;
38 	int pipe;
39 	int num_planes;
40 	uint32_t mode_pid;
41 	uint32_t active_pid;
42 };
43 
44 struct sp_dev {
45 	int fd;
46 
47 	int num_connectors;
48 	struct sp_connector *connectors;
49 
50 	int num_encoders;
51 	drmModeEncoderPtr *encoders;
52 
53 	int num_crtcs;
54 	struct sp_crtc *crtcs;
55 
56 	int num_planes;
57 	struct sp_plane *planes;
58 };
59 
60 void parse_arguments(int argc, char *argv[], int *card, int *crtc);
61 
62 struct sp_dev *create_sp_dev(int card);
63 void destroy_sp_dev(struct sp_dev *dev);
64 
65 #endif /* __DEV_H_INCLUDED__ */
66