Forums - ION usage on SnapDragon 800

3 posts / 0 new
Last post
ION usage on SnapDragon 800
eyalhir74
Join Date: 7 Feb 13
Posts: 6
Posted: Wed, 2014-07-02 23:58

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*/);

   heap_mask = ION_HEAP_TYPE_SYSTEM;
   alloc_flags = 0;
   align = 4096;
   buffer_size_in_bytes = (90 + 4095) & (~4095);

   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:

07-03 06:35:17.849 I/ion     (17409): ion_ioctl: fd: 56
07-03 06:35:17.849 I/ion     (17409): ioctl c0144900 failed with code -1: No such device
 
Any ideas/suggestions are more than welcomed
 
thanks
Eyal
  • Up0
  • Down0
ek00000
Join Date: 11 Apr 14
Posts: 1
Posted: Fri, 2014-07-18 16:24

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

  • Up0
  • Down0
eyalhir74
Join Date: 7 Feb 13
Posts: 6
Posted: Wed, 2014-07-30 22:23

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

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.