static void dispmanx_surface_update(void *data, const void *frame, struct dispmanx_surface *surface) { struct dispmanx_video *_dispvars = data; struct dispmanx_page *page = NULL; /* Wait until last issued flip completes to get a free page. Also, dispmanx doesn't support issuing more than one pageflip.*/ slock_lock(_dispvars->pending_mutex); if (_dispvars->pageflip_pending > 0) { scond_wait(_dispvars->vsync_condition, _dispvars->pending_mutex); } slock_unlock(_dispvars->pending_mutex); page = dispmanx_get_free_page(_dispvars, surface); /* Frame blitting */ vc_dispmanx_resource_write_data(page->resource, surface->pixformat, surface->pitch, (void*)frame, &(surface->bmp_rect)); /* Issue a page flip that will be done at the next vsync. */ _dispvars->update = vc_dispmanx_update_start(0); vc_dispmanx_element_change_source(_dispvars->update, surface->element, page->resource); vc_dispmanx_update_submit(_dispvars->update, dispmanx_vsync_callback, (void*)page); slock_lock(_dispvars->pending_mutex); _dispvars->pageflip_pending++; slock_unlock(_dispvars->pending_mutex); }
static void dispmanx_update_main(void *data, const void *frame) { struct dispmanx_page *page = NULL; struct dispmanx_video *_dispvars = data; if (!_dispvars) return; page = dispmanx_get_free_page(_dispvars); if (!page) return; /* Frame blitting */ vc_dispmanx_resource_write_data(_dispvars->resources[page->numpage], _dispvars->pixFormat, _dispvars->pitch, (void *)frame, &(_dispvars->bmpRect)); /* Issue flipping: we send the page * to the dispmanx API internal flipping FIFO stack. */ dispmanx_flip (page, _dispvars); }