aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/omap_ion.h')
-rw-r--r--include/linux/omap_ion.h103
1 files changed, 103 insertions, 0 deletions
diff --git a/include/linux/omap_ion.h b/include/linux/omap_ion.h
new file mode 100644
index 00000000000..a5e0441f123
--- /dev/null
+++ b/include/linux/omap_ion.h
@@ -0,0 +1,103 @@
1/*
2 * include/linux/omap_ion.h
3 *
4 * Copyright (C) 2011 Google, Inc.
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 */
16
17#ifndef _LINUX_OMAP_ION_H
18#define _LINUX_OMAP_ION_H
19
20#include <linux/types.h>
21
22
23/**
24 * struct omap_ion_tiler_alloc_data - metadata passed from userspace for allocations
25 * @w: width of the allocation
26 * @h: height of the allocation
27 * @fmt: format of the data (8, 16, 32bit or page)
28 * @flags: flags passed to heap
29 * @stride: stride of the allocation, returned to caller from kernel
30 * @handle: pointer that will be populated with a cookie to use to refer
31 * to this allocation
32 *
33 * Provided by userspace as an argument to the ioctl
34 */
35struct omap_ion_tiler_alloc_data {
36 size_t w;
37 size_t h;
38 int fmt;
39 unsigned int flags;
40 struct ion_handle *handle;
41 size_t stride;
42 size_t offset;
43 u32 out_align;
44 u32 token;
45};
46
47#ifdef __KERNEL__
48int omap_ion_tiler_alloc(struct ion_client *client,
49 struct omap_ion_tiler_alloc_data *data);
50int omap_ion_nonsecure_tiler_alloc(struct ion_client *client,
51 struct omap_ion_tiler_alloc_data *data);
52/* given a handle in the tiler, return a list of tiler pages that back it */
53int omap_tiler_pages(struct ion_client *client, struct ion_handle *handle,
54 int *n, u32 **tiler_pages);
55int omap_ion_fd_to_handles(int fd, struct ion_client **client,
56 struct ion_handle **handles,
57 int *num_handles);
58int omap_tiler_vinfo(struct ion_client *client,
59 struct ion_handle *handle, unsigned int *vstride,
60 unsigned int *vsize);
61
62int omap_ion_share_fd_to_buffers(int fd, struct ion_buffer **buffers,
63 int *num_handles);
64
65extern struct ion_device *omap_ion_device;
66#endif /* __KERNEL__ */
67
68/* additional heaps used only on omap */
69enum {
70 OMAP_ION_HEAP_TYPE_TILER = ION_HEAP_TYPE_CUSTOM + 1,
71 OMAP_ION_HEAP_TYPE_TILER_RESERVATION,
72};
73
74#define OMAP_ION_HEAP_TILER_MASK (1 << OMAP_ION_HEAP_TYPE_TILER)
75
76enum {
77 OMAP_ION_TILER_ALLOC,
78};
79
80/**
81 * These should match the defines in the tiler driver
82 */
83enum {
84 TILER_PIXEL_FMT_MIN = 0,
85 TILER_PIXEL_FMT_8BIT = 0,
86 TILER_PIXEL_FMT_16BIT = 1,
87 TILER_PIXEL_FMT_32BIT = 2,
88 TILER_PIXEL_FMT_PAGE = 3,
89 TILER_PIXEL_FMT_MAX = 3
90};
91
92/**
93 * List of heaps in the system
94 */
95enum {
96 OMAP_ION_HEAP_SYSTEM,
97 OMAP_ION_HEAP_TILER,
98 OMAP_ION_HEAP_SECURE_INPUT,
99 OMAP_ION_HEAP_NONSECURE_TILER,
100 OMAP_ION_HEAP_TILER_RESERVATION,
101};
102
103#endif /* _LINUX_ION_H */