diff options
Diffstat (limited to 'include/os/linux/dmabuf_vidmem.h')
-rw-r--r-- | include/os/linux/dmabuf_vidmem.h | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/include/os/linux/dmabuf_vidmem.h b/include/os/linux/dmabuf_vidmem.h new file mode 100644 index 0000000..977fd78 --- /dev/null +++ b/include/os/linux/dmabuf_vidmem.h | |||
@@ -0,0 +1,78 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | |||
17 | #ifndef __NVGPU_LINUX_DMABUF_VIDMEM_H__ | ||
18 | #define __NVGPU_LINUX_DMABUF_VIDMEM_H__ | ||
19 | |||
20 | #include <nvgpu/types.h> | ||
21 | |||
22 | struct dma_buf; | ||
23 | |||
24 | struct gk20a; | ||
25 | struct scatterlist; | ||
26 | |||
27 | #ifdef CONFIG_GK20A_VIDMEM | ||
28 | |||
29 | struct gk20a *nvgpu_vidmem_buf_owner(struct dma_buf *dmabuf); | ||
30 | int nvgpu_vidmem_export_linux(struct gk20a *g, size_t bytes); | ||
31 | |||
32 | void nvgpu_vidmem_set_page_alloc(struct scatterlist *sgl, u64 addr); | ||
33 | struct nvgpu_page_alloc *nvgpu_vidmem_get_page_alloc(struct scatterlist *sgl); | ||
34 | |||
35 | int nvgpu_vidmem_buf_access_memory(struct gk20a *g, struct dma_buf *dmabuf, | ||
36 | void *buffer, u64 offset, u64 size, u32 cmd); | ||
37 | |||
38 | #else /* !CONFIG_GK20A_VIDMEM */ | ||
39 | |||
40 | static inline struct gk20a *nvgpu_vidmem_buf_owner(struct dma_buf *dmabuf) | ||
41 | { | ||
42 | return NULL; | ||
43 | } | ||
44 | |||
45 | static inline int nvgpu_vidmem_export_linux(struct gk20a *g, size_t bytes) | ||
46 | { | ||
47 | return -ENOSYS; | ||
48 | } | ||
49 | |||
50 | static inline void nvgpu_vidmem_set_page_alloc(struct scatterlist *sgl, | ||
51 | u64 addr) | ||
52 | { | ||
53 | } | ||
54 | |||
55 | static inline struct nvgpu_page_alloc *nvgpu_vidmem_get_page_alloc( | ||
56 | struct scatterlist *sgl) | ||
57 | { | ||
58 | return NULL; | ||
59 | } | ||
60 | |||
61 | static inline int nvgpu_vidmem_buf_access_memory(struct gk20a *g, | ||
62 | struct dma_buf *dmabuf, | ||
63 | void *buffer, u64 offset, | ||
64 | u64 size, u32 cmd) | ||
65 | { | ||
66 | return -ENOSYS; | ||
67 | } | ||
68 | |||
69 | #endif | ||
70 | |||
71 | |||
72 | struct nvgpu_vidmem_linux { | ||
73 | struct dma_buf *dmabuf; | ||
74 | void *dmabuf_priv; | ||
75 | void (*dmabuf_priv_delete)(void *); | ||
76 | }; | ||
77 | |||
78 | #endif | ||