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