xref: /linux/drivers/gpu/drm/nouveau/nouveau_chan.h (revision ed7171ff9fabc49ae6ed42fbd082a576473836fc)
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 	} chan;
13 
14 	struct nouveau_cli *cli;
15 	struct nouveau_vmm *vmm;
16 
17 	struct nvif_mem mem_userd;
18 	struct nvif_object *userd;
19 
20 	int runlist;
21 	int chid;
22 	u64 inst;
23 	u32 token;
24 
25 	struct nvif_object vram;
26 	struct nvif_object gart;
27 	struct nvif_object nvsw;
28 
29 	struct {
30 		struct nouveau_bo *buffer;
31 		struct nouveau_vma *vma;
32 		struct nvif_object ctxdma;
33 		u64 addr;
34 	} push;
35 
36 	/* TODO: this will be reworked in the near future */
37 	bool accel_done;
38 	void *fence;
39 	struct {
40 		int max;
41 		int free;
42 		int cur;
43 		int put;
44 		int ib_base;
45 		int ib_max;
46 		int ib_free;
47 		int ib_put;
48 	} dma;
49 	u32 user_get_hi;
50 	u32 user_get;
51 	u32 user_put;
52 
53 	struct nvif_object user;
54 	struct nvif_object blit;
55 
56 	struct nvif_event kill;
57 	atomic_t killed;
58 };
59 
60 int nouveau_channels_init(struct nouveau_drm *);
61 void nouveau_channels_fini(struct nouveau_drm *);
62 
63 int  nouveau_channel_new(struct nouveau_cli *, bool priv, u64 runm,
64 			 u32 vram, u32 gart, struct nouveau_channel **);
65 void nouveau_channel_del(struct nouveau_channel **);
66 int  nouveau_channel_idle(struct nouveau_channel *);
67 void nouveau_channel_kill(struct nouveau_channel *);
68 
69 extern int nouveau_vram_pushbuf;
70 
71 #endif
72