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
8struct 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
31int nvkm_disp_core_new(const struct nvkm_oclass *, void *, u32, struct nvkm_object **);
32int nvkm_disp_chan_new(const struct nvkm_oclass *, void *, u32, struct nvkm_object **);
33int nvkm_disp_wndw_new(const struct nvkm_oclass *, void *, u32, struct nvkm_object **);
34
35struct 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
44void nv50_disp_chan_intr(struct nvkm_disp_chan *, bool);
45u64 nv50_disp_chan_user(struct nvkm_disp_chan *, u64 *);
46extern const struct nvkm_disp_chan_func nv50_disp_pioc_func;
47extern const struct nvkm_disp_chan_func nv50_disp_dmac_func;
48int nv50_disp_dmac_push(struct nvkm_disp_chan *, u64);
49int nv50_disp_dmac_bind(struct nvkm_disp_chan *, struct nvkm_object *, u32);
50extern const struct nvkm_disp_chan_func nv50_disp_core_func;
51
52void gf119_disp_chan_intr(struct nvkm_disp_chan *, bool);
53extern const struct nvkm_disp_chan_func gf119_disp_pioc_func;
54extern const struct nvkm_disp_chan_func gf119_disp_dmac_func;
55void gf119_disp_dmac_fini(struct nvkm_disp_chan *);
56int gf119_disp_dmac_bind(struct nvkm_disp_chan *, struct nvkm_object *, u32);
57extern const struct nvkm_disp_chan_func gf119_disp_core_func;
58void gf119_disp_core_fini(struct nvkm_disp_chan *);
59
60extern const struct nvkm_disp_chan_func gp102_disp_dmac_func;
61
62u64 gv100_disp_chan_user(struct nvkm_disp_chan *, u64 *);
63int gv100_disp_dmac_init(struct nvkm_disp_chan *);
64void gv100_disp_dmac_fini(struct nvkm_disp_chan *);
65int gv100_disp_dmac_bind(struct nvkm_disp_chan *, struct nvkm_object *, u32);
66
67struct 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
74extern const struct nvkm_disp_chan_user nv50_disp_oimm;
75extern const struct nvkm_disp_chan_user nv50_disp_curs;
76
77extern const struct nvkm_disp_chan_user g84_disp_core;
78extern const struct nvkm_disp_chan_user g84_disp_base;
79extern const struct nvkm_disp_chan_user g84_disp_ovly;
80
81extern const struct nvkm_disp_chan_user g94_disp_core;
82
83extern const struct nvkm_disp_chan_user gt200_disp_ovly;
84
85extern const struct nvkm_disp_chan_user gf119_disp_base;
86extern const struct nvkm_disp_chan_user gf119_disp_oimm;
87extern const struct nvkm_disp_chan_user gf119_disp_curs;
88
89extern const struct nvkm_disp_chan_user gk104_disp_core;
90extern const struct nvkm_disp_chan_user gk104_disp_ovly;
91
92extern const struct nvkm_disp_chan_user gv100_disp_core;
93extern const struct nvkm_disp_chan_user gv100_disp_curs;
94extern const struct nvkm_disp_chan_user gv100_disp_wndw;
95extern const struct nvkm_disp_chan_user gv100_disp_wimm;
96
97struct 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
107struct 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
118void nv50_disp_chan_mthd(struct nvkm_disp_chan *, int debug);
119
120extern const struct nvkm_disp_mthd_list nv50_disp_core_mthd_base;
121extern const struct nvkm_disp_mthd_list nv50_disp_core_mthd_sor;
122extern const struct nvkm_disp_mthd_list nv50_disp_core_mthd_pior;
123extern const struct nvkm_disp_mthd_list nv50_disp_base_mthd_image;
124
125extern const struct nvkm_disp_chan_mthd g84_disp_core_mthd;
126extern const struct nvkm_disp_mthd_list g84_disp_core_mthd_dac;
127extern const struct nvkm_disp_mthd_list g84_disp_core_mthd_head;
128
129extern const struct nvkm_disp_chan_mthd g94_disp_core_mthd;
130
131extern const struct nvkm_disp_mthd_list gf119_disp_core_mthd_base;
132extern const struct nvkm_disp_mthd_list gf119_disp_core_mthd_dac;
133extern const struct nvkm_disp_mthd_list gf119_disp_core_mthd_sor;
134extern const struct nvkm_disp_mthd_list gf119_disp_core_mthd_pior;
135extern const struct nvkm_disp_chan_mthd gf119_disp_base_mthd;
136
137extern const struct nvkm_disp_chan_mthd gk104_disp_core_mthd;
138extern const struct nvkm_disp_chan_mthd gk104_disp_ovly_mthd;
139#endif
140