summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRebecca Schultz Zavin <rebecca@android.com>2012-12-11 11:45:59 -0800
committerArve Hjønnevåg <arve@android.com>2013-06-11 17:47:00 -0700
commit5bd35e257c54c8429036de959fda9e1f323fc379 (patch)
treeb8ad1865572e19d6fd06a55ea5d2fb411aa53edb /include
parent38ad864374411e9cd3e4f3492783fc231a4be9b0 (diff)
gpu: ion: Clarify variable names and comments around heap ids v types
There is some confusion between when to use the heap type and when the id. This patch clarifies this by using clearer variable names and describing the intention in the comments. Also fixes the client debug code to print heaps by id instead of type. Change-Id: Ie8b3dadded52e18590fcb2ca94001f6ed46ef07d Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/ion.h51
1 files changed, 28 insertions, 23 deletions
diff --git a/include/linux/ion.h b/include/linux/ion.h
index 814a7f4981a8..610665d2be71 100644
--- a/include/linux/ion.h
+++ b/include/linux/ion.h
@@ -45,6 +45,8 @@ enum ion_heap_type {
#define ION_HEAP_SYSTEM_CONTIG_MASK (1 << ION_HEAP_TYPE_SYSTEM_CONTIG)
#define ION_HEAP_CARVEOUT_MASK (1 << ION_HEAP_TYPE_CARVEOUT)
+#define ION_NUM_HEAP_IDS sizeof(unsigned int) * 8
+
/**
* heap flags - the lower 16 bits are used by core ion, the upper 16
* bits are reserved for use by the heaps themselves.
@@ -73,8 +75,9 @@ struct ion_buffer;
/**
* struct ion_platform_heap - defines a heap in the given platform
* @type: type of the heap from ion_heap_type enum
- * @id: unique identifier for heap. When allocating (lower numbers
- * will be allocated from first)
+ * @id: unique identifier for heap. When allocating higher numbers
+ * will be allocated from first. At allocation these are passed
+ * as a bit mask and therefore can not exceed ION_NUM_HEAP_IDS.
* @name: used for debug purposes
* @base: base address of heap in physical memory if applicable
* @size: size of the heap in bytes if applicable
@@ -118,12 +121,13 @@ void ion_reserve(struct ion_platform_data *data);
/**
* ion_client_create() - allocate a client and returns it
- * @dev: the global ion device
- * @heap_mask: mask of heaps this client can allocate from
- * @name: used for debugging
+ * @dev: the global ion device
+ * @heap_type_mask: mask of heaps this client can allocate from
+ * @name: used for debugging
*/
struct ion_client *ion_client_create(struct ion_device *dev,
- unsigned int heap_mask, const char *name);
+ unsigned int heap_type_mask,
+ const char *name);
/**
* ion_client_destroy() - free's a client and all it's handles
@@ -136,21 +140,22 @@ void ion_client_destroy(struct ion_client *client);
/**
* ion_alloc - allocate ion memory
- * @client: the client
- * @len: size of the allocation
- * @align: requested allocation alignment, lots of hardware blocks have
- * alignment requirements of some kind
- * @heap_mask: mask of heaps to allocate from, if multiple bits are set
- * heaps will be tried in order from lowest to highest order bit
- * @flags: heap flags, the low 16 bits are consumed by ion, the high 16
- * bits are passed on to the respective heap and can be heap
- * custom
+ * @client: the client
+ * @len: size of the allocation
+ * @align: requested allocation alignment, lots of hardware blocks
+ * have alignment requirements of some kind
+ * @heap_id_mask: mask of heaps to allocate from, if multiple bits are set
+ * heaps will be tried in order from highest to lowest
+ * id
+ * @flags: heap flags, the low 16 bits are consumed by ion, the
+ * high 16 bits are passed on to the respective heap and
+ * can be heap custom
*
* Allocate memory in one of the heaps provided in heap mask and return
* an opaque handle to it.
*/
struct ion_handle *ion_alloc(struct ion_client *client, size_t len,
- size_t align, unsigned int heap_mask,
+ size_t align, unsigned int heap_id_mask,
unsigned int flags);
/**
@@ -239,19 +244,19 @@ struct ion_handle *ion_import_dma_buf(struct ion_client *client, int fd);
/**
* struct ion_allocation_data - metadata passed from userspace for allocations
- * @len: size of the allocation
- * @align: required alignment of the allocation
- * @heap_mask: mask of heaps to allocate from
- * @flags: flags passed to heap
- * @handle: pointer that will be populated with a cookie to use to refer
- * to this allocation
+ * @len: size of the allocation
+ * @align: required alignment of the allocation
+ * @heap_id_mask: mask of heap ids to allocate from
+ * @flags: flags passed to heap
+ * @handle: pointer that will be populated with a cookie to use to
+ * refer to this allocation
*
* Provided by userspace as an argument to the ioctl
*/
struct ion_allocation_data {
size_t len;
size_t align;
- unsigned int heap_mask;
+ unsigned int heap_id_mask;
unsigned int flags;
struct ion_handle *handle;
};