1 /* SPDX-License-Identifier: MIT */
2 #ifndef __NOUVEAU_CHAN_H__
3 #define __NOUVEAU_CHAN_H__
4 #include <nvif/object.h>
5 #include <nvif/event.h>
6 #include <nvif/push.h>
7 struct nvif_device;
8 
9 struct nouveau_channel {
10 	struct {
11 		struct nvif_push _push;
12 		struct nvif_push *push;
13 	} chan;
14 
15 	struct nouveau_cli *cli;
16 	struct nvif_device *device;
17 	struct nouveau_drm *drm;
18 	struct nouveau_vmm *vmm;
19 
20 	struct nvif_mem mem_userd;
21 	struct nvif_object *userd;
22 
23 	int runlist;
24 	int chid;
25 	u64 inst;
26 	u32 token;
27 
28 	struct nvif_object vram;
29 	struct nvif_object gart;
30 	struct nvif_object nvsw;
31 
32 	struct {
33 		struct nouveau_bo *buffer;
34 		struct nouveau_vma *vma;
35 		struct nvif_object ctxdma;
36 		u64 addr;
37 	} push;
38 
39 	/* TODO: this will be reworked in the near future */
40 	bool accel_done;
41 	void *fence;
42 	struct {
43 		int max;
44 		int free;
45 		int cur;
46 		int put;
47 		int ib_base;
48 		int ib_max;
49 		int ib_free;
50 		int ib_put;
51 	} dma;
52 	u32 user_get_hi;
53 	u32 user_get;
54 	u32 user_put;
55 
56 	struct nvif_object user;
57 	struct nvif_object blit;
58 
59 	struct nvif_event kill;
60 	atomic_t killed;
61 };
62 
63 int nouveau_channels_init(struct nouveau_drm *);
64 void nouveau_channels_fini(struct nouveau_drm *);
65 
66 int  nouveau_channel_new(struct nouveau_cli *, bool priv, u64 runm,
67 			 u32 vram, u32 gart, struct nouveau_channel **);
68 void nouveau_channel_del(struct nouveau_channel **);
69 int  nouveau_channel_idle(struct nouveau_channel *);
70 void nouveau_channel_kill(struct nouveau_channel *);
71 
72 extern int nouveau_vram_pushbuf;
73 
74 #endif
75