summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/os/linux/dmabuf_vidmem.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/os/linux/dmabuf_vidmem.h')
-rw-r--r--drivers/gpu/nvgpu/os/linux/dmabuf_vidmem.h78
1 files changed, 78 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/os/linux/dmabuf_vidmem.h b/drivers/gpu/nvgpu/os/linux/dmabuf_vidmem.h
new file mode 100644
index 00000000..977fd78b
--- /dev/null
+++ b/drivers/gpu/nvgpu/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
22struct dma_buf;
23
24struct gk20a;
25struct scatterlist;
26
27#ifdef CONFIG_GK20A_VIDMEM
28
29struct gk20a *nvgpu_vidmem_buf_owner(struct dma_buf *dmabuf);
30int nvgpu_vidmem_export_linux(struct gk20a *g, size_t bytes);
31
32void nvgpu_vidmem_set_page_alloc(struct scatterlist *sgl, u64 addr);
33struct nvgpu_page_alloc *nvgpu_vidmem_get_page_alloc(struct scatterlist *sgl);
34
35int 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
40static inline struct gk20a *nvgpu_vidmem_buf_owner(struct dma_buf *dmabuf)
41{
42 return NULL;
43}
44
45static inline int nvgpu_vidmem_export_linux(struct gk20a *g, size_t bytes)
46{
47 return -ENOSYS;
48}
49
50static inline void nvgpu_vidmem_set_page_alloc(struct scatterlist *sgl,
51 u64 addr)
52{
53}
54
55static inline struct nvgpu_page_alloc *nvgpu_vidmem_get_page_alloc(
56 struct scatterlist *sgl)
57{
58 return NULL;
59}
60
61static 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
72struct nvgpu_vidmem_linux {
73 struct dma_buf *dmabuf;
74 void *dmabuf_priv;
75 void (*dmabuf_priv_delete)(void *);
76};
77
78#endif