static gboolean gst_fsl_vpu_dec_free_phys_mem(G_GNUC_UNUSED GstFslPhysMemAllocator *allocator, GstFslPhysMemory *memory) { VpuDecRetCode ret; VpuMemDesc mem_desc; memset(&mem_desc, 0, sizeof(VpuMemDesc)); mem_desc.nSize = memory->mem.size; mem_desc.nVirtAddr = (unsigned long)(memory->mapped_virt_addr); mem_desc.nPhyAddr = (unsigned long)(memory->phys_addr); mem_desc.nCpuAddr = (unsigned long)(memory->cpu_addr); ret = VPU_DecFreeMem(&mem_desc); return (ret == VPU_DEC_RET_SUCCESS); }
ImxVpuDecReturnCodes imx_vpu_dec_deallocate_memory(ImxVpuMemBlock *mem_block) { ImxVpuDecReturnCodes ret; VpuMemDesc mem_desc; convert_to_wrapper_mem_desc(mem_block, &mem_desc); ret = dec_convert_retcode(VPU_DecFreeMem(&mem_desc)); if (ret != IMX_VPU_DEC_RETURN_CODE_OK) IMX_VPU_ERROR("deallocating %d bytes of physical memory failed: %s", mem_block->size, imx_vpu_dec_error_string(ret)); else IMX_VPU_TRACE("deallocated %d bytes of physical memory", mem_block->size); return ret; }
static gboolean gst_test_vpu_dec_free_phys_mem(GstTestPhysMemAllocator *allocator, GstTestPhysMemory *memory) { VpuDecRetCode ret; VpuMemDesc mem_desc; memset(&mem_desc, 0, sizeof(VpuMemDesc)); mem_desc.nSize = memory->mem.size; mem_desc.nVirtAddr = (unsigned long)(memory->mapped_virt_addr); mem_desc.nPhyAddr = (unsigned long)(memory->phys_addr); mem_desc.nCpuAddr = (unsigned long)(memory->internal); GST_DEBUG_OBJECT(allocator, "addresses: virt: %p phys: %" GST_TEST_PHYS_ADDR_FORMAT " cpu: %p", memory->mapped_virt_addr, memory->phys_addr, memory->internal); ret = VPU_DecFreeMem(&mem_desc); gst_test_vpu_dec_unload(); return (ret == VPU_DEC_RET_SUCCESS); }
bool CDVDVideoCodecIMX::VpuFreeBuffers(void) { VpuMemDesc vpuMem; VpuDecRetCode vpuRet; bool ret = true; if (m_decMemInfo.virtMem) { //free virtual mem for(int i=0; i<m_decMemInfo.nVirtNum; i++) { if (m_decMemInfo.virtMem[i]) free((void*)m_decMemInfo.virtMem[i]); } free(m_decMemInfo.virtMem); m_decMemInfo.virtMem = NULL; m_decMemInfo.nVirtNum = 0; } if (m_decMemInfo.phyMem) { //free physical mem for(int i=0; i<m_decMemInfo.nPhyNum; i++) { vpuMem.nPhyAddr = m_decMemInfo.phyMem[i].nPhyAddr; vpuMem.nVirtAddr = m_decMemInfo.phyMem[i].nVirtAddr; vpuMem.nCpuAddr = m_decMemInfo.phyMem[i].nCpuAddr; vpuMem.nSize = m_decMemInfo.phyMem[i].nSize; vpuRet = VPU_DecFreeMem(&vpuMem); if(vpuRet != VPU_DEC_RET_SUCCESS) { CLog::Log(LOGERROR, "%s - Errror while trying to free physical memory (%d).\n", __FUNCTION__, ret); ret = false; } } free(m_decMemInfo.phyMem); m_decMemInfo.phyMem = NULL; m_decMemInfo.nPhyNum = 0; } return ret; }