heap类型:由于ION可以使⽤多种memory分配机制,例如物理连续和不连续的,所以ION使⽤enum ion_heap_type表⽰。[html]view plaincopy 1. /** 2. * enum ion_heap_types - list of all possible types of heaps 3. * @ION_HEAP_TYPE_SYSTEM: memory allocated via vmalloc 4. * @ION_HEAP_...
ION_SPSS_HEAP_ID = 13, /* Secure Processor ION heap */ ION_ADSP_HEAP_ID = 22, ION_SYSTEM_HEAP_ID = 25, ION_QSECOM_HEAP_ID = 27, ION_HEAP_ID_RESERVED = 31 /** Bit reserved for ION_FLAG_SECURE flag */ }; /** * Newly added heap ids have to be #define(d) since all A...
ION_HEAP_TYPE_SYSTEM : 通过vmalloc分配内存 ION_HEAP_TYPE_SYSTEM_CONTIG: 通过kmalloc分配内存 ION_HEAP_TYPE_CARVEOUT: 在保留内存块中(reserve memory)分配内存 ION_HEAP_TYPE_CUSTOM: 由客户自己定义 下图是两个client共享内存的示意图。图中有2个heap(每种heap都有自己的内存分配策略),每个heap中分配了若...
其中gralloc_ion_get_heapid获取heap类型,默认为system,即通过vmalloc申请。 此函数返回的值对应ion_allocation_data中flags参数 具体分配函数为ion_alloc:共享分配得到的内存buffer:其中ion_fd_data定义如下:四、ION内核实现 4.1 关键数据结构 ion_device将会持有一个clients的红黑树,对所有的通过open进来的client,为...
ION_HEAP_TYPE_SYSTEM : 通过vmalloc分配内存 ION_HEAP_TYPE_SYSTEM_CONTIG: 通过kmalloc分配内存 ION_HEAP_TYPE_CARVEOUT: 在保留内存块中(reserve memory)分配内存 ION_HEAP_TYPE_CUSTOM: 由客户自己定义 ION APIs 用户空间 API 定义了6种 ioctl 接口,可以与用户应用程序交互。
.unmap_iommu = ion_carveout_heap_unmap_iommu, }; static struct ion_heap_ops kmalloc_ops = { .allocate = ion_system_contig_heap_allocate, .free = ion_system_contig_heap_free, .phys = ion_system_contig_heap_phys, .map_dma = ion_system_contig_heap_map_dma, ...
Thehandlefield is the output parameter, while the first three fields specify the alignment, length and flags as input parameters. Theflagsfield is a bit mask indicating one or more ION heaps to allocate from, with the fallback ordered according to which ION heap was first added via calls to...
ION_HEAP_TYPE_SYSTEM_CONTIG:通过kmalloc分配内存 ION_HEAP_TYPE_CARVEOUT:在保留内存块中(reserve memory)分配内存 ION_HEAP_TYPE_CUSTOM:由客户自己定义 下图是两个client共享内存的示意图。图中有2个heap(每种heap都有自己的内存分配策略),每个heap中分配了若干个buffer。client的handle管理到对应的buffer。两个...
{0.};.allocate=ion_system_contig_heap_allocate,.free=ion_system_contig_heap_free,.phys=ion_system_contig_heap_phys,.map_dma=ion_system_contig_heap_map_dma,.unmap_dma=ion_system_heap_unmap_dma,.map_kernel=ion_system_heap_map_kernel,.unmap_kernel=ion_system_heap_unmap_kernel,.map_user=...
本文以MSM平台SYSTEM HEAP为例。 Android ION数据结构 ion_device struction_device{structmiscdevicedev;structrb_rootbuffers;structmutexbuffer_lock;structrw_semaphorelock;structplist_headheaps;...structrb_rootclients;...}; dev:具体平台上的ION设备 ...