1 #ifndef __NVKM_DISP_HEAD_H__
2 #define __NVKM_DISP_HEAD_H__
3 #include "priv.h"
4 
5 struct nvkm_head {
6 	const struct nvkm_head_func *func;
7 	struct nvkm_disp *disp;
8 	int id;
9 
10 	struct list_head head;
11 
12 	struct nvkm_head_state {
13 		u16 htotal;
14 		u16 hsynce;
15 		u16 hblanke;
16 		u16 hblanks;
17 		u16 vtotal;
18 		u16 vsynce;
19 		u16 vblanke;
20 		u16 vblanks;
21 		u32 hz;
22 
23 		/* Prior to GF119, these are set by the OR. */
24 		struct {
25 			u8 depth;
26 		} or;
27 	} arm, asy;
28 };
29 
30 int nvkm_head_new_(const struct nvkm_head_func *, struct nvkm_disp *, int id);
31 void nvkm_head_del(struct nvkm_head **);
32 int nvkm_head_mthd_scanoutpos(struct nvkm_object *,
33 			      struct nvkm_head *, void *, u32);
34 struct nvkm_head *nvkm_head_find(struct nvkm_disp *, int id);
35 
36 struct nvkm_head_func {
37 	void (*state)(struct nvkm_head *, struct nvkm_head_state *);
38 	void (*rgpos)(struct nvkm_head *, u16 *hline, u16 *vline);
39 	void (*rgclk)(struct nvkm_head *, int div);
40 	void (*vblank_get)(struct nvkm_head *);
41 	void (*vblank_put)(struct nvkm_head *);
42 };
43 
44 void nv50_head_rgpos(struct nvkm_head *, u16 *, u16 *);
45 
46 #define HEAD_MSG(h,l,f,a...) do {                                              \
47 	struct nvkm_head *_h = (h);                                            \
48 	nvkm_##l(&_h->disp->engine.subdev, "head-%d: "f"\n", _h->id, ##a);     \
49 } while(0)
50 #define HEAD_WARN(h,f,a...) HEAD_MSG((h), warn, f, ##a)
51 #define HEAD_DBG(h,f,a...) HEAD_MSG((h), debug, f, ##a)
52 
53 int nv04_head_new(struct nvkm_disp *, int id);
54 int nv50_head_new(struct nvkm_disp *, int id);
55 int gf119_head_new(struct nvkm_disp *, int id);
56 #endif
57