1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __NOUVEAU_CHAN_H__
3 #define __NOUVEAU_CHAN_H__
4 #include <nvif/object.h>
5 #include <nvif/notify.h>
6 struct nvif_device;
7 
8 struct nouveau_channel {
9 	struct nvif_device *device;
10 	struct nouveau_drm *drm;
11 
12 	int chid;
13 	u64 inst;
14 	u32 token;
15 
16 	struct nvif_object vram;
17 	struct nvif_object gart;
18 	struct nvif_object nvsw;
19 
20 	struct {
21 		struct nouveau_bo *buffer;
22 		struct nouveau_vma *vma;
23 		struct nvif_object ctxdma;
24 		u64 addr;
25 	} push;
26 
27 	/* TODO: this will be reworked in the near future */
28 	bool accel_done;
29 	void *fence;
30 	struct {
31 		int max;
32 		int free;
33 		int cur;
34 		int put;
35 		int ib_base;
36 		int ib_max;
37 		int ib_free;
38 		int ib_put;
39 	} dma;
40 	u32 user_get_hi;
41 	u32 user_get;
42 	u32 user_put;
43 
44 	struct nvif_object user;
45 
46 	struct nvif_notify kill;
47 	atomic_t killed;
48 };
49 
50 int nouveau_channels_init(struct nouveau_drm *);
51 
52 int  nouveau_channel_new(struct nouveau_drm *, struct nvif_device *,
53 			 u32 arg0, u32 arg1, bool priv,
54 			 struct nouveau_channel **);
55 void nouveau_channel_del(struct nouveau_channel **);
56 int  nouveau_channel_idle(struct nouveau_channel *);
57 
58 extern int nouveau_vram_pushbuf;
59 
60 #endif
61