1/*	$NetBSD: channv50.h,v 1.3 2021/12/18 23:45:35 riastradh Exp $	*/
2
3/* SPDX-License-Identifier: MIT */
4#ifndef __NV50_DISP_CHAN_H__
5#define __NV50_DISP_CHAN_H__
6#define nv50_disp_chan(p) container_of((p), struct nv50_disp_chan, object)
7#include <core/object.h>
8#include "nv50.h"
9struct nv50_disp_root;
10
11struct nv50_disp_chan {
12	const struct nv50_disp_chan_func *func;
13	const struct nv50_disp_chan_mthd *mthd;
14	struct nv50_disp *disp;
15
16	struct {
17		int ctrl;
18		int user;
19	} chid;
20	int head;
21
22	struct nvkm_object object;
23
24	struct nvkm_memory *memory;
25	u64 push;
26};
27
28struct 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
36int 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 **);
40int 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
45void nv50_disp_chan_intr(struct nv50_disp_chan *, bool);
46u64 nv50_disp_chan_user(struct nv50_disp_chan *, u64 *);
47extern const struct nv50_disp_chan_func nv50_disp_pioc_func;
48extern const struct nv50_disp_chan_func nv50_disp_dmac_func;
49int nv50_disp_dmac_bind(struct nv50_disp_chan *, struct nvkm_object *, u32);
50extern const struct nv50_disp_chan_func nv50_disp_core_func;
51
52void gf119_disp_chan_intr(struct nv50_disp_chan *, bool);
53extern const struct nv50_disp_chan_func gf119_disp_pioc_func;
54extern const struct nv50_disp_chan_func gf119_disp_dmac_func;
55void gf119_disp_dmac_fini(struct nv50_disp_chan *);
56int gf119_disp_dmac_bind(struct nv50_disp_chan *, struct nvkm_object *, u32);
57extern const struct nv50_disp_chan_func gf119_disp_core_func;
58void gf119_disp_core_fini(struct nv50_disp_chan *);
59
60extern const struct nv50_disp_chan_func gp102_disp_dmac_func;
61
62u64 gv100_disp_chan_user(struct nv50_disp_chan *, u64 *);
63int gv100_disp_dmac_init(struct nv50_disp_chan *);
64void gv100_disp_dmac_fini(struct nv50_disp_chan *);
65int gv100_disp_dmac_bind(struct nv50_disp_chan *, struct nvkm_object *, u32);
66
67int 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 **);
71int 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 **);
75int 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 **);
80int 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 **);
85int 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
91int nv50_disp_curs_new(const struct nvkm_oclass *, void *, u32,
92		       struct nv50_disp *, struct nvkm_object **);
93int nv50_disp_oimm_new(const struct nvkm_oclass *, void *, u32,
94		       struct nv50_disp *, struct nvkm_object **);
95int nv50_disp_base_new(const struct nvkm_oclass *, void *, u32,
96		       struct nv50_disp *, struct nvkm_object **);
97int nv50_disp_core_new(const struct nvkm_oclass *, void *, u32,
98		       struct nv50_disp *, struct nvkm_object **);
99int nv50_disp_ovly_new(const struct nvkm_oclass *, void *, u32,
100		       struct nv50_disp *, struct nvkm_object **);
101
102int g84_disp_base_new(const struct nvkm_oclass *, void *, u32,
103		      struct nv50_disp *, struct nvkm_object **);
104int g84_disp_core_new(const struct nvkm_oclass *, void *, u32,
105		      struct nv50_disp *, struct nvkm_object **);
106int g84_disp_ovly_new(const struct nvkm_oclass *, void *, u32,
107		      struct nv50_disp *, struct nvkm_object **);
108
109int g94_disp_core_new(const struct nvkm_oclass *, void *, u32,
110		      struct nv50_disp *, struct nvkm_object **);
111
112int gt200_disp_ovly_new(const struct nvkm_oclass *, void *, u32,
113			struct nv50_disp *, struct nvkm_object **);
114
115int gf119_disp_curs_new(const struct nvkm_oclass *, void *, u32,
116			struct nv50_disp *, struct nvkm_object **);
117int gf119_disp_oimm_new(const struct nvkm_oclass *, void *, u32,
118			struct nv50_disp *, struct nvkm_object **);
119int gf119_disp_base_new(const struct nvkm_oclass *, void *, u32,
120			struct nv50_disp *, struct nvkm_object **);
121int gf119_disp_core_new(const struct nvkm_oclass *, void *, u32,
122			struct nv50_disp *, struct nvkm_object **);
123int gf119_disp_ovly_new(const struct nvkm_oclass *, void *, u32,
124			struct nv50_disp *, struct nvkm_object **);
125
126int gk104_disp_core_new(const struct nvkm_oclass *, void *, u32,
127			struct nv50_disp *, struct nvkm_object **);
128int gk104_disp_ovly_new(const struct nvkm_oclass *, void *, u32,
129			struct nv50_disp *, struct nvkm_object **);
130
131int gp102_disp_curs_new(const struct nvkm_oclass *, void *, u32,
132			struct nv50_disp *, struct nvkm_object **);
133int gp102_disp_oimm_new(const struct nvkm_oclass *, void *, u32,
134			struct nv50_disp *, struct nvkm_object **);
135int gp102_disp_base_new(const struct nvkm_oclass *, void *, u32,
136			struct nv50_disp *, struct nvkm_object **);
137int gp102_disp_core_new(const struct nvkm_oclass *, void *, u32,
138			struct nv50_disp *, struct nvkm_object **);
139int gp102_disp_ovly_new(const struct nvkm_oclass *, void *, u32,
140			struct nv50_disp *, struct nvkm_object **);
141
142int gv100_disp_curs_new(const struct nvkm_oclass *, void *, u32,
143			struct nv50_disp *, struct nvkm_object **);
144int gv100_disp_wimm_new(const struct nvkm_oclass *, void *, u32,
145			struct nv50_disp *, struct nvkm_object **);
146int gv100_disp_core_new(const struct nvkm_oclass *, void *, u32,
147			struct nv50_disp *, struct nvkm_object **);
148int gv100_disp_wndw_new(const struct nvkm_oclass *, void *, u32,
149			struct nv50_disp *, struct nvkm_object **);
150
151struct 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
161struct 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
172void nv50_disp_chan_mthd(struct nv50_disp_chan *, int debug);
173
174extern const struct nv50_disp_mthd_list nv50_disp_core_mthd_base;
175extern const struct nv50_disp_mthd_list nv50_disp_core_mthd_sor;
176extern const struct nv50_disp_mthd_list nv50_disp_core_mthd_pior;
177extern const struct nv50_disp_mthd_list nv50_disp_base_mthd_image;
178
179extern const struct nv50_disp_chan_mthd g84_disp_core_mthd;
180extern const struct nv50_disp_mthd_list g84_disp_core_mthd_dac;
181extern const struct nv50_disp_mthd_list g84_disp_core_mthd_head;
182
183extern const struct nv50_disp_chan_mthd g94_disp_core_mthd;
184
185extern const struct nv50_disp_mthd_list gf119_disp_core_mthd_base;
186extern const struct nv50_disp_mthd_list gf119_disp_core_mthd_dac;
187extern const struct nv50_disp_mthd_list gf119_disp_core_mthd_sor;
188extern const struct nv50_disp_mthd_list gf119_disp_core_mthd_pior;
189extern const struct nv50_disp_chan_mthd gf119_disp_base_mthd;
190
191extern const struct nv50_disp_chan_mthd gk104_disp_core_mthd;
192extern const struct nv50_disp_chan_mthd gk104_disp_ovly_mthd;
193#endif
194