Hi,
I'm trying to use ION on the snapdragon to allow for buffer sharing between CPU/GPU/Camera mainly to be
used later in an OpenCL application.
Basically I have the following code:
ion_user_handle_t handle = 0;
int fd = open("/dev/ion", O_RDONLY | O_SYNC /*O_RDWR*/);
ret = ion_alloc(fd, buffer_size_in_bytes, align, heap_mask, alloc_flags, &handle);
ion_alloc is a wrapper around an ioctl call with the ION_IOC_ALLOC parameter.
It seems that I do get a valid fd from openinng /dev/ion (only for O_RDONLY)
but for the allocation itself, I'm getting the fhis:
Hi Eyal,
I was having the same issue is you and what fixed it for me was importing msm_ion.h:
#include <linux/msm_ion.h>
And using the following parameters:
alloc_flags = ION_FLAG_CACHED;
heap_mask = (0x1 << ION_IOMMU_HEAP_ID);
The main change to parameters is the ION_FLAG_CACHED for the alloc flags, but just in case that change alone doesn't work I've listed the heap_mask as well. I believe ION_IOMMU_HEAP_ID is the same as ION_HEAP_TYPE_SYSTEM, but not 100% sure on that. It seems like ION usage on Snapdragon is slightly different from the standard linux implementation. Hope this works for you.
- Eugene
Hi Eugene,
Thanks a lot for the answer - I'll try it out.
Did it actually work? did you see a performance boost from using ION and OpenCL?
thanks
Eyal