int hmm_init(void) { int ret; if (IS_MRFLD) ret = hmm_bo_device_init(&bo_device, &sh_mmu_mrfld, ISP_VM_START, ISP_VM_SIZE); else ret = hmm_bo_device_init(&bo_device, &sh_mmu_mfld, ISP_VM_START, ISP_VM_SIZE); if (ret) v4l2_err(&atomisp_dev, "hmm_bo_device_init failed.\n"); ret = hmm_pool_register((unsigned int)dypool_enable, HMM_POOL_TYPE_DYNAMIC); if (ret) v4l2_err(&atomisp_dev, "Failed to register dynamic memory pool.\n"); /* * As hmm use NULL to indicate invalid ISP virtual address, * and ISP_VM_START is defined to 0 too, so we allocate * one piece of dummy memory, which should return value 0, * at the beginning, to avoid hmm_alloc return 0 in the * further allocation. */ dummy_ptr = hmm_alloc(1, HMM_BO_PRIVATE, 0, 0, HMM_UNCACHED); return ret; }
void *vpx_memalign(size_t align, size_t size) { void *addr, * x = NULL; #if CONFIG_MEM_MANAGER int number_aau; if (vpx_mm_create_heap_memory() < 0) { _P(printf("[vpx][mm] ERROR vpx_memalign() Couldn't create memory for Heap.\n");) } number_aau = ((size + align - 1 + ADDRESS_STORAGE_SIZE) >> SHIFT_HMM_ADDR_ALIGN_UNIT) + 1; addr = hmm_alloc(&hmm_d, number_aau); #else addr = VPX_MALLOC_L(size + align - 1 + ADDRESS_STORAGE_SIZE); #endif /*CONFIG_MEM_MANAGER*/ if (addr) { x = align_addr((unsigned char *)addr + ADDRESS_STORAGE_SIZE, (int)align); /* save the actual malloc address */ ((size_t *)x)[-1] = (size_t)addr; } return x; } void *vpx_malloc(size_t size) { return vpx_memalign(DEFAULT_ALIGNMENT, size);