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 nv50_disp_oneinit(struct nvkm_disp *);
46 int nv50_disp_init(struct nvkm_disp *);
47 void nv50_disp_fini(struct nvkm_disp *);
48 void nv50_disp_intr(struct nvkm_disp *);
49 extern const struct nvkm_enum nv50_disp_intr_error_type[];
50 void nv50_disp_super(struct work_struct *);
51 void nv50_disp_super_1(struct nvkm_disp *);
52 void nv50_disp_super_1_0(struct nvkm_disp *, struct nvkm_head *);
53 void nv50_disp_super_2_0(struct nvkm_disp *, struct nvkm_head *);
54 void nv50_disp_super_2_1(struct nvkm_disp *, struct nvkm_head *);
55 void nv50_disp_super_2_2(struct nvkm_disp *, struct nvkm_head *);
56 void nv50_disp_super_3_0(struct nvkm_disp *, struct nvkm_head *);
57 
58 int gf119_disp_init(struct nvkm_disp *);
59 void gf119_disp_fini(struct nvkm_disp *);
60 void gf119_disp_intr(struct nvkm_disp *);
61 void gf119_disp_super(struct work_struct *);
62 void gf119_disp_intr_error(struct nvkm_disp *, int);
63 
64 void gv100_disp_fini(struct nvkm_disp *);
65 void gv100_disp_intr(struct nvkm_disp *);
66 void gv100_disp_super(struct work_struct *);
67 int gv100_disp_wndw_cnt(struct nvkm_disp *, unsigned long *);
68 int gv100_disp_caps_new(const struct nvkm_oclass *, void *, u32, struct nvkm_object **);
69 
70 int tu102_disp_init(struct nvkm_disp *);
71 
72 void nv50_disp_dptmds_war_2(struct nvkm_disp *, struct dcb_output *);
73 void nv50_disp_dptmds_war_3(struct nvkm_disp *, struct dcb_output *);
74 void nv50_disp_update_sppll1(struct nvkm_disp *);
75 
76 extern const struct nvkm_event_func nv50_disp_chan_uevent;
77 void nv50_disp_chan_uevent_send(struct nvkm_disp *, int);
78 
79 extern const struct nvkm_event_func gf119_disp_chan_uevent;
80 extern const struct nvkm_event_func gv100_disp_chan_uevent;
81 
82 int nvkm_udisp_new(const struct nvkm_oclass *, void *, u32, struct nvkm_object **);
83 int nvkm_uconn_new(const struct nvkm_oclass *, void *, u32, struct nvkm_object **);
84 int nvkm_uoutp_new(const struct nvkm_oclass *, void *, u32, struct nvkm_object **);
85 int nvkm_uhead_new(const struct nvkm_oclass *, void *, u32, struct nvkm_object **);
86 #endif
87