1 /* SPDX-License-Identifier: MIT */
2 #ifndef __NVKM_DISP_PRIV_H__
3 #define __NVKM_DISP_PRIV_H__
4 #define nvkm_udisp(p) container_of((p), struct nvkm_disp, client.object)
5 #include <engine/disp.h>
6 #include <core/enum.h>
7 struct nvkm_head;
8 struct nvkm_outp;
9 struct dcb_output;
10 
11 int nvkm_disp_ctor(const struct nvkm_disp_func *, struct nvkm_device *, enum nvkm_subdev_type, int,
12 		   struct nvkm_disp *);
13 int nvkm_disp_new_(const struct nvkm_disp_func *, struct nvkm_device *, enum nvkm_subdev_type, int,
14 		   struct nvkm_disp **);
15 void nvkm_disp_vblank(struct nvkm_disp *, int head);
16 
17 struct nvkm_disp_func {
18 	int (*oneinit)(struct nvkm_disp *);
19 	int (*init)(struct nvkm_disp *);
20 	void (*fini)(struct nvkm_disp *);
21 	void (*intr)(struct nvkm_disp *);
22 	void (*intr_error)(struct nvkm_disp *, int chid);
23 
24 	void (*super)(struct work_struct *);
25 
26 	const struct nvkm_event_func *uevent;
27 
28 	struct {
29 		int (*cnt)(struct nvkm_disp *, unsigned long *mask);
30 		int (*new)(struct nvkm_disp *, int id);
31 	} wndw, head, dac, sor, pior;
32 
33 	u16 ramht_size;
34 
35 	const struct nvkm_sclass root;
36 
37 	struct nvkm_disp_user {
38 		struct nvkm_sclass base;
39 		int (*ctor)(const struct nvkm_oclass *, void *argv, u32 argc,
40 			    struct nvkm_object **);
41 		const struct nvkm_disp_chan_user *chan;
42 	} user[];
43 };
44 
45 int  nvkm_disp_ntfy(struct nvkm_object *, u32, struct nvkm_event **);
46 int nv04_disp_mthd(struct nvkm_object *, u32, void *, u32);
47 int nv50_disp_root_mthd_(struct nvkm_object *, u32, void *, u32);
48 
49 int nv50_disp_oneinit(struct nvkm_disp *);
50 int nv50_disp_init(struct nvkm_disp *);
51 void nv50_disp_fini(struct nvkm_disp *);
52 void nv50_disp_intr(struct nvkm_disp *);
53 extern const struct nvkm_enum nv50_disp_intr_error_type[];
54 void nv50_disp_super(struct work_struct *);
55 void nv50_disp_super_1(struct nvkm_disp *);
56 void nv50_disp_super_1_0(struct nvkm_disp *, struct nvkm_head *);
57 void nv50_disp_super_2_0(struct nvkm_disp *, struct nvkm_head *);
58 void nv50_disp_super_2_1(struct nvkm_disp *, struct nvkm_head *);
59 void nv50_disp_super_2_2(struct nvkm_disp *, struct nvkm_head *);
60 void nv50_disp_super_3_0(struct nvkm_disp *, struct nvkm_head *);
61 
62 int gf119_disp_init(struct nvkm_disp *);
63 void gf119_disp_fini(struct nvkm_disp *);
64 void gf119_disp_intr(struct nvkm_disp *);
65 void gf119_disp_super(struct work_struct *);
66 void gf119_disp_intr_error(struct nvkm_disp *, int);
67 
68 void gv100_disp_fini(struct nvkm_disp *);
69 void gv100_disp_intr(struct nvkm_disp *);
70 void gv100_disp_super(struct work_struct *);
71 int gv100_disp_wndw_cnt(struct nvkm_disp *, unsigned long *);
72 int gv100_disp_caps_new(const struct nvkm_oclass *, void *, u32, struct nvkm_object **);
73 
74 int tu102_disp_init(struct nvkm_disp *);
75 
76 void nv50_disp_dptmds_war_2(struct nvkm_disp *, struct dcb_output *);
77 void nv50_disp_dptmds_war_3(struct nvkm_disp *, struct dcb_output *);
78 void nv50_disp_update_sppll1(struct nvkm_disp *);
79 
80 extern const struct nvkm_event_func nv50_disp_chan_uevent;
81 void nv50_disp_chan_uevent_send(struct nvkm_disp *, int);
82 
83 extern const struct nvkm_event_func gf119_disp_chan_uevent;
84 extern const struct nvkm_event_func gv100_disp_chan_uevent;
85 
86 int nvkm_udisp_new(const struct nvkm_oclass *, void *, u32, struct nvkm_object **);
87 int nvkm_uconn_new(const struct nvkm_oclass *, void *, u32, struct nvkm_object **);
88 int nvkm_uoutp_new(const struct nvkm_oclass *, void *, u32, struct nvkm_object **);
89 #endif
90