xref: /netbsd-src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_mem.h (revision 41ec02673d281bbb3d38e6c78504ce6e30c228c1)
1 /*	$NetBSD: nouveau_mem.h,v 1.2 2021/12/18 23:45:32 riastradh Exp $	*/
2 
3 #ifndef __NOUVEAU_MEM_H__
4 #define __NOUVEAU_MEM_H__
5 #include <drm/ttm/ttm_bo_api.h>
6 struct ttm_dma_tt;
7 
8 #include <nvif/mem.h>
9 #include <nvif/vmm.h>
10 
11 static inline struct nouveau_mem *
nouveau_mem(struct ttm_mem_reg * reg)12 nouveau_mem(struct ttm_mem_reg *reg)
13 {
14 	return reg->mm_node;
15 }
16 
17 struct nouveau_mem {
18 	struct nouveau_cli *cli;
19 	u8 kind;
20 	u8 comp;
21 	struct nvif_mem mem;
22 	struct nvif_vma vma[2];
23 };
24 
25 int nouveau_mem_new(struct nouveau_cli *, u8 kind, u8 comp,
26 		    struct ttm_mem_reg *);
27 void nouveau_mem_del(struct ttm_mem_reg *);
28 int nouveau_mem_vram(struct ttm_mem_reg *, bool contig, u8 page);
29 int nouveau_mem_host(struct ttm_mem_reg *, struct ttm_dma_tt *);
30 void nouveau_mem_fini(struct nouveau_mem *);
31 int nouveau_mem_map(struct nouveau_mem *, struct nvif_vmm *, struct nvif_vma *);
32 #endif
33