Lib/v3d/Driver.cpp
/**
 * Execute a kernel on v3d hardware
 *
 * @return true if execution went well and no timeout,
 *         false otherwise
 *
 * ============================================================================
 * NOTES
 * =====
 *
 * 1. It doesn't appear to be necessary to add the code BO to the bo handles list.
 *    All unit tests pass without doing this.
 *    This is something to keep in mind; it might go awkwards later on.
 *
 * 2. Totally no clue what the workgroup if for and what it does.
 *    Can't find anything about it online, just what `py-videocore6` gives,
 *    which I plain took over.
 */
Execute a kernel on v3d hardware
@return true if execution went well and no timeout,
false otherwise

NOTES

1. It doesn't appear to be necessary to add the code BO to the bo handles list.
All unit tests pass without doing this.
This is something to keep in mind; it might go awkwards later on.

2. Totally no clue what the workgroup if for and what it does.
Can't find anything about it online, just what `py-videocore6` gives,
which I plain took over.
Execute a kernel on v3d hardware @return true if execution went well and no timeout false otherwise NOTES 1 . It doesn ' t appear to be necessary to add the code BO to the bo handles list . All unit tests pass without doing this . This is something to keep in mind ; it might go awkwards later on . 2 . Totally no clue what the workgroup if for and what it does . Can ' t find anything about it online just what ` py - videocore6 ` gives which I plain took over .
bool Driver::execute(Code &code, Data *uniforms, uint32_t thread) {
  uint32_t code_phyaddr = code.getAddress();
  uint32_t unif_phyaddr = (uniforms == nullptr)?0u:uniforms->getAddress();
  assertq(m_bo_handles.size() >= 1, "v3d execute: Expecting least one buffer object on execution");  
  WorkGroup workgroup;
  uint32_t wgs_per_sg = 16;
  st_v3d_submit_csd st = {
    {
      workgroup.wg_x << 16,
      workgroup.wg_y << 16,
      workgroup.wg_z << 16,
      (
        ((((wgs_per_sg * workgroup.wg_size() + 16u - 1u) / 16u) - 1u) << 12) |
        (wgs_per_sg << 8) |
        (workgroup.wg_size() & 0xff)
      ),
      thread - 1,           
      code_phyaddr,         
      unif_phyaddr
    },
    {0,0,0,0},
    (uint64_t) m_bo_handles.data(),
    (uint32_t) m_bo_handles.size(),
    0,   
    0    
  };
  uint64_t timeout_ns = 1000000000llu * LibSettings::qpu_timeout();
  bool ret = (0 == v3d_submit_csd(st));
  assert(ret);
  if (ret) {
    ret = v3d_wait_bo(m_bo_handles, timeout_ns);
  }
  return ret;
}
bool Driver :: execute ( Code & code , Data * uniforms , uint32_t thread ) { uint32_t code_phyaddr = code . getAddress ( ) ; uint32_t unif_phyaddr = ( uniforms == nullptr ) ? 0u : uniforms -> getAddress ( ) ; assertq ( m_bo_handles . size ( ) >= 1 , " " ) ; WorkGroup workgroup ; uint32_t wgs_per_sg = 16 ; st_v3d_submit_csd st = { { workgroup . wg_x << 16 , workgroup . wg_y << 16 , workgroup . wg_z << 16 , ( ( ( ( ( wgs_per_sg * workgroup . wg_size ( ) + 16u - 1u ) / 16u ) - 1u ) << 12 ) | ( wgs_per_sg << 8 ) | ( workgroup . wg_size ( ) & 0xff ) ) , thread - 1 , code_phyaddr , unif_phyaddr } , { 0 , 0 , 0 , 0 } , ( uint64_t ) m_bo_handles . data ( ) , ( uint32_t ) m_bo_handles . size ( ) , 0 , 0 } ; uint64_t timeout_ns = 1000000000llu * LibSettings :: qpu_timeout ( ) ; bool ret = ( 0 == v3d_submit_csd ( st ) ) ; assert ( ret ) ; if ( ret ) { ret = v3d_wait_bo ( m_bo_handles , timeout_ns ) ; } return ret ; }
Execute a kernel on v3d hardware
 @return true if execution went well and no timeout,
         false otherwise
Execute a kernel on v3d hardware @return true if execution went well and no timeout false otherwise
// Technically, you are not required to pass in uniforms. // If there are none, set the address to zero. // See Note 1 // Number of batches minus 1 // Shader address, pnan, singleseg, threading // in_sync // out_sync