else
return NULL;
- IONBuffer = (OMX_PTR)ion_alloc((ion_client)pHandle->pIONHandle, size, 0, heap);
+ IONBuffer = (OMX_PTR)ion_alloc((ion_client)pHandle->pIONHandle, size, 0, heap, 0);
if (IONBuffer <= 0) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "ion_alloc Error: %d", IONBuffer);
#include <unistd.h> /* size_t */
+#define ION_FLAG_CACHED 1
+
#define ION_HEAP_SYSTEM_MASK (1 << 0)
#define ION_HEAP_SYSTEM_CONTIG_MASK (1 << 1)
#define ION_HEAP_EXYNOS_CONTIG_MASK (1 << 4)
* buffer. If the @len is not aligned by @align, ION allocates a buffer
* that is aligned by @align and the size of the buffer will be larger
* than @len.
- * @flags: Additional requirements about buffer. ION_HEAP_SYSTEM_CONTIG_MASK
- * for allocating physically contiguous buffer and ION_HEAP_SYSTEM_MASK
- * for virtually contiguous buffer. You can combine those flags or
- * simply give -1(0xFFFFFFFF) if you do not care about the contiguouty
- * of the buffer.
+ * @heap_mask: Mask of heaps which you want this allocation to be served from.
+ * @flags: Additional requirements about buffer. ION_FLAG_CACHED for a
+ * buffer you want to have a cached mapping of
* @RETURN: An ion_buffer that represents the buffer allocated. It is only
* unique in the context of the given client, @client.
* -error if the allocation failed.
* See the description of ion_buffer above for detailed information.
*/
ion_buffer ion_alloc(ion_client client, size_t len, size_t align,
- unsigned int flags);
+ unsigned int heap_mask, unsigned int flags);
/* ion_free() - Frees an existing buffer that is allocated by ION
* @buffer: An ion_buffer of the buffer to be released.
*
* Note that @offset + @size must not exceed the size of @buffer.
*/
-int ion_msync(ion_client client, ion_buffer buffer, long flags,
- size_t size, off_t offset);
+int ion_sync(ion_client client, ion_buffer buffer);
#ifdef __cplusplus
}
m_pictureFds[i][j] = -1;
}
- m_pictureFds[i][0] = ion_alloc(m_ion_client, pictureFrameSize, 0, ION_HEAP_SYSTEM_MASK);
+ m_pictureFds[i][0] = ion_alloc(m_ion_client, pictureFrameSize, 0, ION_HEAP_SYSTEM_MASK, 0);
if (m_pictureFds[i][0] < 0) {
ALOGE("ERR(%s):ion_alloc(m_pictureFds[%d], size(%d) fail", __func__, i, pictureFrameSize);
return false;
}
for (int j = 1; j < numPlanes; j++) {
- m_pictureFds[i][j] = ion_alloc(m_ion_client, pictureChromaSize, 0, ION_HEAP_SYSTEM_MASK);
+ m_pictureFds[i][j] = ion_alloc(m_ion_client, pictureChromaSize, 0, ION_HEAP_SYSTEM_MASK, 0);
if (m_pictureFds[i][j]) {
ALOGE("ERR(%s):ion_alloc(m_pictureFds[%d][%d], size(%d) fail", __func__, i, j, pictureFrameSize);
return false;
return ERROR_BUFFR_IS_NULL;
}
- *ionBuffer = ion_alloc(ionClient, size, 0, ION_HEAP_SYSTEM_MASK);
+ *ionBuffer = ion_alloc(ionClient, size, 0, ION_HEAP_SYSTEM_MASK, 0);
if (*ionBuffer == -1) {
JPEG_ERROR_LOG("[%s]ion_alloc(%d) failed\n", __func__, size);
*ionBuffer = 0;
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
+#include <cutils/log.h>
typedef unsigned long ion_handle;
struct ion_allocation_data {
size_t len;
size_t align;
+ unsigned int heap_mask;
unsigned int flags;
ion_handle handle;
};
#define ION_IOC_FREE _IOWR(ION_IOC_MAGIC, 1, struct ion_handle_data)
#define ION_IOC_MAP _IOWR(ION_IOC_MAGIC, 2, struct ion_fd_data)
#define ION_IOC_SHARE _IOWR(ION_IOC_MAGIC, 4, struct ion_fd_data)
-#define ION_IOC_IMPORT _IOWR(ION_IOC_MAGIC, 5, int)
+#define ION_IOC_IMPORT _IOWR(ION_IOC_MAGIC, 5, struct ion_fd_data)
#define ION_IOC_CUSTOM _IOWR(ION_IOC_MAGIC, 6, struct ion_custom_data)
+#define ION_IOC_SYNC _IOWR(ION_IOC_MAGIC, 7, struct ion_fd_data)
struct ion_msync_data {
long flags;
}
ion_buffer ion_alloc(ion_client client, size_t len, size_t align,
- unsigned int flags)
+ unsigned int heap_mask, unsigned int flags)
{
int ret;
struct ion_handle_data arg_free;
arg_alloc.len = len;
arg_alloc.align = align;
+ arg_alloc.heap_mask = heap_mask;
arg_alloc.flags = flags;
ret = ioctl(client, ION_IOC_ALLOC, &arg_alloc);
return munmap(addr, len);
}
-int ion_msync(ion_client client, ion_buffer buffer, long flags, size_t size,
- off_t offset)
+int ion_sync(ion_client client, ion_buffer buffer)
{
- struct ion_custom_data data;
- struct ion_msync_data arg;
+ struct ion_fd_data data;
- data.cmd = ION_EXYNOS_CUSTOM_MSYNC;
- data.arg = (unsigned long)&arg;
+ data.fd = buffer;
- arg.flags = flags;
- arg.buf = buffer;
- arg.size = size;
- arg.offset = offset;
-
- return ioctl(client, ION_IOC_CUSTOM, &data);
+ return ioctl(client, ION_IOC_SYNC, &data);
}