summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRebecca Schultz Zavin <rebecca@android.com>2012-02-01 11:09:46 -0800
committerArve Hjønnevåg <arve@android.com>2013-06-11 17:46:37 -0700
commite36d6d89cd34f1abd606149ed9fb910636d7c8ec (patch)
tree3a901c4c6ee3453ca93a057deecce98b2e0ce0a5 /include
parent7ff0c8006a42d110ff5fe2a5183053169c46a69f (diff)
ion: Switch ion to use dma-buf
Ion now uses dma-buf file descriptors to share buffers with userspace. Ion becomes a dma-buf exporter and any driver that can import dma-bufs can now import ion file descriptors. Change-Id: Ia04d6d72fb301dc088eb8db6576822e9260ff332 Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/ion.h58
1 files changed, 9 insertions, 49 deletions
diff --git a/include/linux/ion.h b/include/linux/ion.h
index 860b160ab5ed..3bf85fd0438b 100644
--- a/include/linux/ion.h
+++ b/include/linux/ion.h
@@ -176,63 +176,23 @@ void *ion_map_kernel(struct ion_client *client, struct ion_handle *handle);
void ion_unmap_kernel(struct ion_client *client, struct ion_handle *handle);
/**
- * ion_map_dma - create a dma mapping for a given handle
+ * ion_share_dma_buf() - given an ion client, create a dma-buf fd
* @client: the client
- * @handle: handle to map
- *
- * Return an sg_table describing the given handle
- */
-struct sg_table *ion_map_dma(struct ion_client *client,
- struct ion_handle *handle);
-
-/**
- * ion_unmap_dma() - destroy a dma mapping for a handle
- * @client: the client
- * @handle: handle to unmap
+ * @handle: the handle
*/
-void ion_unmap_dma(struct ion_client *client, struct ion_handle *handle);
+int ion_share_dma_buf(struct ion_client *client, struct ion_handle *handle);
/**
- * ion_share() - given a handle, obtain a buffer to pass to other clients
+ * ion_import_dma_buf() - given an dma-buf fd from the ion exporter get handle
* @client: the client
- * @handle: the handle to share
+ * @fd: the dma-buf fd
*
- * Given a handle, return a buffer, which exists in a global name
- * space, and can be passed to other clients. Should be passed into ion_import
- * to obtain a new handle for this buffer.
- *
- * NOTE: This function does do not an extra reference. The burden is on the
- * caller to make sure the buffer doesn't go away while it's being passed to
- * another client. That is, ion_free should not be called on this handle until
- * the buffer has been imported into the other client.
- */
-struct ion_buffer *ion_share(struct ion_client *client,
- struct ion_handle *handle);
-
-/**
- * ion_import() - given an buffer in another client, import it
- * @client: this blocks client
- * @buffer: the buffer to import (as obtained from ion_share)
- *
- * Given a buffer, add it to the client and return the handle to use to refer
- * to it further. This is called to share a handle from one kernel client to
- * another.
+ * Given an dma-buf fd that was allocated through ion via ion_share_dma_buf,
+ * import that fd and return a handle representing it. If a dma-buf from
+ * another exporter is passed in this function will return ERR_PTR(-EINVAL)
*/
-struct ion_handle *ion_import(struct ion_client *client,
- struct ion_buffer *buffer);
+struct ion_handle *ion_import_dma_buf(struct ion_client *client, int fd);
-/**
- * ion_import_fd() - given an fd obtained via ION_IOC_SHARE ioctl, import it
- * @client: this blocks client
- * @fd: the fd
- *
- * A helper function for drivers that will be recieving ion buffers shared
- * with them from userspace. These buffers are represented by a file
- * descriptor obtained as the return from the ION_IOC_SHARE ioctl.
- * This function coverts that fd into the underlying buffer, and returns
- * the handle to use to refer to it further.
- */
-struct ion_handle *ion_import_fd(struct ion_client *client, int fd);
#endif /* __KERNEL__ */
/**