1 /* SPDX-License-Identifier: MIT */
2 #ifndef __NV50_DISP_CHAN_H__
3 #define __NV50_DISP_CHAN_H__
4 #define nv50_disp_chan(p) container_of((p), struct nv50_disp_chan, object)
5 #include <core/object.h>
6 #include "nv50.h"
7 struct nv50_disp_root;
8 
9 struct nv50_disp_chan {
10 	const struct nv50_disp_chan_func *func;
11 	const struct nv50_disp_chan_mthd *mthd;
12 	struct nv50_disp *disp;
13 
14 	struct {
15 		int ctrl;
16 		int user;
17 	} chid;
18 	int head;
19 
20 	struct nvkm_object object;
21 
22 	struct nvkm_memory *memory;
23 	u64 push;
24 
25 	u32 suspend_put;
26 };
27 
28 struct nv50_disp_chan_func {
29 	int (*init)(struct nv50_disp_chan *);
30 	void (*fini)(struct nv50_disp_chan *);
31 	void (*intr)(struct nv50_disp_chan *, bool en);
32 	u64 (*user)(struct nv50_disp_chan *, u64 *size);
33 	int (*bind)(struct nv50_disp_chan *, struct nvkm_object *, u32 handle);
34 };
35 
36 int nv50_disp_chan_new_(const struct nv50_disp_chan_func *,
37 			const struct nv50_disp_chan_mthd *,
38 			struct nv50_disp *, int ctrl, int user, int head,
39 			const struct nvkm_oclass *, struct nvkm_object **);
40 int nv50_disp_dmac_new_(const struct nv50_disp_chan_func *,
41 			const struct nv50_disp_chan_mthd *,
42 			struct nv50_disp *, int chid, int head, u64 push,
43 			const struct nvkm_oclass *, struct nvkm_object **);
44 
45 void nv50_disp_chan_intr(struct nv50_disp_chan *, bool);
46 u64 nv50_disp_chan_user(struct nv50_disp_chan *, u64 *);
47 extern const struct nv50_disp_chan_func nv50_disp_pioc_func;
48 extern const struct nv50_disp_chan_func nv50_disp_dmac_func;
49 int nv50_disp_dmac_bind(struct nv50_disp_chan *, struct nvkm_object *, u32);
50 extern const struct nv50_disp_chan_func nv50_disp_core_func;
51 
52 void gf119_disp_chan_intr(struct nv50_disp_chan *, bool);
53 extern const struct nv50_disp_chan_func gf119_disp_pioc_func;
54 extern const struct nv50_disp_chan_func gf119_disp_dmac_func;
55 void gf119_disp_dmac_fini(struct nv50_disp_chan *);
56 int gf119_disp_dmac_bind(struct nv50_disp_chan *, struct nvkm_object *, u32);
57 extern const struct nv50_disp_chan_func gf119_disp_core_func;
58 void gf119_disp_core_fini(struct nv50_disp_chan *);
59 
60 extern const struct nv50_disp_chan_func gp102_disp_dmac_func;
61 
62 u64 gv100_disp_chan_user(struct nv50_disp_chan *, u64 *);
63 int gv100_disp_dmac_init(struct nv50_disp_chan *);
64 void gv100_disp_dmac_fini(struct nv50_disp_chan *);
65 int gv100_disp_dmac_bind(struct nv50_disp_chan *, struct nvkm_object *, u32);
66 
67 int nv50_disp_curs_new_(const struct nv50_disp_chan_func *,
68 			struct nv50_disp *, int ctrl, int user,
69 			const struct nvkm_oclass *, void *argv, u32 argc,
70 			struct nvkm_object **);
71 int nv50_disp_oimm_new_(const struct nv50_disp_chan_func *,
72 			struct nv50_disp *, int ctrl, int user,
73 			const struct nvkm_oclass *, void *argv, u32 argc,
74 			struct nvkm_object **);
75 int nv50_disp_base_new_(const struct nv50_disp_chan_func *,
76 			const struct nv50_disp_chan_mthd *,
77 			struct nv50_disp *, int chid,
78 			const struct nvkm_oclass *, void *argv, u32 argc,
79 			struct nvkm_object **);
80 int nv50_disp_core_new_(const struct nv50_disp_chan_func *,
81 			const struct nv50_disp_chan_mthd *,
82 			struct nv50_disp *, int chid,
83 			const struct nvkm_oclass *oclass, void *argv, u32 argc,
84 			struct nvkm_object **);
85 int nv50_disp_ovly_new_(const struct nv50_disp_chan_func *,
86 			const struct nv50_disp_chan_mthd *,
87 			struct nv50_disp *, int chid,
88 			const struct nvkm_oclass *, void *argv, u32 argc,
89 			struct nvkm_object **);
90 
91 int nv50_disp_curs_new(const struct nvkm_oclass *, void *, u32,
92 		       struct nv50_disp *, struct nvkm_object **);
93 int nv50_disp_oimm_new(const struct nvkm_oclass *, void *, u32,
94 		       struct nv50_disp *, struct nvkm_object **);
95 int nv50_disp_base_new(const struct nvkm_oclass *, void *, u32,
96 		       struct nv50_disp *, struct nvkm_object **);
97 int nv50_disp_core_new(const struct nvkm_oclass *, void *, u32,
98 		       struct nv50_disp *, struct nvkm_object **);
99 int nv50_disp_ovly_new(const struct nvkm_oclass *, void *, u32,
100 		       struct nv50_disp *, struct nvkm_object **);
101 
102 int g84_disp_base_new(const struct nvkm_oclass *, void *, u32,
103 		      struct nv50_disp *, struct nvkm_object **);
104 int g84_disp_core_new(const struct nvkm_oclass *, void *, u32,
105 		      struct nv50_disp *, struct nvkm_object **);
106 int g84_disp_ovly_new(const struct nvkm_oclass *, void *, u32,
107 		      struct nv50_disp *, struct nvkm_object **);
108 
109 int g94_disp_core_new(const struct nvkm_oclass *, void *, u32,
110 		      struct nv50_disp *, struct nvkm_object **);
111 
112 int gt200_disp_ovly_new(const struct nvkm_oclass *, void *, u32,
113 			struct nv50_disp *, struct nvkm_object **);
114 
115 int gf119_disp_curs_new(const struct nvkm_oclass *, void *, u32,
116 			struct nv50_disp *, struct nvkm_object **);
117 int gf119_disp_oimm_new(const struct nvkm_oclass *, void *, u32,
118 			struct nv50_disp *, struct nvkm_object **);
119 int gf119_disp_base_new(const struct nvkm_oclass *, void *, u32,
120 			struct nv50_disp *, struct nvkm_object **);
121 int gf119_disp_core_new(const struct nvkm_oclass *, void *, u32,
122 			struct nv50_disp *, struct nvkm_object **);
123 int gf119_disp_ovly_new(const struct nvkm_oclass *, void *, u32,
124 			struct nv50_disp *, struct nvkm_object **);
125 
126 int gk104_disp_core_new(const struct nvkm_oclass *, void *, u32,
127 			struct nv50_disp *, struct nvkm_object **);
128 int gk104_disp_ovly_new(const struct nvkm_oclass *, void *, u32,
129 			struct nv50_disp *, struct nvkm_object **);
130 
131 int gp102_disp_curs_new(const struct nvkm_oclass *, void *, u32,
132 			struct nv50_disp *, struct nvkm_object **);
133 int gp102_disp_oimm_new(const struct nvkm_oclass *, void *, u32,
134 			struct nv50_disp *, struct nvkm_object **);
135 int gp102_disp_base_new(const struct nvkm_oclass *, void *, u32,
136 			struct nv50_disp *, struct nvkm_object **);
137 int gp102_disp_core_new(const struct nvkm_oclass *, void *, u32,
138 			struct nv50_disp *, struct nvkm_object **);
139 int gp102_disp_ovly_new(const struct nvkm_oclass *, void *, u32,
140 			struct nv50_disp *, struct nvkm_object **);
141 
142 int gv100_disp_curs_new(const struct nvkm_oclass *, void *, u32,
143 			struct nv50_disp *, struct nvkm_object **);
144 int gv100_disp_wimm_new(const struct nvkm_oclass *, void *, u32,
145 			struct nv50_disp *, struct nvkm_object **);
146 int gv100_disp_core_new(const struct nvkm_oclass *, void *, u32,
147 			struct nv50_disp *, struct nvkm_object **);
148 int gv100_disp_wndw_new(const struct nvkm_oclass *, void *, u32,
149 			struct nv50_disp *, struct nvkm_object **);
150 
151 struct nv50_disp_mthd_list {
152 	u32 mthd;
153 	u32 addr;
154 	struct {
155 		u32 mthd;
156 		u32 addr;
157 		const char *name;
158 	} data[];
159 };
160 
161 struct nv50_disp_chan_mthd {
162 	const char *name;
163 	u32 addr;
164 	s32 prev;
165 	struct {
166 		const char *name;
167 		int nr;
168 		const struct nv50_disp_mthd_list *mthd;
169 	} data[];
170 };
171 
172 void nv50_disp_chan_mthd(struct nv50_disp_chan *, int debug);
173 
174 extern const struct nv50_disp_mthd_list nv50_disp_core_mthd_base;
175 extern const struct nv50_disp_mthd_list nv50_disp_core_mthd_sor;
176 extern const struct nv50_disp_mthd_list nv50_disp_core_mthd_pior;
177 extern const struct nv50_disp_mthd_list nv50_disp_base_mthd_image;
178 
179 extern const struct nv50_disp_chan_mthd g84_disp_core_mthd;
180 extern const struct nv50_disp_mthd_list g84_disp_core_mthd_dac;
181 extern const struct nv50_disp_mthd_list g84_disp_core_mthd_head;
182 
183 extern const struct nv50_disp_chan_mthd g94_disp_core_mthd;
184 
185 extern const struct nv50_disp_mthd_list gf119_disp_core_mthd_base;
186 extern const struct nv50_disp_mthd_list gf119_disp_core_mthd_dac;
187 extern const struct nv50_disp_mthd_list gf119_disp_core_mthd_sor;
188 extern const struct nv50_disp_mthd_list gf119_disp_core_mthd_pior;
189 extern const struct nv50_disp_chan_mthd gf119_disp_base_mthd;
190 
191 extern const struct nv50_disp_chan_mthd gk104_disp_core_mthd;
192 extern const struct nv50_disp_chan_mthd gk104_disp_ovly_mthd;
193 #endif
194