diff options
author | Joshua Bakita <bakitajoshua@gmail.com> | 2023-06-28 18:24:25 -0400 |
---|---|---|
committer | Joshua Bakita <bakitajoshua@gmail.com> | 2023-06-28 18:24:25 -0400 |
commit | 01e6fac4d61fdd7fff5433942ec93fc2ea1e4df1 (patch) | |
tree | 4ef34501728a087be24f4ba0af90f91486bf780b /include/os/linux/dmabuf_vidmem.h | |
parent | 306a03d18b305e4e573be3b2931978fa10679eb9 (diff) |
Include nvgpu headers
These are needed to build on NVIDIA's Jetson boards for the time
being. Only a couple structs are required, so it should be fairly
easy to remove this dependency at some point in the future.
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 | ||