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