void g2d_free(void *virt_addr, void *phy_addr, unsigned int size) { #ifdef __FPGA_DEBUG_G2D__ struct g2d_alloc_struct *ptr, *prev; if( virt_addr == NULL ) return; ptr = &boot_heap_head; /* look for the node which po__s32 this memory block */ while (ptr && ptr->next) { if (ptr->next->address == (__u32)virt_addr) break; /* find the node which need to be release */ ptr = ptr->next; } prev = ptr; ptr = ptr->next; if (!ptr) return; /* the node is heap boot_heap_tail */ prev->next = ptr->next; /* delete the node which need be released from the memory block chain */ return; #else __u32 actual_bytes = G2D_BYTE_ALIGN(size); if(virt_addr) sunxi_buf_free(virt_addr, (unsigned int)phy_addr, actual_bytes); return; #endif }
void os_mem_free(struct vfe_mm *mem_man) { if(mem_man->vir_addr) sunxi_buf_free(mem_man->vir_addr, (u32)mem_man->phy_addr, mem_man->size); mem_man->phy_addr = NULL; mem_man->dma_addr = NULL; mem_man->vir_addr = NULL; }