diff options
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/ion/ion.c | 71 | ||||
-rw-r--r-- | drivers/gpu/ion/ion_priv.h | 72 | ||||
-rw-r--r-- | drivers/gpu/ion/omap/omap_ion.c | 2 | ||||
-rwxr-xr-x | drivers/gpu/ion/omap/omap_tiler_heap.c | 1 |
4 files changed, 75 insertions, 71 deletions
diff --git a/drivers/gpu/ion/ion.c b/drivers/gpu/ion/ion.c index 2bb559b3..b35ff4b 100644 --- a/drivers/gpu/ion/ion.c +++ b/drivers/gpu/ion/ion.c @@ -33,77 +33,6 @@ #include "ion_priv.h" #define DEBUG -/** - * struct ion_device - the metadata of the ion device node - * @dev: the actual misc device - * @buffers: an rb tree of all the existing buffers - * @lock: lock protecting the buffers & heaps trees - * @heaps: list of all the heaps in the system - * @user_clients: list of all the clients created from userspace - */ -struct ion_device { - struct miscdevice dev; - struct rb_root buffers; - struct mutex lock; - struct rb_root heaps; - long (*custom_ioctl) (struct ion_client *client, unsigned int cmd, - unsigned long arg); - struct rb_root user_clients; - struct rb_root kernel_clients; - struct dentry *debug_root; -}; - -/** - * struct ion_client - a process/hw block local address space - * @ref: for reference counting the client - * @node: node in the tree of all clients - * @dev: backpointer to ion device - * @handles: an rb tree of all the handles in this client - * @lock: lock protecting the tree of handles - * @heap_mask: mask of all supported heaps - * @name: used for debugging - * @task: used for debugging - * - * A client represents a list of buffers this client may access. - * The mutex stored here is used to protect both handles tree - * as well as the handles themselves, and should be held while modifying either. - */ -struct ion_client { - struct kref ref; - struct rb_node node; - struct ion_device *dev; - struct rb_root handles; - struct mutex lock; - unsigned int heap_mask; - const char *name; - struct task_struct *task; - pid_t pid; - struct dentry *debug_root; -}; - -/** - * ion_handle - a client local reference to a buffer - * @ref: reference count - * @client: back pointer to the client the buffer resides in - * @buffer: pointer to the buffer - * @node: node in the client's handle rbtree - * @kmap_cnt: count of times this client has mapped to kernel - * @dmap_cnt: count of times this client has mapped for dma - * @usermap_cnt: count of times this client has mapped for userspace - * - * Modifications to node, map_cnt or mapping should be protected by the - * lock in the client. Other fields are never changed after initialization. - */ -struct ion_handle { - struct kref ref; - struct ion_client *client; - struct ion_buffer *buffer; - struct rb_node node; - unsigned int kmap_cnt; - unsigned int dmap_cnt; - unsigned int usermap_cnt; -}; - /* this function should only be called while dev->lock is held */ static void ion_buffer_add(struct ion_device *dev, struct ion_buffer *buffer) diff --git a/drivers/gpu/ion/ion_priv.h b/drivers/gpu/ion/ion_priv.h index 3323954..cf5fe60 100644 --- a/drivers/gpu/ion/ion_priv.h +++ b/drivers/gpu/ion/ion_priv.h @@ -22,6 +22,7 @@ #include <linux/mutex.h> #include <linux/rbtree.h> #include <linux/ion.h> +#include <linux/miscdevice.h> struct ion_mapping; @@ -35,6 +36,77 @@ struct ion_kernel_mapping { void *vaddr; }; +/** + * struct ion_device - the metadata of the ion device node + * @dev: the actual misc device + * @buffers: an rb tree of all the existing buffers + * @lock: lock protecting the buffers & heaps trees + * @heaps: list of all the heaps in the system + * @user_clients: list of all the clients created from userspace + */ +struct ion_device { + struct miscdevice dev; + struct rb_root buffers; + struct mutex lock; + struct rb_root heaps; + long (*custom_ioctl) (struct ion_client *client, unsigned int cmd, + unsigned long arg); + struct rb_root user_clients; + struct rb_root kernel_clients; + struct dentry *debug_root; +}; + +/** + * struct ion_client - a process/hw block local address space + * @ref: for reference counting the client + * @node: node in the tree of all clients + * @dev: backpointer to ion device + * @handles: an rb tree of all the handles in this client + * @lock: lock protecting the tree of handles + * @heap_mask: mask of all supported heaps + * @name: used for debugging + * @task: used for debugging + * + * A client represents a list of buffers this client may access. + * The mutex stored here is used to protect both handles tree + * as well as the handles themselves, and should be held while modifying either. + */ +struct ion_client { + struct kref ref; + struct rb_node node; + struct ion_device *dev; + struct rb_root handles; + struct mutex lock; + unsigned int heap_mask; + const char *name; + struct task_struct *task; + pid_t pid; + struct dentry *debug_root; +}; + +/** + * ion_handle - a client local reference to a buffer + * @ref: reference count + * @client: back pointer to the client the buffer resides in + * @buffer: pointer to the buffer + * @node: node in the client's handle rbtree + * @kmap_cnt: count of times this client has mapped to kernel + * @dmap_cnt: count of times this client has mapped for dma + * @usermap_cnt: count of times this client has mapped for userspace + * + * Modifications to node, map_cnt or mapping should be protected by the + * lock in the client. Other fields are never changed after initialization. + */ +struct ion_handle { + struct kref ref; + struct ion_client *client; + struct ion_buffer *buffer; + struct rb_node node; + unsigned int kmap_cnt; + unsigned int dmap_cnt; + unsigned int usermap_cnt; +}; + struct ion_buffer *ion_handle_buffer(struct ion_handle *handle); /** diff --git a/drivers/gpu/ion/omap/omap_ion.c b/drivers/gpu/ion/omap/omap_ion.c index 7377615..5d65205 100644 --- a/drivers/gpu/ion/omap/omap_ion.c +++ b/drivers/gpu/ion/omap/omap_ion.c @@ -39,6 +39,7 @@ int omap_ion_tiler_alloc(struct ion_client *client, { return omap_tiler_alloc(tiler_heap, client, data); } +EXPORT_SYMBOL(omap_ion_tiler_alloc); int omap_ion_nonsecure_tiler_alloc(struct ion_client *client, struct omap_ion_tiler_alloc_data *data) @@ -47,6 +48,7 @@ int omap_ion_nonsecure_tiler_alloc(struct ion_client *client, return -ENOMEM; return omap_tiler_alloc(nonsecure_tiler_heap, client, data); } +EXPORT_SYMBOL(omap_ion_nonsecure_tiler_alloc); long omap_ion_ioctl(struct ion_client *client, unsigned int cmd, unsigned long arg) diff --git a/drivers/gpu/ion/omap/omap_tiler_heap.c b/drivers/gpu/ion/omap/omap_tiler_heap.c index 0cf033e..c5e42cc 100755 --- a/drivers/gpu/ion/omap/omap_tiler_heap.c +++ b/drivers/gpu/ion/omap/omap_tiler_heap.c @@ -287,6 +287,7 @@ int omap_tiler_pages(struct ion_client *client, struct ion_handle *handle, *tiler_addrs = info->tiler_addrs; return 0; } +EXPORT_SYMBOL(omap_tiler_pages); int omap_tiler_vinfo(struct ion_client *client, struct ion_handle *handle, unsigned int *vstride, unsigned int *vsize) |