static void alloc_callback(KHRN_HW_CALLBACK_REASON_T reason, void *data_, const uint32_t *specials) { KHRN_FMEM_CALLBACK_DATA_T *data = (KHRN_FMEM_CALLBACK_DATA_T *)data_; switch (reason) { case KHRN_HW_CALLBACK_REASON_FIXUP: { vcos_assert(specials != NULL); do_fix_lock(data->fmem); do_ramp_lock(data->fmem); do_specials(data->fmem, specials); if (data->callback) data->callback(reason, data_, specials); khrn_hw_fixup_done(true, data_); break; } case KHRN_HW_CALLBACK_REASON_UNFIXUP: { // Don't call caller? /* todo: should only be unlocking here. unretain + unrelease should happen * in out of mem / render finished. i think. would be nice if we could do * it all in one call to reduce overhead though... */ do_fix_unlock(data->fmem); do_ramp_unlock(data->fmem); break; } case KHRN_HW_CALLBACK_REASON_BIN_FINISHED: { if (data->callback) data->callback(reason, data_, specials); break; } case KHRN_HW_CALLBACK_REASON_OUT_OF_MEM: case KHRN_HW_CALLBACK_REASON_RENDER_FINISHED: { if (data->callback) data->callback(reason, data_, specials); //vcos_assert((uint32_t)data->fmem != 0x494e34); /* todo: we want to do this on the llat thread, but we need to do all the * unlocking/unretaining/releasing first, which currently isn't safe to do * on the llat thread... */ vcos_assert(data->fmem->nmem_entered); khrn_nmem_group_term_and_exit(&data->fmem->nmem_group, data->fmem->nmem_pos); break; } case KHRN_HW_CALLBACK_REASON_OUT_OF_MEM_LLAT: case KHRN_HW_CALLBACK_REASON_BIN_FINISHED_LLAT: { if (data->callback) data->callback(reason, data_, specials); break; } default: { UNREACHABLE(); } } }
/** * Main processing function, called from main(). */ void main_process(void) { /* Global round ticker. */ global_round_tag++; pticks++; /* "do" something with objects with speed */ process_events(); /* Removes unused maps after a certain timeout */ check_active_maps(); /* Routines called from time to time. */ do_specials(); trigger_global_event(GEVENT_TICK, NULL, NULL); }