DISPMANX: Fix refreshrate calculation by updating menu surface asynchronously

This commit is contained in:
vanfanel 2017-01-14 14:38:18 +01:00
parent b3f1bbc15e
commit f0c2826994

View File

@ -296,6 +296,20 @@ static void dispmanx_surface_setup(void *data, int src_width, int src_height,
vc_dispmanx_update_submit_sync(_dispvars->update);
}
static void dispmanx_surface_update_async(void *data, const void *frame,
struct dispmanx_surface *surface)
{
struct dispmanx_video *_dispvars = data;
struct dispmanx_page *page = NULL;
/* Since it's an async update, there's no need for multiple pages */
page = &(surface->pages[0]);
/* Frame blitting. Nothing else is needed if we only have a page. */
vc_dispmanx_resource_write_data(page->resource, surface->pixformat,
surface->pitch, (void*)frame, &(surface->bmp_rect));
}
static void dispmanx_surface_update(void *data, const void *frame,
struct dispmanx_surface *surface)
{
@ -473,7 +487,8 @@ static bool dispmanx_gfx_frame(void *data, const void *frame, unsigned width,
}
}
if (_dispvars->menu_active)
//if (_dispvars->menu_active)
if (video_info.fps_show)
{
char buf[128];
video_monitor_get_fps(video_info, buf, sizeof(buf), NULL, 0);
@ -510,6 +525,7 @@ static void dispmanx_set_texture_frame(void *data, const void *frame, bool rgb32
_dispvars->menu_height = height;
_dispvars->menu_pitch = width * (rgb32 ? 4 : 2);
/* Menu surface only needs a page as it will be updated asynchronously. */
dispmanx_surface_setup(_dispvars,
width,
height,
@ -518,13 +534,15 @@ static void dispmanx_set_texture_frame(void *data, const void *frame, bool rgb32
VC_IMAGE_RGBA16,
210,
_dispvars->aspect_ratio,
3,
1,
0,
&_dispvars->menu_surface);
}
/* We update the menu surface if menu is active. */
dispmanx_surface_update(_dispvars, frame, _dispvars->menu_surface);
/* We update the menu surface if menu is active.
* This update is asynchronous, yet menu screen update
* will be synced because main surface updating is synchronous */
dispmanx_surface_update_async(_dispvars, frame, _dispvars->menu_surface);
}
static void dispmanx_gfx_set_nonblock_state(void *data, bool state)