1 /* SPDX-License-Identifier: MIT */
2 #ifndef __NVKM_DISP_CHAN_H__
3 #define __NVKM_DISP_CHAN_H__
4 #define nvkm_disp_chan(p) container_of((p), struct nvkm_disp_chan, object)
5 #include <core/object.h>
6 #include "priv.h"
7 
8 struct nvkm_disp_chan {
9 	const struct nvkm_disp_chan_func *func;
10 	const struct nvkm_disp_chan_mthd *mthd;
11 	struct nvkm_disp *disp;
12 
13 	struct {
14 		int ctrl;
15 		int user;
16 	} chid;
17 	int head;
18 
19 	struct nvkm_object object;
20 
21 	struct nvkm_memory *memory;
22 	u64 push;
23 
24 	u32 suspend_put;
25 };
26 
27 int nvkm_disp_core_new(const struct nvkm_oclass *, void *, u32, struct nvkm_object **);
28 int nvkm_disp_chan_new(const struct nvkm_oclass *, void *, u32, struct nvkm_object **);
29 int nvkm_disp_wndw_new(const struct nvkm_oclass *, void *, u32, struct nvkm_object **);
30 
31 struct nvkm_disp_chan_func {
32 	int (*push)(struct nvkm_disp_chan *, u64 object);
33 	int (*init)(struct nvkm_disp_chan *);
34 	void (*fini)(struct nvkm_disp_chan *);
35 	void (*intr)(struct nvkm_disp_chan *, bool en);
36 	u64 (*user)(struct nvkm_disp_chan *, u64 *size);
37 	int (*bind)(struct nvkm_disp_chan *, struct nvkm_object *, u32 handle);
38 };
39 
40 void nv50_disp_chan_intr(struct nvkm_disp_chan *, bool);
41 u64 nv50_disp_chan_user(struct nvkm_disp_chan *, u64 *);
42 extern const struct nvkm_disp_chan_func nv50_disp_pioc_func;
43 extern const struct nvkm_disp_chan_func nv50_disp_dmac_func;
44 int nv50_disp_dmac_push(struct nvkm_disp_chan *, u64);
45 int nv50_disp_dmac_bind(struct nvkm_disp_chan *, struct nvkm_object *, u32);
46 extern const struct nvkm_disp_chan_func nv50_disp_core_func;
47 
48 void gf119_disp_chan_intr(struct nvkm_disp_chan *, bool);
49 extern const struct nvkm_disp_chan_func gf119_disp_pioc_func;
50 extern const struct nvkm_disp_chan_func gf119_disp_dmac_func;
51 void gf119_disp_dmac_fini(struct nvkm_disp_chan *);
52 int gf119_disp_dmac_bind(struct nvkm_disp_chan *, struct nvkm_object *, u32);
53 extern const struct nvkm_disp_chan_func gf119_disp_core_func;
54 void gf119_disp_core_fini(struct nvkm_disp_chan *);
55 
56 extern const struct nvkm_disp_chan_func gp102_disp_dmac_func;
57 
58 u64 gv100_disp_chan_user(struct nvkm_disp_chan *, u64 *);
59 int gv100_disp_dmac_init(struct nvkm_disp_chan *);
60 void gv100_disp_dmac_fini(struct nvkm_disp_chan *);
61 int gv100_disp_dmac_bind(struct nvkm_disp_chan *, struct nvkm_object *, u32);
62 
63 struct nvkm_disp_chan_user {
64 	const struct nvkm_disp_chan_func *func;
65 	int ctrl;
66 	int user;
67 	const struct nvkm_disp_chan_mthd *mthd;
68 };
69 
70 extern const struct nvkm_disp_chan_user nv50_disp_oimm;
71 extern const struct nvkm_disp_chan_user nv50_disp_curs;
72 
73 extern const struct nvkm_disp_chan_user g84_disp_core;
74 extern const struct nvkm_disp_chan_user g84_disp_base;
75 extern const struct nvkm_disp_chan_user g84_disp_ovly;
76 
77 extern const struct nvkm_disp_chan_user g94_disp_core;
78 
79 extern const struct nvkm_disp_chan_user gt200_disp_ovly;
80 
81 extern const struct nvkm_disp_chan_user gf119_disp_base;
82 extern const struct nvkm_disp_chan_user gf119_disp_oimm;
83 extern const struct nvkm_disp_chan_user gf119_disp_curs;
84 
85 extern const struct nvkm_disp_chan_user gk104_disp_core;
86 extern const struct nvkm_disp_chan_user gk104_disp_ovly;
87 
88 extern const struct nvkm_disp_chan_user gv100_disp_core;
89 extern const struct nvkm_disp_chan_user gv100_disp_curs;
90 extern const struct nvkm_disp_chan_user gv100_disp_wndw;
91 extern const struct nvkm_disp_chan_user gv100_disp_wimm;
92 
93 struct nvkm_disp_mthd_list {
94 	u32 mthd;
95 	u32 addr;
96 	struct {
97 		u32 mthd;
98 		u32 addr;
99 		const char *name;
100 	} data[];
101 };
102 
103 struct nvkm_disp_chan_mthd {
104 	const char *name;
105 	u32 addr;
106 	s32 prev;
107 	struct {
108 		const char *name;
109 		int nr;
110 		const struct nvkm_disp_mthd_list *mthd;
111 	} data[];
112 };
113 
114 void nv50_disp_chan_mthd(struct nvkm_disp_chan *, int debug);
115 
116 extern const struct nvkm_disp_mthd_list nv50_disp_core_mthd_base;
117 extern const struct nvkm_disp_mthd_list nv50_disp_core_mthd_sor;
118 extern const struct nvkm_disp_mthd_list nv50_disp_core_mthd_pior;
119 extern const struct nvkm_disp_mthd_list nv50_disp_base_mthd_image;
120 
121 extern const struct nvkm_disp_chan_mthd g84_disp_core_mthd;
122 extern const struct nvkm_disp_mthd_list g84_disp_core_mthd_dac;
123 extern const struct nvkm_disp_mthd_list g84_disp_core_mthd_head;
124 
125 extern const struct nvkm_disp_chan_mthd g94_disp_core_mthd;
126 
127 extern const struct nvkm_disp_mthd_list gf119_disp_core_mthd_base;
128 extern const struct nvkm_disp_mthd_list gf119_disp_core_mthd_dac;
129 extern const struct nvkm_disp_mthd_list gf119_disp_core_mthd_sor;
130 extern const struct nvkm_disp_mthd_list gf119_disp_core_mthd_pior;
131 extern const struct nvkm_disp_chan_mthd gf119_disp_base_mthd;
132 
133 extern const struct nvkm_disp_chan_mthd gk104_disp_core_mthd;
134 extern const struct nvkm_disp_chan_mthd gk104_disp_ovly_mthd;
135 #endif
136