7 /* Supported class information, provided by the kernel */
8 struct nouveau_sclass {
14 /* Client-provided array describing class versions that are desired.
16 * These are used to match against the kernel's list of supported classes.
18 struct nouveau_mclass {
24 struct nouveau_object {
25 struct nouveau_object *parent;
28 uint32_t length; /* deprecated */
29 void *data; /* deprecated */
32 int nouveau_object_new(struct nouveau_object *parent, uint64_t handle,
33 uint32_t oclass, void *data, uint32_t length,
34 struct nouveau_object **);
35 void nouveau_object_del(struct nouveau_object **);
36 int nouveau_object_mthd(struct nouveau_object *, uint32_t mthd,
37 void *data, uint32_t size);
38 int nouveau_object_sclass_get(struct nouveau_object *,
39 struct nouveau_sclass **);
40 void nouveau_object_sclass_put(struct nouveau_sclass **);
41 int nouveau_object_mclass(struct nouveau_object *,
42 const struct nouveau_mclass *);
45 struct nouveau_object client;
51 static inline struct nouveau_drm *
52 nouveau_drm(struct nouveau_object *obj)
54 while (obj && obj->parent)
56 return (struct nouveau_drm *)obj;
59 int nouveau_drm_new(int fd, struct nouveau_drm **);
60 void nouveau_drm_del(struct nouveau_drm **);
62 struct nouveau_device {
63 struct nouveau_object object;
64 int fd; /* deprecated */
65 uint32_t lib_version; /* deprecated */
66 uint32_t drm_version; /* deprecated */
74 int nouveau_device_new(struct nouveau_object *parent, int32_t oclass,
75 void *data, uint32_t size, struct nouveau_device **);
76 void nouveau_device_del(struct nouveau_device **);
78 int nouveau_getparam(struct nouveau_device *, uint64_t param, uint64_t *value);
79 int nouveau_setparam(struct nouveau_device *, uint64_t param, uint64_t value);
82 int nouveau_device_wrap(int fd, int close, struct nouveau_device **);
83 int nouveau_device_open(const char *busid, struct nouveau_device **);
85 struct nouveau_client {
86 struct nouveau_device *device;
90 int nouveau_client_new(struct nouveau_device *, struct nouveau_client **);
91 void nouveau_client_del(struct nouveau_client **);
93 union nouveau_bo_config {
95 #define NV04_BO_16BPP 0x00000001
96 #define NV04_BO_32BPP 0x00000002
97 #define NV04_BO_ZETA 0x00000004
112 #define NOUVEAU_BO_VRAM 0x00000001
113 #define NOUVEAU_BO_GART 0x00000002
114 #define NOUVEAU_BO_APER (NOUVEAU_BO_VRAM | NOUVEAU_BO_GART)
115 #define NOUVEAU_BO_RD 0x00000100
116 #define NOUVEAU_BO_WR 0x00000200
117 #define NOUVEAU_BO_RDWR (NOUVEAU_BO_RD | NOUVEAU_BO_WR)
118 #define NOUVEAU_BO_NOBLOCK 0x00000400
119 #define NOUVEAU_BO_LOW 0x00001000
120 #define NOUVEAU_BO_HIGH 0x00002000
121 #define NOUVEAU_BO_OR 0x00004000
122 #define NOUVEAU_BO_MAP 0x80000000
123 #define NOUVEAU_BO_CONTIG 0x40000000
124 #define NOUVEAU_BO_NOSNOOP 0x20000000
125 #define NOUVEAU_BO_COHERENT 0x10000000
128 struct nouveau_device *device;
134 union nouveau_bo_config config;
137 int nouveau_bo_new(struct nouveau_device *, uint32_t flags, uint32_t align,
138 uint64_t size, union nouveau_bo_config *,
139 struct nouveau_bo **);
140 int nouveau_bo_wrap(struct nouveau_device *, uint32_t handle,
141 struct nouveau_bo **);
142 int nouveau_bo_name_ref(struct nouveau_device *v, uint32_t name,
143 struct nouveau_bo **);
144 int nouveau_bo_name_get(struct nouveau_bo *, uint32_t *name);
145 void nouveau_bo_ref(struct nouveau_bo *, struct nouveau_bo **);
146 int nouveau_bo_map(struct nouveau_bo *, uint32_t access,
147 struct nouveau_client *);
148 int nouveau_bo_wait(struct nouveau_bo *, uint32_t access,
149 struct nouveau_client *);
150 int nouveau_bo_prime_handle_ref(struct nouveau_device *, int prime_fd,
151 struct nouveau_bo **);
152 int nouveau_bo_set_prime(struct nouveau_bo *, int *prime_fd);
154 struct nouveau_list {
155 struct nouveau_list *prev;
156 struct nouveau_list *next;
159 struct nouveau_bufref {
160 struct nouveau_list thead;
161 struct nouveau_bo *bo;
171 struct nouveau_bufctx {
172 struct nouveau_client *client;
173 struct nouveau_list head;
174 struct nouveau_list pending;
175 struct nouveau_list current;
179 int nouveau_bufctx_new(struct nouveau_client *, int bins,
180 struct nouveau_bufctx **);
181 void nouveau_bufctx_del(struct nouveau_bufctx **);
182 struct nouveau_bufref *
183 nouveau_bufctx_refn(struct nouveau_bufctx *, int bin,
184 struct nouveau_bo *, uint32_t flags);
185 struct nouveau_bufref *
186 nouveau_bufctx_mthd(struct nouveau_bufctx *, int bin, uint32_t packet,
187 struct nouveau_bo *, uint64_t data, uint32_t flags,
188 uint32_t vor, uint32_t tor);
189 void nouveau_bufctx_reset(struct nouveau_bufctx *, int bin);
191 struct nouveau_pushbuf_krec;
192 struct nouveau_pushbuf {
193 struct nouveau_client *client;
194 struct nouveau_object *channel;
195 struct nouveau_bufctx *bufctx;
196 void (*kick_notify)(struct nouveau_pushbuf *);
204 struct nouveau_pushbuf_refn {
205 struct nouveau_bo *bo;
209 int nouveau_pushbuf_new(struct nouveau_client *, struct nouveau_object *chan,
210 int nr, uint32_t size, bool immediate,
211 struct nouveau_pushbuf **);
212 void nouveau_pushbuf_del(struct nouveau_pushbuf **);
213 int nouveau_pushbuf_space(struct nouveau_pushbuf *, uint32_t dwords,
214 uint32_t relocs, uint32_t pushes);
215 void nouveau_pushbuf_data(struct nouveau_pushbuf *, struct nouveau_bo *,
216 uint64_t offset, uint64_t length);
217 int nouveau_pushbuf_refn(struct nouveau_pushbuf *,
218 struct nouveau_pushbuf_refn *, int nr);
219 /* Emits a reloc into the push buffer at the current position, you *must*
220 * have previously added the referenced buffer to a buffer context, and
221 * validated it against the current push buffer.
223 void nouveau_pushbuf_reloc(struct nouveau_pushbuf *, struct nouveau_bo *,
224 uint32_t data, uint32_t flags,
225 uint32_t vor, uint32_t tor);
226 int nouveau_pushbuf_validate(struct nouveau_pushbuf *);
227 uint32_t nouveau_pushbuf_refd(struct nouveau_pushbuf *, struct nouveau_bo *);
228 int nouveau_pushbuf_kick(struct nouveau_pushbuf *, struct nouveau_object *chan);
229 struct nouveau_bufctx *
230 nouveau_pushbuf_bufctx(struct nouveau_pushbuf *, struct nouveau_bufctx *);
232 #define NOUVEAU_DEVICE_CLASS 0x80000000
233 #define NOUVEAU_FIFO_CHANNEL_CLASS 0x80000001
234 #define NOUVEAU_NOTIFIER_CLASS 0x80000002
236 struct nouveau_fifo {
237 struct nouveau_object *object;
244 struct nouveau_fifo base;
251 struct nouveau_fifo base;
255 #define NVE0_FIFO_ENGINE_GR 0x00000001
256 #define NVE0_FIFO_ENGINE_VP 0x00000002
257 #define NVE0_FIFO_ENGINE_PPP 0x00000004
258 #define NVE0_FIFO_ENGINE_BSP 0x00000008
259 #define NVE0_FIFO_ENGINE_CE0 0x00000010
260 #define NVE0_FIFO_ENGINE_CE1 0x00000020
261 #define NVE0_FIFO_ENGINE_ENC 0x00000040
265 struct nouveau_fifo base;
272 struct nouveau_object *object;