GNU Linux-libre 4.14.290-gnu1
[releases.git] / drivers / gpu / drm / nouveau / nvkm / engine / disp / channv50.h
1 /* SPDX-License-Identifier: GPL-2.0 */
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 "nv50.h"
6
7 struct nv50_disp_chan {
8         const struct nv50_disp_chan_func *func;
9         const struct nv50_disp_chan_mthd *mthd;
10         struct nv50_disp_root *root;
11
12         struct {
13                 int ctrl;
14                 int user;
15         } chid;
16         int head;
17
18         struct nvkm_object object;
19 };
20
21 struct nv50_disp_chan_func {
22         void *(*dtor)(struct nv50_disp_chan *);
23         int (*init)(struct nv50_disp_chan *);
24         void (*fini)(struct nv50_disp_chan *);
25         int (*child_get)(struct nv50_disp_chan *, int index,
26                          struct nvkm_oclass *);
27         int (*child_new)(struct nv50_disp_chan *, const struct nvkm_oclass *,
28                          void *data, u32 size, struct nvkm_object **);
29 };
30
31 int nv50_disp_chan_ctor(const struct nv50_disp_chan_func *,
32                         const struct nv50_disp_chan_mthd *,
33                         struct nv50_disp_root *, int ctrl, int user, int head,
34                         const struct nvkm_oclass *, struct nv50_disp_chan *);
35 int nv50_disp_chan_new_(const struct nv50_disp_chan_func *,
36                         const struct nv50_disp_chan_mthd *,
37                         struct nv50_disp_root *, int ctrl, int user, int head,
38                         const struct nvkm_oclass *, struct nvkm_object **);
39
40 extern const struct nv50_disp_chan_func nv50_disp_pioc_func;
41 extern const struct nv50_disp_chan_func gf119_disp_pioc_func;
42
43 extern const struct nvkm_event_func nv50_disp_chan_uevent;
44 int  nv50_disp_chan_uevent_ctor(struct nvkm_object *, void *, u32,
45                                 struct nvkm_notify *);
46 void nv50_disp_chan_uevent_send(struct nv50_disp *, int);
47
48 extern const struct nvkm_event_func gf119_disp_chan_uevent;
49
50 struct nv50_disp_mthd_list {
51         u32 mthd;
52         u32 addr;
53         struct {
54                 u32 mthd;
55                 u32 addr;
56                 const char *name;
57         } data[];
58 };
59
60 struct nv50_disp_chan_mthd {
61         const char *name;
62         u32 addr;
63         s32 prev;
64         struct {
65                 const char *name;
66                 int nr;
67                 const struct nv50_disp_mthd_list *mthd;
68         } data[];
69 };
70
71 void nv50_disp_chan_mthd(struct nv50_disp_chan *, int debug);
72
73 extern const struct nv50_disp_mthd_list nv50_disp_core_mthd_base;
74 extern const struct nv50_disp_mthd_list nv50_disp_core_mthd_sor;
75 extern const struct nv50_disp_mthd_list nv50_disp_core_mthd_pior;
76 extern const struct nv50_disp_mthd_list nv50_disp_base_mthd_image;
77
78 extern const struct nv50_disp_chan_mthd g84_disp_core_chan_mthd;
79 extern const struct nv50_disp_mthd_list g84_disp_core_mthd_dac;
80 extern const struct nv50_disp_mthd_list g84_disp_core_mthd_head;
81 extern const struct nv50_disp_chan_mthd g84_disp_base_chan_mthd;
82 extern const struct nv50_disp_chan_mthd g84_disp_ovly_chan_mthd;
83
84 extern const struct nv50_disp_chan_mthd g94_disp_core_chan_mthd;
85
86 extern const struct nv50_disp_mthd_list gf119_disp_core_mthd_base;
87 extern const struct nv50_disp_mthd_list gf119_disp_core_mthd_dac;
88 extern const struct nv50_disp_mthd_list gf119_disp_core_mthd_sor;
89 extern const struct nv50_disp_mthd_list gf119_disp_core_mthd_pior;
90 extern const struct nv50_disp_chan_mthd gf119_disp_base_chan_mthd;
91
92 extern const struct nv50_disp_chan_mthd gk104_disp_core_chan_mthd;
93 extern const struct nv50_disp_chan_mthd gk104_disp_ovly_chan_mthd;
94
95 struct nv50_disp_pioc_oclass {
96         int (*ctor)(const struct nv50_disp_chan_func *,
97                     const struct nv50_disp_chan_mthd *,
98                     struct nv50_disp_root *, int ctrl, int user,
99                     const struct nvkm_oclass *, void *data, u32 size,
100                     struct nvkm_object **);
101         struct nvkm_sclass base;
102         const struct nv50_disp_chan_func *func;
103         const struct nv50_disp_chan_mthd *mthd;
104         struct {
105                 int ctrl;
106                 int user;
107         } chid;
108 };
109
110 extern const struct nv50_disp_pioc_oclass nv50_disp_oimm_oclass;
111 extern const struct nv50_disp_pioc_oclass nv50_disp_curs_oclass;
112
113 extern const struct nv50_disp_pioc_oclass g84_disp_oimm_oclass;
114 extern const struct nv50_disp_pioc_oclass g84_disp_curs_oclass;
115
116 extern const struct nv50_disp_pioc_oclass gt215_disp_oimm_oclass;
117 extern const struct nv50_disp_pioc_oclass gt215_disp_curs_oclass;
118
119 extern const struct nv50_disp_pioc_oclass gf119_disp_oimm_oclass;
120 extern const struct nv50_disp_pioc_oclass gf119_disp_curs_oclass;
121
122 extern const struct nv50_disp_pioc_oclass gk104_disp_oimm_oclass;
123 extern const struct nv50_disp_pioc_oclass gk104_disp_curs_oclass;
124
125 extern const struct nv50_disp_pioc_oclass gp102_disp_oimm_oclass;
126 extern const struct nv50_disp_pioc_oclass gp102_disp_curs_oclass;
127
128 int nv50_disp_curs_new(const struct nv50_disp_chan_func *,
129                        const struct nv50_disp_chan_mthd *,
130                        struct nv50_disp_root *, int ctrl, int user,
131                        const struct nvkm_oclass *, void *data, u32 size,
132                        struct nvkm_object **);
133 int nv50_disp_oimm_new(const struct nv50_disp_chan_func *,
134                        const struct nv50_disp_chan_mthd *,
135                        struct nv50_disp_root *, int ctrl, int user,
136                        const struct nvkm_oclass *, void *data, u32 size,
137                        struct nvkm_object **);
138 #endif