(dispmanx_gfx.c) Cleanups

This commit is contained in:
twinaphex 2015-03-15 05:41:29 +01:00
parent 7a9d2c6358
commit 6c0f4eb5f0
1 changed files with 45 additions and 40 deletions

View File

@ -238,11 +238,13 @@ static void vsync_callback(DISPMANX_UPDATE_HANDLE_T u, void *data)
page->dispvars->pageflip_pending--;
slock_unlock(page->dispvars->pending_mutex);
/* We mark as free the page that was visible until now */
if (page->dispvars->currentPage)
{
slock_lock(page->dispvars->currentPage->page_used_mutex);
/* We mark as free the page that was visible until now */
page->dispvars->currentPage->used = false;
slock_unlock(page->dispvars->currentPage->page_used_mutex);
}
@ -324,7 +326,7 @@ static bool dispmanx_setup_scale(void *data, unsigned width,
dispmanx_free_main_resources(_dispvars);
vc_dispmanx_display_get_info(_dispvars->display, &(_dispvars->amode));
// We chose the pixel format depending on the bpp of the frame
// We choose the pixel format depending on the bpp of the frame.
switch (_dispvars->bytes_per_pixel)
{
case 2:
@ -458,6 +460,7 @@ static void *dispmanx_gfx_init(const video_info_t *video,
_dispvars->vsync_cond_mutex = slock_new();
bcm_host_init();
_dispvars->display = vc_dispmanx_display_open(_dispvars->screen);
if (input && input_data)
@ -744,7 +747,9 @@ static void dispmanx_gfx_free(void *data)
for (i = 0; i < NUMPAGES; i++)
slock_free(_dispvars->pages[i].page_used_mutex);
if (_dispvars->pages)
free (_dispvars->pages);
_dispvars->pages = NULL;
dispmanx_unblank_console(_dispvars);
}