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