Merge tag 'exynos-drm-next-for-v4.15' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-2.6-block.git] / drivers / gpu / drm / nouveau / include / nvkm / core / gpuobj.h
1 #ifndef __NVKM_GPUOBJ_H__
2 #define __NVKM_GPUOBJ_H__
3 #include <core/memory.h>
4 #include <core/mm.h>
5
6 #define NVOBJ_FLAG_ZERO_ALLOC 0x00000001
7 #define NVOBJ_FLAG_HEAP       0x00000004
8
9 struct nvkm_gpuobj {
10         union {
11                 const struct nvkm_gpuobj_func *func;
12                 const struct nvkm_gpuobj_func *ptrs;
13         };
14         struct nvkm_gpuobj *parent;
15         struct nvkm_memory *memory;
16         struct nvkm_mm_node *node;
17
18         u64 addr;
19         u32 size;
20         struct nvkm_mm heap;
21
22         void __iomem *map;
23 };
24
25 struct nvkm_gpuobj_func {
26         void *(*acquire)(struct nvkm_gpuobj *);
27         void (*release)(struct nvkm_gpuobj *);
28         u32 (*rd32)(struct nvkm_gpuobj *, u32 offset);
29         void (*wr32)(struct nvkm_gpuobj *, u32 offset, u32 data);
30         int (*map)(struct nvkm_gpuobj *, u64 offset, struct nvkm_vmm *,
31                    struct nvkm_vma *, void *argv, u32 argc);
32 };
33
34 int nvkm_gpuobj_new(struct nvkm_device *, u32 size, int align, bool zero,
35                     struct nvkm_gpuobj *parent, struct nvkm_gpuobj **);
36 void nvkm_gpuobj_del(struct nvkm_gpuobj **);
37 int nvkm_gpuobj_wrap(struct nvkm_memory *, struct nvkm_gpuobj **);
38 void nvkm_gpuobj_memcpy_to(struct nvkm_gpuobj *dst, u32 dstoffset, void *src,
39                            u32 length);
40 void nvkm_gpuobj_memcpy_from(void *dst, struct nvkm_gpuobj *src, u32 srcoffset,
41                              u32 length);
42 #endif