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>
diff --git a/include/linux/ion.h b/include/linux/ion.h
index ece819d..dc9e549 100644
--- a/include/linux/ion.h
+++ b/include/linux/ion.h
@@ -269,6 +269,22 @@
* the handle to use to refer to it further.
*/
struct ion_handle *ion_import_fd(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__ */
/**
@@ -350,6 +366,20 @@
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'
/**
@@ -428,4 +458,13 @@
*/
#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 */