Lib/vc4/BufferObject.cpp
/**
 * Allocate GPU memory and map it into ARM address space
 */
Allocate GPU memory and map it into ARM address space
Allocate GPU memory and map it into ARM address space
void BufferObject::alloc_mem(uint32_t size_in_bytes) {
  assert(handle == 0);
  int mb = getMailbox();  
  handle = mem_alloc(mb, size_in_bytes*4, 4096, GPU_MEM_FLG);
  if (!handle) {
    fatal("Failed to allocate vc4 shared  memory.");
  }
  uint32_t phyaddr = mem_lock(mb, handle);
  arm_base =  (uint8_t *) mapmem(BUS_TO_PHYS(phyaddr + GPU_MEM_MAP), size_in_bytes);
  set_size(size_in_bytes);
  set_phy_address(phyaddr);
}
void BufferObject :: alloc_mem ( uint32_t size_in_bytes ) { assert ( handle == 0 ) ; int mb = getMailbox ( ) ; handle = mem_alloc ( mb , size_in_bytes * 4 , 4096 , GPU_MEM_FLG ) ; if ( ! handle ) { fatal ( " " ) ; } uint32_t phyaddr = mem_lock ( mb , handle ) ; arm_base = ( uint8_t * ) mapmem ( BUS_TO_PHYS ( phyaddr + GPU_MEM_MAP ) , size_in_bytes ) ; set_size ( size_in_bytes ) ; set_phy_address ( phyaddr ) ; }
Allocate GPU memory and map it into ARM address space
Allocate GPU memory and map it into ARM address space
// Mailbox, for talking to vc4 // Allocate memory