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