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