xref: /linux/drivers/gpu/drm/nouveau/nvkm/engine/disp/chan.h (revision d642ef71)
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 	struct {
27 		struct nvkm_gsp_object object;
28 	} rm;
29 };
30 
31 int nvkm_disp_core_new(const struct nvkm_oclass *, void *, u32, struct nvkm_object **);
32 int nvkm_disp_chan_new(const struct nvkm_oclass *, void *, u32, struct nvkm_object **);
33 int nvkm_disp_wndw_new(const struct nvkm_oclass *, void *, u32, struct nvkm_object **);
34 
35 struct nvkm_disp_chan_func {
36 	int (*push)(struct nvkm_disp_chan *, u64 object);
37 	int (*init)(struct nvkm_disp_chan *);
38 	void (*fini)(struct nvkm_disp_chan *);
39 	void (*intr)(struct nvkm_disp_chan *, bool en);
40 	u64 (*user)(struct nvkm_disp_chan *, u64 *size);
41 	int (*bind)(struct nvkm_disp_chan *, struct nvkm_object *, u32 handle);
42 };
43 
44 void nv50_disp_chan_intr(struct nvkm_disp_chan *, bool);
45 u64 nv50_disp_chan_user(struct nvkm_disp_chan *, u64 *);
46 extern const struct nvkm_disp_chan_func nv50_disp_pioc_func;
47 extern const struct nvkm_disp_chan_func nv50_disp_dmac_func;
48 int nv50_disp_dmac_push(struct nvkm_disp_chan *, u64);
49 int nv50_disp_dmac_bind(struct nvkm_disp_chan *, struct nvkm_object *, u32);
50 extern const struct nvkm_disp_chan_func nv50_disp_core_func;
51 
52 void gf119_disp_chan_intr(struct nvkm_disp_chan *, bool);
53 extern const struct nvkm_disp_chan_func gf119_disp_pioc_func;
54 extern const struct nvkm_disp_chan_func gf119_disp_dmac_func;
55 void gf119_disp_dmac_fini(struct nvkm_disp_chan *);
56 int gf119_disp_dmac_bind(struct nvkm_disp_chan *, struct nvkm_object *, u32);
57 extern const struct nvkm_disp_chan_func gf119_disp_core_func;
58 void gf119_disp_core_fini(struct nvkm_disp_chan *);
59 
60 extern const struct nvkm_disp_chan_func gp102_disp_dmac_func;
61 
62 u64 gv100_disp_chan_user(struct nvkm_disp_chan *, u64 *);
63 int gv100_disp_dmac_init(struct nvkm_disp_chan *);
64 void gv100_disp_dmac_fini(struct nvkm_disp_chan *);
65 int gv100_disp_dmac_bind(struct nvkm_disp_chan *, struct nvkm_object *, u32);
66 
67 struct nvkm_disp_chan_user {
68 	const struct nvkm_disp_chan_func *func;
69 	int ctrl;
70 	int user;
71 	const struct nvkm_disp_chan_mthd *mthd;
72 };
73 
74 extern const struct nvkm_disp_chan_user nv50_disp_oimm;
75 extern const struct nvkm_disp_chan_user nv50_disp_curs;
76 
77 extern const struct nvkm_disp_chan_user g84_disp_core;
78 extern const struct nvkm_disp_chan_user g84_disp_base;
79 extern const struct nvkm_disp_chan_user g84_disp_ovly;
80 
81 extern const struct nvkm_disp_chan_user g94_disp_core;
82 
83 extern const struct nvkm_disp_chan_user gt200_disp_ovly;
84 
85 extern const struct nvkm_disp_chan_user gf119_disp_base;
86 extern const struct nvkm_disp_chan_user gf119_disp_oimm;
87 extern const struct nvkm_disp_chan_user gf119_disp_curs;
88 
89 extern const struct nvkm_disp_chan_user gk104_disp_core;
90 extern const struct nvkm_disp_chan_user gk104_disp_ovly;
91 
92 extern const struct nvkm_disp_chan_user gv100_disp_core;
93 extern const struct nvkm_disp_chan_user gv100_disp_curs;
94 extern const struct nvkm_disp_chan_user gv100_disp_wndw;
95 extern const struct nvkm_disp_chan_user gv100_disp_wimm;
96 
97 struct nvkm_disp_mthd_list {
98 	u32 mthd;
99 	u32 addr;
100 	struct {
101 		u32 mthd;
102 		u32 addr;
103 		const char *name;
104 	} data[];
105 };
106 
107 struct nvkm_disp_chan_mthd {
108 	const char *name;
109 	u32 addr;
110 	s32 prev;
111 	struct {
112 		const char *name;
113 		int nr;
114 		const struct nvkm_disp_mthd_list *mthd;
115 	} data[];
116 };
117 
118 void nv50_disp_chan_mthd(struct nvkm_disp_chan *, int debug);
119 
120 extern const struct nvkm_disp_mthd_list nv50_disp_core_mthd_base;
121 extern const struct nvkm_disp_mthd_list nv50_disp_core_mthd_sor;
122 extern const struct nvkm_disp_mthd_list nv50_disp_core_mthd_pior;
123 extern const struct nvkm_disp_mthd_list nv50_disp_base_mthd_image;
124 
125 extern const struct nvkm_disp_chan_mthd g84_disp_core_mthd;
126 extern const struct nvkm_disp_mthd_list g84_disp_core_mthd_dac;
127 extern const struct nvkm_disp_mthd_list g84_disp_core_mthd_head;
128 
129 extern const struct nvkm_disp_chan_mthd g94_disp_core_mthd;
130 
131 extern const struct nvkm_disp_mthd_list gf119_disp_core_mthd_base;
132 extern const struct nvkm_disp_mthd_list gf119_disp_core_mthd_dac;
133 extern const struct nvkm_disp_mthd_list gf119_disp_core_mthd_sor;
134 extern const struct nvkm_disp_mthd_list gf119_disp_core_mthd_pior;
135 extern const struct nvkm_disp_chan_mthd gf119_disp_base_mthd;
136 
137 extern const struct nvkm_disp_chan_mthd gk104_disp_core_mthd;
138 extern const struct nvkm_disp_chan_mthd gk104_disp_ovly_mthd;
139 #endif
140