gpu: ion: Add API to get the buffer flags

Clients may want to know what the existing flags are on a
handle for mapping, cache flushing or other purposes. Add
an API to get those flags.

Change-Id: I2d8c93194d1fc940042529b8851ebecf35d6e3de
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
This commit is contained in:
Laura Abbott
2011-10-12 14:26:33 -07:00
committed by Stephen Boyd
parent d302d3e849
commit 323102293b
2 changed files with 76 additions and 0 deletions

View File

@@ -249,6 +249,20 @@ int ion_share_dma_buf(struct ion_client *client, struct ion_handle *handle);
*/
struct ion_handle *ion_import_dma_buf(struct ion_client *client, int fd);
/**
* ion_handle_get_flags - get the flags for a given handle
*
* @client - client who allocated the handle
* @handle - handle to get the flags
* @flags - pointer to store the flags
*
* Gets the current flags for a handle. These flags indicate various options
* of the buffer (caching, security, etc.)
*/
int ion_handle_get_flags(struct ion_client *client, struct ion_handle *handle,
unsigned long *flags);
#endif /* __KERNEL__ */
/**
@@ -330,6 +344,20 @@ struct ion_flush_data {
unsigned int offset;
unsigned int length;
};
/* struct ion_flag_data - information about flags for this buffer
*
* @handle: handle to get flags from
* @flags: flags of this handle
*
* Takes handle as an input and outputs the flags from the handle
* in the flag field.
*/
struct ion_flag_data {
struct ion_handle *handle;
unsigned long flags;
};
#define ION_IOC_MAGIC 'I'
/**
@@ -408,4 +436,13 @@ struct ion_flush_data {
*/
#define ION_IOC_CLEAN_INV_CACHES _IOWR(ION_IOC_MAGIC, 9, \
struct ion_flush_data)
/**
* DOC: ION_IOC_GET_FLAGS - get the flags of the handle
*
* Gets the flags of the current handle which indicate cachability,
* secure state etc.
*/
#define ION_IOC_GET_FLAGS _IOWR(ION_IOC_MAGIC, 10, \
struct ion_flag_data)
#endif /* _LINUX_ION_H */