Refactor frame monitor code

This commit is contained in:
twinaphex 2017-01-18 17:41:27 +01:00
parent b9104f38b8
commit a6a4808e94
52 changed files with 364 additions and 606 deletions

View File

@ -323,7 +323,7 @@ void x11_suspend_screensaver(Window wnd, bool enable)
x11_suspend_screensaver_xdg_screensaver(wnd, enable);
}
static bool get_video_mode(video_frame_info_t video_info,
static bool get_video_mode(video_frame_info_t *video_info,
Display *dpy, unsigned width, unsigned height,
XF86VidModeModeInfo *mode, XF86VidModeModeInfo *desktop_mode)
{
@ -345,7 +345,7 @@ static bool get_video_mode(video_frame_info_t video_info,
/* If we use black frame insertion, we fake a 60 Hz monitor
* for 120 Hz one, etc, so try to match that. */
refresh_mod = video_info.black_frame_insertion ? 0.5f : 1.0f;
refresh_mod = video_info->black_frame_insertion ? 0.5f : 1.0f;
for (i = 0; i < num_modes; i++)
{
@ -361,7 +361,7 @@ static bool get_video_mode(video_frame_info_t video_info,
continue;
refresh = refresh_mod * m->dotclock * 1000.0f / (m->htotal * m->vtotal);
diff = fabsf(refresh - video_info.refresh_rate);
diff = fabsf(refresh - video_info->refresh_rate);
if (!ret || diff < minimum_fps_diff)
{
@ -375,7 +375,7 @@ static bool get_video_mode(video_frame_info_t video_info,
return ret;
}
bool x11_enter_fullscreen(video_frame_info_t video_info,
bool x11_enter_fullscreen(video_frame_info_t *video_info,
Display *dpy, unsigned width,
unsigned height, XF86VidModeModeInfo *desktop_mode)
{
@ -715,18 +715,10 @@ bool x11_connect(void)
return true;
}
void x11_update_window_title(void *data, video_frame_info_t video_info)
void x11_update_title(void *data, video_frame_info_t *video_info)
{
char buf[128];
char buf_fps[128];
buf[0] = buf_fps[0] = '\0';
if (video_monitor_get_fps(video_info,
buf, sizeof(buf), buf_fps, sizeof(buf_fps)))
XStoreName(g_x11_dpy, g_x11_win, buf);
if (video_info.fps_show)
runloop_msg_queue_push(buf_fps, 1, 1, false);
if (video_info->monitor_fps_enable)
XStoreName(g_x11_dpy, g_x11_win, video_info->window_text);
}
bool x11_input_ctx_new(bool true_full)

View File

@ -45,7 +45,7 @@ void x11_save_last_used_monitor(Window win);
void x11_show_mouse(Display *dpy, Window win, bool state);
void x11_windowed_fullscreen(Display *dpy, Window win);
void x11_suspend_screensaver(Window win, bool enable);
bool x11_enter_fullscreen(video_frame_info_t video_info,
bool x11_enter_fullscreen(video_frame_info_t *video_info,
Display *dpy, unsigned width,
unsigned height, XF86VidModeModeInfo *desktop_mode);
@ -84,7 +84,7 @@ bool x11_alive(void *data);
bool x11_connect(void);
void x11_update_window_title(void *data, video_frame_info_t video_info);
void x11_update_title(void *data, video_frame_info_t *video_info);
bool x11_input_ctx_new(bool true_full);

View File

@ -94,7 +94,7 @@ static void *caca_gfx_init(const video_info_t *video,
static bool caca_gfx_frame(void *data, const void *frame,
unsigned frame_width, unsigned frame_height, uint64_t frame_count,
unsigned pitch, const char *msg, video_frame_info_t video_info)
unsigned pitch, const char *msg, video_frame_info_t *video_info)
{
size_t len = 0;
void *buffer = NULL;

View File

@ -446,7 +446,7 @@ static void* ctr_init(const video_info_t* video,
static bool ctr_frame(void* data, const void* frame,
unsigned width, unsigned height,
uint64_t frame_count,
unsigned pitch, const char* msg, video_frame_info_t info)
unsigned pitch, const char* msg, video_frame_info_t *video_info)
{
uint32_t diff;
static uint64_t currentTick,lastTick;

View File

@ -1368,7 +1368,7 @@ static void d3d_get_overlay_interface(void *data,
static bool d3d_frame(void *data, const void *frame,
unsigned frame_width, unsigned frame_height,
uint64_t frame_count, unsigned pitch,
const char *msg, video_frame_info_t video_info)
const char *msg, video_frame_info_t *video_info)
{
unsigned width, height;
static struct retro_perf_counter d3d_frame = {0};
@ -1412,18 +1412,18 @@ static bool d3d_frame(void *data, const void *frame,
/* render_chain() only clears out viewport,
* clear out everything. */
D3DVIEWPORT screen_vp;
screen_vp.X = 0;
screen_vp.Y = 0;
screen_vp.MinZ = 0;
screen_vp.MaxZ = 1;
screen_vp.Width = width;
screen_vp.X = 0;
screen_vp.Y = 0;
screen_vp.MinZ = 0;
screen_vp.MaxZ = 1;
screen_vp.Width = width;
screen_vp.Height = height;
d3d_set_viewports(d3d->dev, &screen_vp);
d3d_clear(d3d->dev, 0, 0, D3DCLEAR_TARGET, 0, 1, 0);
/* Insert black frame first, so we
* can screenshot, etc. */
if (video_info.black_frame_insertion)
if (video_info->black_frame_insertion)
{
if (!d3d_swap(d3d, d3d->dev) || d3d->needs_restore)
return true;

View File

@ -430,7 +430,7 @@ static void *dispmanx_gfx_init(const video_info_t *video,
static bool dispmanx_gfx_frame(void *data, const void *frame, unsigned width,
unsigned height, uint64_t frame_count, unsigned pitch, const char *msg,
video_frame_info_t video_info)
video_frame_info_t *video_info)
{
struct dispmanx_video *_dispvars = data;
float aspect = video_driver_get_aspect_ratio();
@ -438,7 +438,9 @@ static bool dispmanx_gfx_frame(void *data, const void *frame, unsigned width,
if (!frame)
return true;
if (width != _dispvars->core_width || height != _dispvars->core_height || _dispvars->aspect_ratio != aspect)
if ( (width != _dispvars->core_width) ||
(height != _dispvars->core_height) ||
(_dispvars->aspect_ratio != aspect))
{
/* Sanity check. */
if (width == 0 || height == 0)
@ -467,18 +469,11 @@ static bool dispmanx_gfx_frame(void *data, const void *frame, unsigned width,
settings->video.max_swapchain_images,
0,
&_dispvars->main_surface);
/* We need to recreate the menu surface too, if it exists already, so we
* free it and let dispmanx_set_texture_frame() recreate it as it detects it's NULL.*/
if (_dispvars->menu_active && _dispvars->menu_surface) {
if (_dispvars->menu_active && _dispvars->menu_surface)
dispmanx_surface_free(_dispvars, &_dispvars->menu_surface);
}
}
if (video_info.fps_show)
{
char buf[128];
video_monitor_get_fps(video_info, buf, sizeof(buf), NULL, 0);
}
/* Update main surface: locate free page, blit and flip. */

View File

@ -744,11 +744,12 @@ static void *drm_gfx_init(const video_info_t *video,
static bool drm_gfx_frame(void *data, const void *frame, unsigned width,
unsigned height, uint64_t frame_count, unsigned pitch, const char *msg,
video_frame_info_t video_info)
video_frame_info_t *video_info)
{
struct drm_video *_drmvars = data;
if (width != _drmvars->core_width || height != _drmvars->core_height)
if ( ( width != _drmvars->core_width) ||
(height != _drmvars->core_height))
{
/* Sanity check. */
if (width == 0 || height == 0)
@ -778,14 +779,6 @@ static bool drm_gfx_frame(void *data, const void *frame, unsigned width,
drm_plane_setup(_drmvars->main_surface);
}
if (_drmvars->menu_active)
{
char buf[128];
buf[0] = '\0';
video_monitor_get_fps(video_info, buf, sizeof(buf), NULL, 0);
}
/* Update main surface: locate free page, blit and flip. */
drm_surface_update(_drmvars, frame, _drmvars->main_surface);
return true;

View File

@ -1159,7 +1159,6 @@ static int exynos_render_msg(struct exynos_video *vid,
return exynos_blend_font(pdata);
}
static void *exynos_gfx_init(const video_info_t *video,
const input_driver_t **input, void **input_data)
{
@ -1273,7 +1272,7 @@ static void exynos_gfx_free(void *data)
static bool exynos_gfx_frame(void *data, const void *frame, unsigned width,
unsigned height, uint64_t frame_count, unsigned pitch, const char *msg,
video_frame_info_t video_info)
video_frame_info_t *video_info)
{
struct exynos_video *vid = data;
struct exynos_page *page = NULL;
@ -1304,18 +1303,6 @@ static bool exynos_gfx_frame(void *data, const void *frame, unsigned width,
goto fail;
}
if (video_info.fps_show)
{
char buffer[128];
char buffer_fps[128];
buffer[0] = buffer_fps[0] = '\0';
video_monitor_get_fps(video_info, buffer, sizeof(buffer),
video_info.fps_show ? buffer_fps : NULL, sizeof(buffer_fps));
runloop_msg_queue_push(buffer_fps, 1, 1, false);
}
/* If at this point the dimension parameters are still zero, setup some *
* fake blit parameters so that menu and font rendering work properly. */
if (vid->width == 0 || vid->height == 0)

View File

@ -146,7 +146,7 @@ error:
static bool gdi_gfx_frame(void *data, const void *frame,
unsigned frame_width, unsigned frame_height, uint64_t frame_count,
unsigned pitch, const char *msg, video_frame_info_t video_info)
unsigned pitch, const char *msg, video_frame_info_t *video_info)
{
gfx_ctx_mode_t mode;
RECT rect;

View File

@ -299,11 +299,11 @@ static void gl_set_viewport_wrapper(void *data, unsigned viewport_width,
video_driver_build_info(&video_info);
gl_set_viewport(data, video_info,
gl_set_viewport(data, &video_info,
viewport_width, viewport_height, force_full, allow_rotate);
}
void gl_set_viewport(void *data, video_frame_info_t video_info,
void gl_set_viewport(void *data, video_frame_info_t *video_info,
unsigned viewport_width,
unsigned viewport_height,
bool force_full, bool allow_rotate)
@ -324,7 +324,7 @@ void gl_set_viewport(void *data, video_frame_info_t video_info,
video_context_driver_translate_aspect(&aspect_data);
if (video_info.scale_integer && !force_full)
if (video_info->scale_integer && !force_full)
{
video_viewport_get_scaled_integer(&gl->vp,
viewport_width, viewport_height,
@ -337,7 +337,7 @@ void gl_set_viewport(void *data, video_frame_info_t video_info,
float desired_aspect = video_driver_get_aspect_ratio();
#if defined(HAVE_MENU)
if (video_info.aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
if (video_info->aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
{
const struct video_viewport *custom = video_viewport_get_custom();
@ -1090,7 +1090,7 @@ static bool gl_frame(void *data, const void *frame,
unsigned frame_width, unsigned frame_height,
uint64_t frame_count,
unsigned pitch, const char *msg,
video_frame_info_t video_info)
video_frame_info_t *video_info)
{
video_shader_ctx_mvp_t mvp;
video_shader_ctx_coords_t coords;
@ -1339,7 +1339,7 @@ static bool gl_frame(void *data, const void *frame,
/* Disable BFI during fast forward, slow-motion,
* and pause to prevent flicker. */
if (
video_info.black_frame_insertion
video_info->black_frame_insertion
&& !input_driver_is_nonblock_state()
&& !runloop_ctl(RUNLOOP_CTL_IS_SLOWMOTION, NULL)
&& !runloop_ctl(RUNLOOP_CTL_IS_PAUSED, NULL))
@ -1351,7 +1351,7 @@ static bool gl_frame(void *data, const void *frame,
video_context_driver_swap_buffers(video_info);
#ifdef HAVE_GL_SYNC
if (video_info.hard_sync && gl->have_sync)
if (video_info->hard_sync && gl->have_sync)
{
static struct retro_perf_counter gl_fence = {0};
@ -1361,7 +1361,7 @@ static bool gl_frame(void *data, const void *frame,
gl->fences[gl->fence_count++] =
glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
while (gl->fence_count > video_info.hard_sync_frames)
while (gl->fence_count > video_info->hard_sync_frames)
{
glClientWaitSync(gl->fences[0],
GL_SYNC_FLUSH_COMMANDS_BIT, 1000000000);

View File

@ -49,14 +49,14 @@ void gl_load_texture_data(
const void *frame, unsigned base_size);
void gl_renderchain_render(gl_t *gl,
video_frame_info_t video_info,
video_frame_info_t *video_info,
uint64_t frame_count,
const struct video_tex_info *tex_info,
const struct video_tex_info *feedback_info);
void gl_renderchain_init(gl_t *gl, unsigned fbo_width, unsigned fbo_height);
void gl_set_viewport(void *data, video_frame_info_t video_info,
void gl_set_viewport(void *data, video_frame_info_t *video_info,
unsigned viewport_width,
unsigned viewport_height, bool force_full, bool allow_rotate);
@ -70,7 +70,7 @@ void gl_renderchain_recompute_pass_sizes(gl_t *gl,
unsigned width, unsigned height,
unsigned vp_width, unsigned vp_height);
void gl_renderchain_start_render(gl_t *gl, video_frame_info_t video_info);
void gl_renderchain_start_render(gl_t *gl, video_frame_info_t *video_info);
void gl_check_fbo_dimensions(gl_t *gl);

View File

@ -239,7 +239,7 @@ void gl_check_fbo_dimensions(gl_t *gl)
}
}
void gl_renderchain_render(gl_t *gl,
video_frame_info_t video_info,
video_frame_info_t *video_info,
uint64_t frame_count,
const struct video_tex_info *tex_info,
const struct video_tex_info *feedback_info)
@ -667,7 +667,7 @@ void gl_renderchain_recompute_pass_sizes(gl_t *gl,
}
}
void gl_renderchain_start_render(gl_t *gl, video_frame_info_t video_info)
void gl_renderchain_start_render(gl_t *gl, video_frame_info_t *video_info)
{
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
glBindFramebuffer(RARCH_GL_FRAMEBUFFER, gl->fbo[0]);

View File

@ -1438,7 +1438,7 @@ static bool gx_frame(void *data, const void *frame,
unsigned width, unsigned height,
uint64_t frame_count, unsigned pitch,
const char *msg,
video_frame_info_t video_info)
video_frame_info_t *video_info)
{
char fps_txt[128];
char fps_text_buf[128];
@ -1538,10 +1538,7 @@ static bool gx_frame(void *data, const void *frame,
GX_DrawDone();
video_monitor_get_fps(video_info, fps_txt, sizeof(fps_txt),
fps_text_buf, sizeof(fps_text_buf));
if (video_info.fps_show)
if (video_info->fps_show)
{
char mem1_txt[128];
char mem2_txt[128];

View File

@ -32,7 +32,7 @@ static void *null_gfx_init(const video_info_t *video,
static bool null_gfx_frame(void *data, const void *frame,
unsigned width, unsigned height, uint64_t frame_count,
unsigned pitch, const char *msg, video_frame_info_t video_info)
unsigned pitch, const char *msg, video_frame_info_t *video_info)
{
(void)data;
(void)frame;

View File

@ -985,7 +985,7 @@ fail:
static bool omap_gfx_frame(void *data, const void *frame, unsigned width,
unsigned height, uint64_t frame_count, unsigned pitch, const char *msg,
video_frame_info_t video_info)
video_frame_info_t *video_info)
{
omap_video_t *vid = (omap_video_t*)data;

View File

@ -467,7 +467,7 @@ static void *psp_init(const video_info_t *video,
static bool psp_frame(void *data, const void *frame,
unsigned width, unsigned height, uint64_t frame_count,
unsigned pitch, const char *msg, video_frame_info_t video_info)
unsigned pitch, const char *msg, video_frame_info_t *video_info)
{
#ifdef DISPLAY_FPS
uint32_t diff;
@ -476,8 +476,6 @@ static bool psp_frame(void *data, const void *frame,
static float fps = 0.0;
#endif
static struct retro_perf_counter psp_frame_run = {0};
static char fps_txt[128] = {0};
static char fps_text_buf[128] = {0};
psp1_video_t *psp = (psp1_video_t*)data;
if (!width || !height)
@ -495,14 +493,10 @@ static bool psp_frame(void *data, const void *frame,
pspDebugScreenSetXY(0,0);
video_monitor_get_fps(video_info, fps_txt, sizeof(fps_txt),
video_info.fps_show ? fps_text_buf : NULL,
video_info.fps_show ? sizeof(fps_text_buf) : 0);
if (video_info.fps_show)
if (video_info->fps_show)
{
pspDebugScreenSetXY(68 - strlen(fps_text_buf) - 1,0);
pspDebugScreenPuts(fps_text_buf);
pspDebugScreenSetXY(68 - strlen(video_info->fps_text) - 1,0);
pspDebugScreenPuts(video_info->fps_text);
pspDebugScreenSetXY(0,1);
}

View File

@ -498,13 +498,10 @@ static void check_window(sdl2_video_t *vid)
static bool sdl2_gfx_frame(void *data, const void *frame, unsigned width,
unsigned height, uint64_t frame_count,
unsigned pitch, const char *msg, video_frame_info_t video_info)
unsigned pitch, const char *msg, video_frame_info_t *video_info)
{
char buf[128];
sdl2_video_t *vid = (sdl2_video_t*)data;
buf[0] = '\0';
if (vid->should_resize)
sdl_refresh_viewport(vid);
@ -536,8 +533,8 @@ static bool sdl2_gfx_frame(void *data, const void *frame, unsigned width,
SDL_RenderPresent(vid->renderer);
if (video_monitor_get_fps(video_info, buf, sizeof(buf), NULL, 0))
SDL_SetWindowTitle(vid->window, buf);
if (video_info->monitor_fps_enable)
SDL_SetWindowTitle(vid->window, video_info->window_text);
return true;
}

View File

@ -331,17 +331,14 @@ static void sdl_gfx_check_window(sdl_video_t *vid)
static bool sdl_gfx_frame(void *data, const void *frame, unsigned width,
unsigned height, uint64_t frame_count,
unsigned pitch, const char *msg, video_frame_info_t video_info)
unsigned pitch, const char *msg, video_frame_info_t *video_info)
{
char buf[128];
static struct retro_perf_counter sdl_scale = {0};
sdl_video_t *vid = (sdl_video_t*)data;
if (!frame)
return true;
buf[0] = '\0';
if (SDL_MUSTLOCK(vid->screen))
SDL_LockSurface(vid->screen);
@ -370,8 +367,8 @@ static bool sdl_gfx_frame(void *data, const void *frame, unsigned width,
if (SDL_MUSTLOCK(vid->screen))
SDL_UnlockSurface(vid->screen);
if (video_monitor_get_fps(video_info, buf, sizeof(buf), NULL, 0))
SDL_WM_SetCaption(buf, NULL);
if (video_info->monitor_fps_enable)
SDL_WM_SetCaption(video_info->window_text, NULL);
SDL_Flip(vid->screen);

View File

@ -763,7 +763,7 @@ static void sunxi_setup_scale (void *data,
static bool sunxi_gfx_frame(void *data, const void *frame, unsigned width,
unsigned height, uint64_t frame_count, unsigned pitch, const char *msg,
video_frame_info_t video_info)
video_frame_info_t *video_info)
{
struct sunxi_video *_dispvars = (struct sunxi_video*)data;
@ -781,11 +781,6 @@ static bool sunxi_gfx_frame(void *data, const void *frame, unsigned width,
if (_dispvars->menu_active)
{
char buf[128];
buf[0] = '\0';
video_monitor_get_fps(video_info, buf, sizeof(buf), NULL, 0);
ioctl(_dispvars->sunxi_disp->fd_fb, FBIO_WAITFORVSYNC, 0);
return true;
}

View File

@ -378,7 +378,7 @@ static void vg_copy_frame(void *data, const void *frame,
static bool vg_frame(void *data, const void *frame,
unsigned frame_width, unsigned frame_height,
uint64_t frame_count, unsigned pitch, const char *msg,
video_frame_info_t video_info)
video_frame_info_t *video_info)
{
unsigned width, height;
vg_t *vg = (vg_t*)data;

View File

@ -133,54 +133,55 @@ static void vita2d_gfx_update_viewport(vita_video_t* vita);
static bool vita2d_gfx_frame(void *data, const void *frame,
unsigned width, unsigned height, uint64_t frame_count,
unsigned pitch, const char *msg, video_frame_info_t video_info)
unsigned pitch, const char *msg, video_frame_info_t *video_info)
{
void *tex_p;
vita_video_t *vita = (vita_video_t *)data;
if (frame)
{
if(!(vita->texture&&vita2d_texture_get_datap(vita->texture)==frame)){
unsigned i;
unsigned int stride;
if(!(vita->texture&&vita2d_texture_get_datap(vita->texture)==frame))
{
unsigned i;
unsigned int stride;
if ((width != vita->width || height != vita->height) && vita->texture)
{
vita2d_free_texture(vita->texture);
vita->texture = NULL;
}
if ((width != vita->width || height != vita->height) && vita->texture)
{
vita2d_free_texture(vita->texture);
vita->texture = NULL;
}
if (!vita->texture)
{
RARCH_LOG("Creating texture: %ix%i\n", width, height);
vita->width = width;
vita->height = height;
vita->texture = vita2d_create_empty_texture_format(width, height, vita->format);
vita2d_texture_set_filters(vita->texture,vita->tex_filter,vita->tex_filter);
}
tex_p = vita2d_texture_get_datap(vita->texture);
stride = vita2d_texture_get_stride(vita->texture);
if (!vita->texture)
{
RARCH_LOG("Creating texture: %ix%i\n", width, height);
vita->width = width;
vita->height = height;
vita->texture = vita2d_create_empty_texture_format(width, height, vita->format);
vita2d_texture_set_filters(vita->texture,vita->tex_filter,vita->tex_filter);
}
tex_p = vita2d_texture_get_datap(vita->texture);
stride = vita2d_texture_get_stride(vita->texture);
if (vita->format == SCE_GXM_TEXTURE_FORMAT_X8U8U8U8_1RGB)
{
stride /= 4;
pitch /= 4;
uint32_t *tex32 = tex_p;
const uint32_t *frame32 = frame;
if (vita->format == SCE_GXM_TEXTURE_FORMAT_X8U8U8U8_1RGB)
{
stride /= 4;
pitch /= 4;
uint32_t *tex32 = tex_p;
const uint32_t *frame32 = frame;
for (i = 0; i < height; i++)
memcpy_neon(&tex32[i*stride],&frame32[i*pitch],pitch*sizeof(uint32_t));
}
else
{
stride /= 2;
pitch /= 2;
uint16_t *tex16 = tex_p;
const uint16_t *frame16 = frame;
for (i = 0; i < height; i++)
memcpy_neon(&tex32[i*stride],&frame32[i*pitch],pitch*sizeof(uint32_t));
}
else
{
stride /= 2;
pitch /= 2;
uint16_t *tex16 = tex_p;
const uint16_t *frame16 = frame;
for (i = 0; i < height; i++)
memcpy_neon(&tex16[i*stride],&frame16[i*pitch],width*sizeof(uint16_t));
}
for (i = 0; i < height; i++)
memcpy_neon(&tex16[i*stride],&frame16[i*pitch],width*sizeof(uint16_t));
}
}
}
@ -188,9 +189,9 @@ static bool vita2d_gfx_frame(void *data, const void *frame,
vita2d_gfx_update_viewport(vita);
vita2d_start_drawing();
vita2d_draw_rectangle(0,0,PSP_FB_WIDTH,PSP_FB_HEIGHT,vita2d_get_clear_color());
if (vita->texture)
{
if (vita->fullscreen)
@ -205,21 +206,9 @@ static bool vita2d_gfx_frame(void *data, const void *frame,
float scalex = vita->vp.width / (float)vita->width;
float scaley = vita->vp.height / (float)vita->height;
vita2d_draw_texture_scale_rotate(vita->texture,vita->vp.x,
vita->vp.y, scalex, scaley, rad);
vita->vp.y, scalex, scaley, rad);
}
}
if (video_info.fps_show)
{
char buffer[128];
char buffer_fps[128];
buffer[0] = buffer_fps[0] = '\0';
video_monitor_get_fps(video_info, buffer, sizeof(buffer),
video_info.fps_show ? buffer_fps : NULL, sizeof(buffer_fps));
runloop_msg_queue_push(buffer_fps, 1, 1, false);
}
#ifdef HAVE_OVERLAY
if (vita->overlay_enable)
@ -228,43 +217,39 @@ static bool vita2d_gfx_frame(void *data, const void *frame,
if (vita->menu.active)
{
menu_driver_ctl(RARCH_MENU_CTL_FRAME, NULL);
if(vita->menu.texture){
if (vita->fullscreen)
vita2d_draw_texture_scale(vita->menu.texture,
0, 0,
PSP_FB_WIDTH / (float)vita->menu.width,
PSP_FB_HEIGHT / (float)vita->menu.height);
else
{
if (vita->menu.width > vita->menu.height)
{
float scale = PSP_FB_HEIGHT / (float)vita->menu.height;
float w = vita->menu.width * scale;
vita2d_draw_texture_scale(vita->menu.texture,
PSP_FB_WIDTH / 2.0f - w/2.0f, 0.0f,
scale, scale);
}
else
{
float scale = PSP_FB_WIDTH / (float)vita->menu.width;
float h = vita->menu.height * scale;
vita2d_draw_texture_scale(vita->menu.texture,
0.0f, PSP_FB_HEIGHT / 2.0f - h/2.0f,
scale, scale);
}
}
}
menu_driver_ctl(RARCH_MENU_CTL_FRAME, NULL);
if(vita->menu.texture){
if (vita->fullscreen)
vita2d_draw_texture_scale(vita->menu.texture,
0, 0,
PSP_FB_WIDTH / (float)vita->menu.width,
PSP_FB_HEIGHT / (float)vita->menu.height);
else
{
if (vita->menu.width > vita->menu.height)
{
float scale = PSP_FB_HEIGHT / (float)vita->menu.height;
float w = vita->menu.width * scale;
vita2d_draw_texture_scale(vita->menu.texture,
PSP_FB_WIDTH / 2.0f - w/2.0f, 0.0f,
scale, scale);
}
else
{
float scale = PSP_FB_WIDTH / (float)vita->menu.width;
float h = vita->menu.height * scale;
vita2d_draw_texture_scale(vita->menu.texture,
0.0f, PSP_FB_HEIGHT / 2.0f - h/2.0f,
scale, scale);
}
}
}
}
if(!string_is_empty(msg))
font_driver_render_msg(NULL, msg, NULL);
font_driver_render_msg(NULL, msg, NULL);
vita2d_end_drawing();
vita2d_swap_buffers();

View File

@ -1463,7 +1463,7 @@ static void vulkan_readback(vk_t *vk)
VK_PIPELINE_STAGE_HOST_BIT);
}
static void vulkan_inject_black_frame(vk_t *vk, video_frame_info_t video_info)
static void vulkan_inject_black_frame(vk_t *vk, video_frame_info_t *video_info)
{
VkCommandBufferBeginInfo begin_info = {
VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO };
@ -1520,7 +1520,7 @@ static void vulkan_inject_black_frame(vk_t *vk, video_frame_info_t video_info)
static bool vulkan_frame(void *data, const void *frame,
unsigned frame_width, unsigned frame_height,
uint64_t frame_count,
unsigned pitch, const char *msg, video_frame_info_t video_info)
unsigned pitch, const char *msg, video_frame_info_t *video_info)
{
struct vk_per_frame *chain;
unsigned width, height;
@ -1931,7 +1931,7 @@ static bool vulkan_frame(void *data, const void *frame,
/* Disable BFI during fast forward, slow-motion,
* and pause to prevent flicker. */
if (
video_info.black_frame_insertion
video_info->black_frame_insertion
&& !input_driver_is_nonblock_state()
&& !runloop_ctl(RUNLOOP_CTL_IS_SLOWMOTION, NULL)
&& !runloop_ctl(RUNLOOP_CTL_IS_PAUSED, NULL))

View File

@ -550,7 +550,7 @@ static void wiiu_gfx_free(void* data)
static bool wiiu_gfx_frame(void* data, const void* frame,
unsigned width, unsigned height, uint64_t frame_count,
unsigned pitch, const char* msg, video_frame_info_t video_info)
unsigned pitch, const char* msg, video_frame_info_t *video_info)
{
(void)msg;
int i;

View File

@ -192,7 +192,7 @@ static void *xenon360_gfx_init(const video_info_t *video, const input_driver_t *
}
static bool xenon360_gfx_frame(void *data, const void *frame, unsigned width, unsigned height,
uint64_t frame_count, unsigned pitch, const char *msg, video_frame_info_t video_info)
uint64_t frame_count, unsigned pitch, const char *msg, video_frame_info_t *video_info)
{
gl_t *vid = data;

View File

@ -94,7 +94,7 @@ static void *xshm_gfx_init(const video_info_t *video,
static bool xshm_gfx_frame(void *data, const void *frame, unsigned width,
unsigned height, uint64_t frame_count,
unsigned pitch, const char *msg, video_frame_info_t video_info)
unsigned pitch, const char *msg, video_frame_info_t *video_info)
{
xshm_t* xshm = (xshm_t*)data;
int y;

View File

@ -530,8 +530,8 @@ static void *xv_init(const video_info_t *video,
video_driver_build_info(&video_info);
if (video_monitor_get_fps(video_info, buf, sizeof(buf), NULL, 0))
XStoreName(g_x11_dpy, g_x11_win, buf);
if (video_info.monitor_fps_enable)
XStoreName(g_x11_dpy, g_x11_win, video_info.window_text);
x11_set_window_attr(g_x11_dpy, g_x11_win);
@ -784,7 +784,7 @@ static void xv_render_msg(xv_t *xv, const char *msg,
static bool xv_frame(void *data, const void *frame, unsigned width,
unsigned height, uint64_t frame_count,
unsigned pitch, const char *msg, video_frame_info_t video_info)
unsigned pitch, const char *msg, video_frame_info_t *video_info)
{
XWindowAttributes target;
xv_t *xv = (xv_t*)data;
@ -811,7 +811,7 @@ static bool xv_frame(void *data, const void *frame, unsigned width,
true);
XSync(g_x11_dpy, False);
x11_update_window_title(NULL, video_info);
x11_update_title(NULL, video_info);
return true;
}

View File

@ -314,21 +314,12 @@ static bool android_gfx_ctx_set_resize(void *data,
return false;
}
static void android_gfx_ctx_update_window_title(void *data, video_frame_info_t video_info)
static void android_gfx_ctx_update_title(void *data, video_frame_info_t *video_info)
{
char buf[128];
char buf_fps[128];
buf[0] = buf_fps[0] = '\0';
video_monitor_get_fps(video_info, buf, sizeof(buf),
buf_fps, sizeof(buf_fps));
if (video_info.fps_show)
runloop_msg_queue_push(buf_fps, 1, 1, false);
}
static bool android_gfx_ctx_set_video_mode(void *data,
video_frame_info_t video_info,
video_frame_info_t *video_info,
unsigned width, unsigned height,
bool fullscreen)
{
@ -493,7 +484,7 @@ dpi_fallback:
return true;
}
static void android_gfx_ctx_swap_buffers(void *data, video_frame_info_t video_info)
static void android_gfx_ctx_swap_buffers(void *data, video_frame_info_t *video_info)
{
android_ctx_data_t *and = (android_ctx_data_t*)data;
@ -618,7 +609,7 @@ const gfx_ctx_driver_t gfx_ctx_android = {
NULL, /* get_video_output_next */
android_gfx_ctx_get_metrics,
NULL,
android_gfx_ctx_update_window_title,
android_gfx_ctx_update_title,
android_gfx_ctx_check_window,
android_gfx_ctx_set_resize,
android_gfx_ctx_has_focus,

View File

@ -95,7 +95,7 @@ static void gfx_ctx_cgl_check_window(void *data, bool *quit,
}
}
static void gfx_ctx_cgl_swap_buffers(void *data, video_frame_info_t video_info)
static void gfx_ctx_cgl_swap_buffers(void *data, video_frame_info_t *video_info)
{
gfx_ctx_cgl_data_t *cgl = (gfx_ctx_cgl_data_t*)data;
@ -110,22 +110,12 @@ static bool gfx_ctx_cgl_set_resize(void *data, unsigned width, unsigned height)
return false;
}
static void gfx_ctx_cgl_update_window_title(void *data, video_frame_info_t video_info)
static void gfx_ctx_cgl_update_title(void *data, video_frame_info_t *video_info)
{
char buf[128];
char buf_fps[128];
buf[0] = buf_fps[0] = '\0';
video_monitor_get_fps(video_info, buf, sizeof(buf),
buf_fps, sizeof(buf_fps));
if (video_info.fps_show)
runloop_msg_queue_push(buf_fps, 1, 1, false);
}
static bool gfx_ctx_cgl_set_video_mode(void *data,
video_frame_info_t video_info,
video_frame_info_t *video_info,
unsigned width, unsigned height,
bool fullscreen)
{

View File

@ -330,7 +330,7 @@ static void cocoagl_gfx_ctx_show_mouse(void *data, bool state)
}
static bool cocoagl_gfx_ctx_set_video_mode(void *data,
video_frame_info_t video_info,
video_frame_info_t *video_info,
unsigned width, unsigned height, bool fullscreen)
{
#if defined(HAVE_COCOA)
@ -416,27 +416,17 @@ static void cocoagl_gfx_ctx_get_video_size(void *data, unsigned* width, unsigned
*height = CGRectGetHeight(size) * screenscale;
}
static void cocoagl_gfx_ctx_update_window_title(void *data, video_frame_info_t video_info)
static void cocoagl_gfx_ctx_update_title(void *data, video_frame_info_t *video_info)
{
#if defined(HAVE_COCOA)
ui_window_cocoa_t view;
const ui_window_t *window = NULL;
#endif
static char buf_fps[128] = {0};
static char buf[128] = {0};
video_monitor_get_fps(video_info, buf, sizeof(buf),
buf_fps, sizeof(buf_fps));
#if defined(HAVE_COCOA)
window = ui_companion_driver_get_window_ptr();
const ui_window_t *window = ui_companion_driver_get_window_ptr();
view.data = (CocoaView*)nsview_get_ptr();
if (window && *buf)
window->set_title(&view, buf);
if (window && video_info->monitor_fps_enable)
window->set_title(&view, video_info->window_text);
#endif
if (video_info.fps_show)
runloop_msg_queue_push(buf_fps, 1, 1, false);
}
static bool cocoagl_gfx_ctx_get_metrics(void *data, enum display_metric_types type,
@ -537,7 +527,7 @@ static bool cocoagl_gfx_ctx_has_windowed(void *data)
#endif
}
static void cocoagl_gfx_ctx_swap_buffers(void *data, video_frame_info_t video_info)
static void cocoagl_gfx_ctx_swap_buffers(void *data, video_frame_info_t *video_info)
{
if (!(--g_fast_forward_skips < 0))
return;

View File

@ -76,7 +76,7 @@ static bool gfx_ctx_d3d_set_resize(void *data, unsigned new_width, unsigned new_
return true;
}
static void gfx_ctx_d3d_swap_buffers(void *data, video_frame_info_t video_info)
static void gfx_ctx_d3d_swap_buffers(void *data, video_frame_info_t *video_info)
{
d3d_video_t *d3d = (d3d_video_t*)data;
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)d3d->dev;
@ -84,25 +84,11 @@ static void gfx_ctx_d3d_swap_buffers(void *data, video_frame_info_t video_info)
d3d_swap(d3d, d3dr);
}
static void gfx_ctx_d3d_update_title(void *data, video_frame_info_t video_info)
static void gfx_ctx_d3d_update_title(void *data, video_frame_info_t *video_info)
{
char buf[128];
char buffer_fps[128];
const ui_window_t *window = ui_companion_driver_get_window_ptr();
buf[0] = buffer_fps[0] = '\0';
if (window && video_monitor_get_fps(video_info, buf, sizeof(buf),
buffer_fps, sizeof(buffer_fps)))
{
#ifndef _XBOX
window->set_title(&main_window, buf);
#endif
}
if (video_info.fps_show)
{
#ifdef _XBOX
if (video_info->fps_show)
{
MEMORYSTATUS stat;
char mem[128];
@ -111,10 +97,15 @@ static void gfx_ctx_d3d_update_title(void *data, video_frame_info_t video_info)
GlobalMemoryStatus(&stat);
snprintf(mem, sizeof(mem), "|| MEM: %.2f/%.2fMB",
stat.dwAvailPhys/(1024.0f*1024.0f), stat.dwTotalPhys/(1024.0f*1024.0f));
strlcat(buffer_fps, mem, sizeof(buffer_fps));
#endif
runloop_msg_queue_push(buffer_fps, 1, 1, false);
strlcat(video_info->fps_text, mem, sizeof(video_info->fps_text));
}
#else
const ui_window_t *window = ui_companion_driver_get_window_ptr();
if (window && video_info->monitor_fps_enable)
window->set_title(&main_window, video_info->window_text);
#endif
}
static void gfx_ctx_d3d_show_mouse(void *data, bool state)
@ -197,7 +188,7 @@ static void gfx_ctx_d3d_input_driver(void *data,
}
static bool gfx_ctx_d3d_set_video_mode(void *data,
video_frame_info_t video_info,
video_frame_info_t *video_info,
unsigned width, unsigned height,
bool fullscreen)
{

View File

@ -225,7 +225,7 @@ static bool gfx_ctx_drm_queue_flip(void)
return false;
}
static void gfx_ctx_drm_swap_buffers(void *data, video_frame_info_t video_info)
static void gfx_ctx_drm_swap_buffers(void *data, video_frame_info_t *video_info)
{
gfx_ctx_drm_data_t *drm = (gfx_ctx_drm_data_t*)data;
@ -253,7 +253,7 @@ static void gfx_ctx_drm_swap_buffers(void *data, video_frame_info_t video_info)
waiting_for_flip = gfx_ctx_drm_queue_flip();
/* Triple-buffered page flips */
if (video_info.max_swapchain_images >= 3 &&
if (video_info->max_swapchain_images >= 3 &&
gbm_surface_has_free_buffers(g_gbm_surface))
return;
@ -270,18 +270,8 @@ static bool gfx_ctx_drm_set_resize(void *data,
return false;
}
static void gfx_ctx_drm_update_window_title(void *data, video_frame_info_t video_info)
static void gfx_ctx_drm_update_window_title(void *data, video_frame_info_t *video_info)
{
char buf[128];
char buf_fps[128];
buf[0] = buf_fps[0] = '\0';
video_monitor_get_fps(video_info, buf, sizeof(buf),
buf_fps, sizeof(buf_fps));
if (video_info.fps_show)
runloop_msg_queue_push( buf_fps, 1, 1, false);
}
static void gfx_ctx_drm_get_video_size(void *data,
@ -617,7 +607,7 @@ error:
#endif
static bool gfx_ctx_drm_set_video_mode(void *data,
video_frame_info_t video_info,
video_frame_info_t *video_info,
unsigned width, unsigned height,
bool fullscreen)
{
@ -634,7 +624,7 @@ static bool gfx_ctx_drm_set_video_mode(void *data,
/* If we use black frame insertion,
* we fake a 60 Hz monitor for 120 Hz one,
* etc, so try to match that. */
refresh_mod = video_info.black_frame_insertion
refresh_mod = video_info->black_frame_insertion
? 0.5f : 1.0f;
/* Find desired video mode, and use that.
@ -660,7 +650,7 @@ static bool gfx_ctx_drm_set_video_mode(void *data,
continue;
diff = fabsf(refresh_mod * g_drm_connector->modes[i].vrefresh
- video_info.refresh_rate);
- video_info->refresh_rate);
if (!g_drm_mode || diff < minimum_fps_diff)
{

View File

@ -75,7 +75,7 @@ static void gfx_ctx_emscripten_check_window(void *data, bool *quit,
*quit = false;
}
static void gfx_ctx_emscripten_swap_buffers(void *data, video_frame_info_t video_info)
static void gfx_ctx_emscripten_swap_buffers(void *data, video_frame_info_t *video_info)
{
(void)data;
/* no-op in emscripten, no way to force swap/wait for VSync in browsers */
@ -90,17 +90,8 @@ static bool gfx_ctx_emscripten_set_resize(void *data,
return false;
}
static void gfx_ctx_emscripten_update_window_title(void *data, video_frame_info_t video_info)
static void gfx_ctx_emscripten_update_title(void *data, video_frame_info_t *video_info)
{
char buf[128];
char buf_fps[128];
buf[0] = buf_fps[0] = '\0';
video_monitor_get_fps(video_info, buf, sizeof(buf),
buf_fps, sizeof(buf_fps));
if (video_info.fps_show)
runloop_msg_queue_push(buf_fps, 1, 1, false);
}
static void gfx_ctx_emscripten_get_video_size(void *data,
@ -189,7 +180,7 @@ error:
}
static bool gfx_ctx_emscripten_set_video_mode(void *data,
video_frame_info_t video_info,
video_frame_info_t *video_info,
unsigned width, unsigned height,
bool fullscreen)
{
@ -330,7 +321,7 @@ const gfx_ctx_driver_t gfx_ctx_emscripten = {
NULL, /* get_video_output_next */
NULL, /* get_metrics */
gfx_ctx_emscripten_translate_aspect,
gfx_ctx_emscripten_update_window_title,
gfx_ctx_emscripten_update_title,
gfx_ctx_emscripten_check_window,
gfx_ctx_emscripten_set_resize,
gfx_ctx_emscripten_has_focus,

View File

@ -87,19 +87,12 @@ static bool gfx_ctx_gdi_set_resize(void *data,
return false;
}
static void gfx_ctx_gdi_update_window_title(void *data, video_frame_info_t video_info)
static void gfx_ctx_gdi_update_title(void *data, video_frame_info_t *video_info)
{
char buf[128];
char buf_fps[128];
const ui_window_t *window = ui_companion_driver_get_window_ptr();
buf[0] = buf_fps[0] = '\0';
if (window && video_monitor_get_fps(video_info, buf, sizeof(buf),
buf_fps, sizeof(buf_fps)))
window->set_title(&main_window, buf);
if (video_info.fps_show)
runloop_msg_queue_push(buf_fps, 1, 1, false);
if (window && video_info->monitor_fps_enable)
window->set_title(&main_window, video_info->window_text);
}
static void gfx_ctx_gdi_get_video_size(void *data,
@ -190,7 +183,7 @@ static void gfx_ctx_gdi_destroy(void *data)
}
static bool gfx_ctx_gdi_set_video_mode(void *data,
video_frame_info_t video_info,
video_frame_info_t *video_info,
unsigned width, unsigned height,
bool fullscreen)
{
@ -287,7 +280,7 @@ static uint32_t gfx_ctx_gdi_get_flags(void *data)
return flags;
}
static void gfx_ctx_gdi_swap_buffers(void *data, video_frame_info_t video_info)
static void gfx_ctx_gdi_swap_buffers(void *data, video_frame_info_t *video_info)
{
(void)data;

View File

@ -35,7 +35,7 @@ static void gfx_ctx_null_check_window(void *data, bool *quit,
(void)resize;
}
static void gfx_ctx_null_swap_buffers(void *data, video_frame_info_t video_info)
static void gfx_ctx_null_swap_buffers(void *data, video_frame_info_t *video_info)
{
(void)data;
}
@ -48,10 +48,8 @@ static bool gfx_ctx_null_set_resize(void *data, unsigned width, unsigned height)
return false;
}
static void gfx_ctx_null_update_window_title(void *data, video_frame_info_t video_info)
static void gfx_ctx_null_update_window_title(void *data, video_frame_info_t *video_info)
{
(void)data;
(void)video_info;
}
static void gfx_ctx_null_get_video_size(void *data, unsigned *width, unsigned *height)
@ -62,7 +60,7 @@ static void gfx_ctx_null_get_video_size(void *data, unsigned *width, unsigned *h
}
static bool gfx_ctx_null_set_video_mode(void *data,
video_frame_info_t video_info,
video_frame_info_t *video_info,
unsigned width, unsigned height,
bool fullscreen)
{

View File

@ -110,21 +110,12 @@ static bool gfx_ctx_khr_display_set_resize(void *data,
return false;
}
static void gfx_ctx_khr_display_update_window_title(void *data, video_frame_info_t video_info)
static void gfx_ctx_khr_display_update_window_title(void *data, video_frame_info_t *video_info)
{
char buf[128];
char buf_fps[128];
buf[0] = buf_fps[0] = '\0';
video_monitor_get_fps(video_info, buf, sizeof(buf),
buf_fps, sizeof(buf_fps));
if (video_info.fps_show)
runloop_msg_queue_push(buf_fps, 1, 1, false);
}
static bool gfx_ctx_khr_display_set_video_mode(void *data,
video_frame_info_t video_info,
video_frame_info_t *video_info,
unsigned width, unsigned height,
bool fullscreen)
{
@ -201,7 +192,7 @@ static void gfx_ctx_khr_display_set_swap_interval(void *data, unsigned swap_inte
}
}
static void gfx_ctx_khr_display_swap_buffers(void *data, video_frame_info_t video_info)
static void gfx_ctx_khr_display_swap_buffers(void *data, video_frame_info_t *video_info)
{
khr_display_ctx_data_t *khr = (khr_display_ctx_data_t*)data;
vulkan_present(&khr->vk, khr->vk.context.current_swapchain_index);

View File

@ -158,21 +158,12 @@ static bool gfx_ctx_mali_fbdev_set_resize(void *data,
return false;
}
static void gfx_ctx_mali_fbdev_update_window_title(void *data, video_frame_info_t video_info)
static void gfx_ctx_mali_fbdev_update_title(void *data, video_frame_info_t *video_info)
{
char buf[128];
char buf_fps[128];
buf[0] = buf_fps[0] = '\0';
video_monitor_get_fps(video_info, buf, sizeof(buf),
buf_fps, sizeof(buf_fps));
if (video_info.fps_show)
runloop_msg_queue_push(buf_fps, 1, 1, false);
}
static bool gfx_ctx_mali_fbdev_set_video_mode(void *data,
video_frame_info_t video_info,
video_frame_info_t *video_info,
unsigned width, unsigned height,
bool fullscreen)
{
@ -269,7 +260,7 @@ static void gfx_ctx_mali_fbdev_set_swap_interval(void *data, unsigned swap_inter
#endif
}
static void gfx_ctx_mali_fbdev_swap_buffers(void *data, video_frame_info_t video_info)
static void gfx_ctx_mali_fbdev_swap_buffers(void *data, video_frame_info_t *video_info)
{
mali_ctx_data_t *mali = (mali_ctx_data_t*)data;
@ -319,7 +310,7 @@ const gfx_ctx_driver_t gfx_ctx_mali_fbdev = {
NULL, /* get_video_output_next */
NULL, /* get_metrics */
NULL,
gfx_ctx_mali_fbdev_update_window_title,
gfx_ctx_mali_fbdev_update_title,
gfx_ctx_mali_fbdev_check_window,
gfx_ctx_mali_fbdev_set_resize,
gfx_ctx_mali_fbdev_has_focus,

View File

@ -141,21 +141,12 @@ static bool gfx_ctx_opendingux_set_resize(void *data,
return false;
}
static void gfx_ctx_opendingux_update_window_title(void *data, video_frame_info_t video_info)
static void gfx_ctx_opendingux_update_title(void *data, video_frame_info_t *video_info)
{
char buf[128];
char buf_fps[128];
buf[0] = buf_fps[0] = '\0';
video_monitor_get_fps(video_info, buf, sizeof(buf),
buf_fps, sizeof(buf_fps));
if (video_info.fps_show)
runloop_msg_queue_push(buf_fps, 1, 1, false);
}
static bool gfx_ctx_opendingux_set_video_mode(void *data,
video_frame_info_t video_info,
video_frame_info_t *video_info,
unsigned width, unsigned height,
bool fullscreen)
{
@ -232,7 +223,7 @@ static bool gfx_ctx_opendingux_has_windowed(void *data)
return false;
}
static void gfx_ctx_opendingux_swap_buffers(void *data, video_frame_info_t video_info)
static void gfx_ctx_opendingux_swap_buffers(void *data, video_frame_info_t *video_info)
{
opendingux_ctx_data_t *viv = (opendingux_ctx_data_t*)data;

View File

@ -238,7 +238,7 @@ static void osmesa_ctx_swap_interval(void *data, unsigned interval)
}
static bool osmesa_ctx_set_video_mode(void *data,
video_frame_info_t video_info,
video_frame_info_t *video_info,
unsigned width, unsigned height,
bool fullscreen)
{
@ -306,20 +306,8 @@ static void osmesa_ctx_get_video_size(void *data,
*height = osmesa->height;
}
static void osmesa_ctx_update_window_title(void *data, video_frame_info_t video_info)
static void osmesa_ctx_update_title(void *data, video_frame_info_t *video_info)
{
static char buf[128] = {0};
static char buf_fps[128] = {0};
gfx_ctx_osmesa_data_t *osmesa = (gfx_ctx_osmesa_data_t*)data;
if (!osmesa)
return;
video_monitor_get_fps(video_info, buf,
sizeof(buf), buf_fps, sizeof(buf_fps));
if (video_info.fps_show)
runloop_msg_queue_push(buf_fps, 1, 1, false);
}
static void osmesa_ctx_check_window(void *data, bool *quit, bool *resize,unsigned *width,
@ -361,7 +349,7 @@ static bool osmesa_ctx_has_windowed(void *data)
return true;
}
static void osmesa_ctx_swap_buffers(void *data, video_frame_info_t video_info)
static void osmesa_ctx_swap_buffers(void *data, video_frame_info_t *video_info)
{
gfx_ctx_osmesa_data_t *osmesa = (gfx_ctx_osmesa_data_t*)data;
osmesa_fifo_accept(osmesa);
@ -417,7 +405,7 @@ const gfx_ctx_driver_t gfx_ctx_osmesa =
NULL, /* get_video_output_next */
NULL, /* get_metrics */
NULL, /* translate_aspect */
osmesa_ctx_update_window_title,
osmesa_ctx_update_title,
osmesa_ctx_check_window,
osmesa_ctx_set_resize,
osmesa_ctx_has_focus,

View File

@ -179,7 +179,7 @@ static bool gfx_ctx_ps3_has_windowed(void *data)
return false;
}
static void gfx_ctx_ps3_swap_buffers(void *data, video_frame_info_t video_info)
static void gfx_ctx_ps3_swap_buffers(void *data, video_frame_info_t *video_info)
{
(void)data;
#ifdef HAVE_LIBDBGFONT
@ -199,19 +199,8 @@ static bool gfx_ctx_ps3_set_resize(void *data,
return false;
}
static void gfx_ctx_ps3_update_window_title(void *data, video_frame_info_t video_info)
static void gfx_ctx_ps3_update_title(void *data, video_frame_info_t *video_info)
{
char buf[128];
char buf_fps[128];
buf[0] = buf_fps[0] = '\0';
(void)data;
video_monitor_get_fps(video_info, buf, sizeof(buf),
buf_fps, sizeof(buf_fps));
if (video_info.fps_show)
runloop_msg_queue_push(buf_fps, 1, 1, false);
}
static void gfx_ctx_ps3_get_video_size(void *data,
@ -302,15 +291,10 @@ static void *gfx_ctx_ps3_init(video_frame_info_t video_info, void *video_driver)
}
static bool gfx_ctx_ps3_set_video_mode(void *data,
video_frame_info_t video_info,
video_frame_info_t *video_info,
unsigned width, unsigned height,
bool fullscreen)
{
global_t *global = global_get_ptr();
if (!global)
return false;
return true;
}
@ -438,7 +422,7 @@ const gfx_ctx_driver_t gfx_ctx_ps3 = {
gfx_ctx_ps3_get_video_output_next,
NULL, /* get_metrics */
NULL,
gfx_ctx_ps3_update_window_title,
gfx_ctx_ps3_update_title,
gfx_ctx_ps3_check_window,
gfx_ctx_ps3_set_resize,
gfx_ctx_ps3_has_focus,

View File

@ -319,21 +319,12 @@ static bool gfx_ctx_qnx_set_resize(void *data,
return false;
}
static void gfx_ctx_qnx_update_window_title(void *data, video_frame_info_t video_info)
static void gfx_ctx_qnx_update_title(void *data, video_frame_info_t *video_info)
{
char buf[128];
char buf_fps[128];
buf[0] = buf_fps[0] = '\0';
video_monitor_get_fps(buf, sizeof(buf),
buf_fps, sizeof(buf_fps));
if (video_info.fps_show)
runloop_msg_queue_push(buf_fps, 1, 1, false);
}
static bool gfx_ctx_qnx_set_video_mode(void *data,
video_frame_info_t video_info,
video_frame_info_t *video_info,
unsigned width, unsigned height,
bool fullscreen)
{
@ -444,7 +435,7 @@ static void gfx_ctx_qnx_set_swap_interval(void *data, unsigned swap_interval)
#endif
}
static void gfx_ctx_qnx_swap_buffers(void *data, video_frame_info_t video_info)
static void gfx_ctx_qnx_swap_buffers(void *data, video_frame_info_t *video_info)
{
qnx_ctx_data_t *qnx = (qnx_ctx_data_t*)data;
@ -493,7 +484,7 @@ const gfx_ctx_driver_t gfx_ctx_qnx = {
NULL, /* get_video_output_next */
gfx_ctx_qnx__get_metrics,
NULL,
gfx_ctx_qnx_update_window_title,
gfx_ctx_qnx_update_title,
gfx_ctx_qnx_check_window,
gfx_ctx_qnx_set_resize,
gfx_ctx_qnx_has_focus,

View File

@ -163,7 +163,7 @@ static void sdl_ctx_swap_interval(void *data, unsigned interval)
}
static bool sdl_ctx_set_video_mode(void *data,
video_frame_info_t video_info,
video_frame_info_t *video_info,
unsigned width, unsigned height,
bool fullscreen)
{
@ -177,7 +177,7 @@ static bool sdl_ctx_set_video_mode(void *data,
if (fullscreen)
{
if (video_info.windowed_fullscreen)
if (video_info->windowed_fullscreen)
fsflag = SDL_WINDOW_FULLSCREEN_DESKTOP;
else
fsflag = SDL_WINDOW_FULLSCREEN;
@ -192,7 +192,7 @@ static bool sdl_ctx_set_video_mode(void *data,
}
else
{
unsigned display = video_info.monitor_index;
unsigned display = video_info->monitor_index;
sdl->g_win = SDL_CreateWindow("", SDL_WINDOWPOS_UNDEFINED_DISPLAY(display),
SDL_WINDOWPOS_UNDEFINED_DISPLAY(display),
@ -268,27 +268,18 @@ static void sdl_ctx_get_video_size(void *data,
}
}
static void sdl_ctx_update_window_title(void *data, video_frame_info_t video_info)
static void sdl_ctx_update_title(void *data, video_frame_info_t *video_info)
{
char buf[128];
char buf_fps[128];
buf[0] = buf_fps[0] = '\0';
if (video_monitor_get_fps(video_info, buf, sizeof(buf),
buf_fps, sizeof(buf_fps)))
if (video_info->monitor_fps_enable)
{
#ifdef HAVE_SDL2
gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)data;
if (sdl)
SDL_SetWindowTitle(sdl->g_win, buf);
SDL_SetWindowTitle(sdl->g_win, video_info->window_text);
#else
SDL_WM_SetCaption(buf, NULL);
SDL_WM_SetCaption(video_info->window_text, NULL);
#endif
}
if (video_info.fps_show)
runloop_msg_queue_push(buf_fps, 1, 1, false);
}
static void sdl_ctx_check_window(void *data, bool *quit, bool *resize,unsigned *width,
@ -379,7 +370,7 @@ static bool sdl_ctx_has_windowed(void *data)
return true;
}
static void sdl_ctx_swap_buffers(void *data, video_frame_info_t video_info)
static void sdl_ctx_swap_buffers(void *data, video_frame_info_t *video_info)
{
#ifdef HAVE_SDL2
gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)data;
@ -435,7 +426,7 @@ const gfx_ctx_driver_t gfx_ctx_sdl_gl =
NULL, /* get_video_output_next */
NULL, /* get_metrics */
NULL, /* translate_aspect */
sdl_ctx_update_window_title,
sdl_ctx_update_title,
sdl_ctx_check_window,
sdl_ctx_set_resize,
sdl_ctx_has_focus,

View File

@ -105,17 +105,8 @@ static bool gfx_ctx_vc_set_resize(void *data, unsigned width, unsigned height)
return false;
}
static void gfx_ctx_vc_update_window_title(void *data, video_frame_info_t video_info)
static void gfx_ctx_vc_update_title(void *data, video_frame_info_t *video_info)
{
char buf[128];
char buf_fps[128];
buf[0] = buf_fps[0] = '\0';
video_monitor_get_fps(video_info, buf, sizeof(buf),
buf_fps, sizeof(buf_fps));
if (video_info.fps_show)
runloop_msg_queue_push(buf_fps, 1, 1, false);
}
static void gfx_ctx_vc_get_video_size(void *data,
@ -319,7 +310,7 @@ static void gfx_ctx_vc_set_swap_interval(void *data, unsigned swap_interval)
}
static bool gfx_ctx_vc_set_video_mode(void *data,
video_frame_info_t video_info,
video_frame_info_t *video_info,
unsigned width, unsigned height,
bool fullscreen)
{
@ -608,7 +599,7 @@ error:
return false;
}
static void gfx_ctx_vc_swap_buffers(void *data, video_frame_info_t video_info)
static void gfx_ctx_vc_swap_buffers(void *data, video_frame_info_t *video_info)
{
vc_ctx_data_t *vc = (vc_ctx_data_t*)data;
@ -659,7 +650,7 @@ const gfx_ctx_driver_t gfx_ctx_videocore = {
NULL, /* get_video_output_next */
NULL, /* get_metrics */
gfx_ctx_vc_translate_aspect,
gfx_ctx_vc_update_window_title,
gfx_ctx_vc_update_title,
gfx_ctx_vc_check_window,
gfx_ctx_vc_set_resize,
gfx_ctx_vc_has_focus,

View File

@ -145,21 +145,12 @@ static bool gfx_ctx_vivante_set_resize(void *data,
return false;
}
static void gfx_ctx_vivante_update_window_title(void *data, video_frame_info_t video_info)
static void gfx_ctx_vivante_update_title(void *data, video_frame_info_t *video_info)
{
char buf[128];
char buf_fps[128];
buf[0] = buf_fps[0] = '\0';
video_monitor_get_fps(video_info, buf, sizeof(buf),
buf_fps, sizeof(buf_fps));
if (video_info.fps_show)
runloop_msg_queue_push(buf_fps, 1, 1, false);
}
static bool gfx_ctx_vivante_set_video_mode(void *data,
video_frame_info_t video_info,
video_frame_info_t *video_info,
unsigned width, unsigned height,
bool fullscreen)
{
@ -246,7 +237,7 @@ static void gfx_ctx_vivante_set_swap_interval(void *data, unsigned swap_interval
#endif
}
static void gfx_ctx_vivante_swap_buffers(void *data, video_frame_info_t video_info)
static void gfx_ctx_vivante_swap_buffers(void *data, video_frame_info_t *video_info)
{
vivante_ctx_data_t *viv = (vivante_ctx_data_t*)data;
@ -297,7 +288,7 @@ const gfx_ctx_driver_t gfx_ctx_vivante_fbdev = {
NULL, /* get_video_output_next */
NULL, /* get_metrics */
NULL,
gfx_ctx_vivante_update_window_title,
gfx_ctx_vivante_update_title,
gfx_ctx_vivante_check_window,
gfx_ctx_vivante_set_resize,
gfx_ctx_vivante_has_focus,

View File

@ -719,20 +719,12 @@ static bool gfx_ctx_wl_set_resize(void *data, unsigned width, unsigned height)
return true;
}
static void gfx_ctx_wl_update_window_title(void *data, video_frame_info_t video_info)
static void gfx_ctx_wl_update_title(void *data, video_frame_info_t *video_info)
{
char buf[128];
char buf_fps[128];
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;
buf[0] = buf_fps[0] = '\0';
if (video_monitor_get_fps(video_info, buf, sizeof(buf),
buf_fps, sizeof(buf_fps)))
wl_shell_surface_set_title(wl->shell_surf, buf);
if (video_info.fps_show)
runloop_msg_queue_push(buf_fps, 1, 1, false);
if (wl && video_info->monitor_fps_enable)
wl_shell_surface_set_title(wl->shell_surf, video_info->window_text);
}
@ -1075,7 +1067,7 @@ static void gfx_ctx_wl_set_swap_interval(void *data, unsigned swap_interval)
}
static bool gfx_ctx_wl_set_video_mode(void *data,
video_frame_info_t video_info,
video_frame_info_t *video_info,
unsigned width, unsigned height,
bool fullscreen)
{
@ -1557,7 +1549,7 @@ static void *gfx_ctx_wl_get_context_data(void *data)
}
#endif
static void gfx_ctx_wl_swap_buffers(void *data, video_frame_info_t video_info)
static void gfx_ctx_wl_swap_buffers(void *data, video_frame_info_t *video_info)
{
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;
@ -1676,7 +1668,7 @@ const gfx_ctx_driver_t gfx_ctx_wayland = {
NULL, /* get_video_output_next */
gfx_ctx_wl_get_metrics,
NULL,
gfx_ctx_wl_update_window_title,
gfx_ctx_wl_update_title,
gfx_ctx_wl_check_window,
gfx_ctx_wl_set_resize,
gfx_ctx_wl_has_focus,

View File

@ -331,7 +331,7 @@ static void gfx_ctx_wgl_check_window(void *data, bool *quit,
}
}
static void gfx_ctx_wgl_swap_buffers(void *data, video_frame_info_t video_info)
static void gfx_ctx_wgl_swap_buffers(void *data, video_frame_info_t *video_info)
{
(void)data;
@ -386,19 +386,12 @@ static bool gfx_ctx_wgl_set_resize(void *data,
return false;
}
static void gfx_ctx_wgl_update_window_title(void *data, video_frame_info_t video_info)
static void gfx_ctx_wgl_update_title(void *data, video_frame_info_t *video_info)
{
char buf[128];
char buf_fps[128];
const ui_window_t *window = ui_companion_driver_get_window_ptr();
buf[0] = buf_fps[0] = '\0';
if (window && video_monitor_get_fps(video_info, buf, sizeof(buf),
buf_fps, sizeof(buf_fps)))
window->set_title(&main_window, buf);
if (video_info.fps_show)
runloop_msg_queue_push(buf_fps, 1, 1, false);
if (window && video_info->monitor_fps_enable)
window->set_title(&main_window, video_info->window_text);
}
static void gfx_ctx_wgl_get_video_size(void *data,
@ -525,7 +518,7 @@ static void gfx_ctx_wgl_destroy(void *data)
}
static bool gfx_ctx_wgl_set_video_mode(void *data,
video_frame_info_t video_info,
video_frame_info_t *video_info,
unsigned width, unsigned height,
bool fullscreen)
{
@ -687,7 +680,7 @@ const gfx_ctx_driver_t gfx_ctx_wgl = {
NULL, /* get_video_output_next */
gfx_ctx_wgl_get_metrics,
NULL,
gfx_ctx_wgl_update_window_title,
gfx_ctx_wgl_update_title,
gfx_ctx_wgl_check_window,
gfx_ctx_wgl_set_resize,
gfx_ctx_wgl_has_focus,

View File

@ -302,7 +302,7 @@ static void gfx_ctx_x_swap_interval(void *data, unsigned interval)
}
}
static void gfx_ctx_x_swap_buffers(void *data, video_frame_info_t video_info)
static void gfx_ctx_x_swap_buffers(void *data, video_frame_info_t *video_info)
{
gfx_ctx_x_data_t *x = (gfx_ctx_x_data_t*)data;
@ -545,7 +545,7 @@ error:
}
static bool gfx_ctx_x_set_video_mode(void *data,
video_frame_info_t video_info,
video_frame_info_t *video_info,
unsigned width, unsigned height,
bool fullscreen)
{
@ -565,7 +565,7 @@ static bool gfx_ctx_x_set_video_mode(void *data,
if (!x)
return false;
windowed_full = video_info.windowed_fullscreen;
windowed_full = video_info->windowed_fullscreen;
true_full = false;
switch (x_api)
@ -613,8 +613,8 @@ static bool gfx_ctx_x_set_video_mode(void *data,
RARCH_ERR("[GLX]: Entering true fullscreen failed. Will attempt windowed mode.\n");
}
if (video_info.monitor_index)
g_x11_screen = video_info.monitor_index - 1;
if (video_info->monitor_index)
g_x11_screen = video_info->monitor_index - 1;
#ifdef HAVE_XINERAMA
if (fullscreen || g_x11_screen != 0)
@ -662,7 +662,7 @@ static bool gfx_ctx_x_set_video_mode(void *data,
x11_set_window_attr(g_x11_dpy, g_x11_win);
x11_update_window_title(NULL, video_info);
x11_update_title(NULL, video_info);
if (fullscreen)
x11_show_mouse(g_x11_dpy, g_x11_win, false);
@ -1081,7 +1081,7 @@ const gfx_ctx_driver_t gfx_ctx_x = {
NULL, /* get_video_output_next */
x11_get_metrics,
NULL,
x11_update_window_title,
x11_update_title,
gfx_ctx_x_check_window,
gfx_ctx_x_set_resize,
x11_has_focus,

View File

@ -257,7 +257,7 @@ static EGLint *xegl_fill_attribs(xegl_ctx_data_t *xegl, EGLint *attr)
static void gfx_ctx_xegl_set_swap_interval(void *data, unsigned swap_interval);
static bool gfx_ctx_xegl_set_video_mode(void *data,
video_frame_info_t video_info,
video_frame_info_t *video_info,
unsigned width, unsigned height,
bool fullscreen)
{
@ -298,7 +298,7 @@ static bool gfx_ctx_xegl_set_video_mode(void *data,
ButtonPressMask | ButtonReleaseMask | KeyReleaseMask;
swa.override_redirect = fullscreen ? True : False;
if (fullscreen && !video_info.windowed_fullscreen)
if (fullscreen && !video_info->windowed_fullscreen)
{
if (x11_enter_fullscreen(video_info, g_x11_dpy, width, height, &xegl->desktop_mode))
{
@ -309,8 +309,8 @@ static bool gfx_ctx_xegl_set_video_mode(void *data,
RARCH_ERR("[X/EGL]: Entering true fullscreen failed. Will attempt windowed mode.\n");
}
if (video_info.monitor_index)
g_x11_screen = video_info.monitor_index - 1;
if (video_info->monitor_index)
g_x11_screen = video_info->monitor_index - 1;
#ifdef HAVE_XINERAMA
if (fullscreen || g_x11_screen != 0)
@ -352,7 +352,7 @@ static bool gfx_ctx_xegl_set_video_mode(void *data,
goto error;
x11_set_window_attr(g_x11_dpy, g_x11_win);
x11_update_window_title(NULL, video_info);
x11_update_title(NULL, video_info);
if (fullscreen)
x11_show_mouse(g_x11_dpy, g_x11_win, false);
@ -490,7 +490,7 @@ static void gfx_ctx_xegl_show_mouse(void *data, bool state)
x11_show_mouse(g_x11_dpy, g_x11_win, state);
}
static void gfx_ctx_xegl_swap_buffers(void *data, video_frame_info_t video_info)
static void gfx_ctx_xegl_swap_buffers(void *data, video_frame_info_t *video_info)
{
xegl_ctx_data_t *xegl = (xegl_ctx_data_t*)data;
@ -591,7 +591,7 @@ const gfx_ctx_driver_t gfx_ctx_x_egl =
NULL, /* get_video_output_next */
x11_get_metrics,
NULL,
x11_update_window_title,
x11_update_title,
x11_check_window,
gfx_ctx_xegl_set_resize,
x11_has_focus,

View File

@ -456,7 +456,7 @@ bool video_context_driver_set_video_mode(gfx_ctx_mode_t *mode_info)
video_driver_build_info(&video_info);
if (!current_video_context->set_video_mode(
video_context_data, video_info, mode_info->width,
video_context_data, &video_info, mode_info->width,
mode_info->height, mode_info->fullscreen))
return false;
return true;

View File

@ -78,7 +78,7 @@ typedef struct gfx_ctx_driver
void (*swap_interval)(void *data, unsigned);
/* Sets video mode. Creates a window, etc. */
bool (*set_video_mode)(void*, video_frame_info_t video_info, unsigned, unsigned, bool);
bool (*set_video_mode)(void*, video_frame_info_t *video_info, unsigned, unsigned, bool);
/* Gets current window size.
* If not initialized yet, it returns current screen size. */
@ -101,7 +101,7 @@ typedef struct gfx_ctx_driver
float (*translate_aspect)(void*, unsigned, unsigned);
/* Asks driver to update window title (FPS, etc). */
void (*update_window_title)(void*, video_frame_info_t video_info);
void (*update_window_title)(void*, video_frame_info_t *video_info);
/* Queries for resize and quit events.
* Also processes events. */
@ -123,7 +123,7 @@ typedef struct gfx_ctx_driver
/* Swaps buffers. VBlank sync depends on
* earlier calls to swap_interval. */
void (*swap_buffers)(void*, video_frame_info_t video_info);
void (*swap_buffers)(void*, video_frame_info_t *video_info);
/* Most video backends will want to use a certain input driver.
* Checks for it here. */

View File

@ -1057,89 +1057,6 @@ bool video_monitor_fps_statistics(double *refresh_rate,
}
/**
* video_monitor_get_fps:
* @buf : string suitable for Window title
* @size : size of buffer.
* @buf_fps : string of raw FPS only (optional).
* @size_fps : size of raw FPS buffer.
*
* Get the amount of frames per seconds.
*
* Returns: true if framerate per seconds could be obtained,
* otherwise false.
*
**/
bool video_monitor_get_fps(
video_frame_info_t video_info,
char *buf, size_t size,
char *buf_fps, size_t size_fps)
{
static retro_time_t curr_time;
static retro_time_t fps_time;
retro_time_t new_time = cpu_features_get_time_usec();
uint64_t frame_count = 0;
video_driver_threaded_lock();
frame_count = video_driver_frame_count;
video_driver_threaded_unlock();
*buf = '\0';
if (frame_count)
{
static float last_fps;
bool ret = false;
unsigned write_index = video_driver_frame_time_count++ &
(MEASURE_FRAME_TIME_SAMPLES_COUNT - 1);
video_driver_frame_time_samples[write_index] = new_time - fps_time;
fps_time = new_time;
if ((frame_count % FPS_UPDATE_INTERVAL) == 0)
{
char frames_text[64];
last_fps = TIME_TO_FPS(curr_time, new_time, FPS_UPDATE_INTERVAL);
curr_time = new_time;
fill_pathname_noext(buf,
video_driver_title_buf,
" || ",
size);
if (video_info.fps_show)
{
char fps_text[64];
snprintf(fps_text, sizeof(fps_text), " FPS: %6.1f || ", last_fps);
strlcat(buf, fps_text, size);
}
strlcat(buf, "Frames: ", size);
snprintf(frames_text, sizeof(frames_text), STRING_REP_UINT64,
(unsigned long long)frame_count);
strlcat(buf, frames_text, size);
ret = true;
}
if (buf_fps && video_info.fps_show)
snprintf(buf_fps, size_fps, "FPS: %6.1f || %s: " STRING_REP_UINT64,
last_fps,
msg_hash_to_str(MSG_FRAMES),
(unsigned long long)frame_count);
return ret;
}
curr_time = fps_time = new_time;
strlcpy(buf, video_driver_title_buf, size);
if (buf_fps)
strlcpy(buf_fps, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE), size_fps);
return true;
}
float video_driver_get_aspect_ratio(void)
{
@ -2086,6 +2003,93 @@ unsigned video_pixel_get_alignment(unsigned pitch)
return 8;
}
/**
* video_monitor_get_fps:
*
* Get the amount of frames per seconds.
*
* Returns: true if framerate per seconds could be obtained,
* otherwise false.
*
**/
static bool video_monitor_get_fps(video_frame_info_t *video_info)
{
static retro_time_t curr_time;
static retro_time_t fps_time;
retro_time_t new_time = cpu_features_get_time_usec();
if (video_info->frame_count)
{
static float last_fps;
bool ret = false;
unsigned write_index = video_driver_frame_time_count++ &
(MEASURE_FRAME_TIME_SAMPLES_COUNT - 1);
video_driver_frame_time_samples[write_index] = new_time - fps_time;
fps_time = new_time;
if ((video_info->frame_count % FPS_UPDATE_INTERVAL) == 0)
{
char frames_text[64];
last_fps = TIME_TO_FPS(curr_time, new_time, FPS_UPDATE_INTERVAL);
curr_time = new_time;
fill_pathname_noext(video_info->window_text,
video_driver_title_buf,
" || ",
sizeof(video_info->window_text));
if (video_info->fps_show)
{
char fps_text[64];
snprintf(video_info->fps_text,
sizeof(video_info->fps_text),
" FPS: %6.1f || ", last_fps);
strlcat(video_info->window_text,
fps_text,
sizeof(video_info->window_text));
}
strlcat(video_info->window_text,
"Frames: ",
sizeof(video_info->window_text));
snprintf(frames_text,
sizeof(frames_text),
STRING_REP_UINT64,
(unsigned long long)video_info->frame_count);
strlcat(video_info->window_text,
frames_text,
sizeof(video_info->window_text));
ret = true;
}
if (video_info->fps_text && video_info->fps_show)
snprintf(
video_info->fps_text,
sizeof(video_info->fps_text),
"FPS: %6.1f || %s: " STRING_REP_UINT64,
last_fps,
msg_hash_to_str(MSG_FRAMES),
(unsigned long long)video_info->frame_count);
return ret;
}
curr_time = fps_time = new_time;
strlcpy(video_info->window_text,
video_driver_title_buf,
sizeof(video_info->window_text));
if (video_info->fps_text)
strlcpy(video_info->fps_text,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE),
sizeof(video_info->fps_text));
return true;
}
/**
* video_driver_frame:
* @data : pointer to data of the video frame.
@ -2131,6 +2135,13 @@ void video_driver_frame(const void *data, unsigned width,
video_driver_build_info(&video_info);
video_driver_threaded_lock();
video_info.frame_count = video_driver_frame_count;
video_driver_frame_count++;
video_driver_threaded_unlock();
video_info.monitor_fps_enable = video_monitor_get_fps(&video_info);
/* Slightly messy code,
* but we really need to do processing before blocking on VSync
* for best possible scheduling.
@ -2161,16 +2172,14 @@ void video_driver_frame(const void *data, unsigned width,
&& video_info.font_enable && msg)
strlcpy(video_driver_msg, msg, sizeof(video_driver_msg));
video_driver_threaded_lock();
frame_count = video_driver_frame_count;
video_driver_frame_count++;
video_driver_threaded_unlock();
if (!current_video || !current_video->frame(
video_driver_data, data, width, height,
frame_count,
pitch, video_driver_msg, video_info))
pitch, video_driver_msg, &video_info))
video_driver_active = false;
if (video_info.fps_show)
runloop_msg_queue_push(video_info.fps_text, 1, 1, false);
}
void video_driver_display_type_set(enum rarch_display_type type)
@ -2245,6 +2254,10 @@ void video_driver_build_info(video_frame_info_t *video_info)
video_info->monitor_index = settings->video.monitor_index;
video_info->shared_context = settings->video.shared_context;
video_info->font_enable = settings->video.font_enable;
video_info->frame_count = 0;
video_info->window_text[0] = '\0';
video_info->fps_text[0] = '\0';
}
/**

View File

@ -101,6 +101,10 @@ typedef struct video_frame_info
bool fullscreen;
unsigned monitor_index;
bool font_enable;
bool monitor_fps_enable;
char window_text[128];
char fps_text[128];
uint64_t frame_count;
} video_frame_info_t;
/* Optionally implemented interface to poke more
@ -163,7 +167,7 @@ typedef struct video_viewport
typedef bool (*video_driver_frame_t)(void *data,
const void *frame, unsigned width,
unsigned height, uint64_t frame_count,
unsigned pitch, const char *msg, video_frame_info_t video_info);
unsigned pitch, const char *msg, video_frame_info_t *video_info);
typedef struct video_driver
{
@ -462,25 +466,6 @@ void video_monitor_set_refresh_rate(float hz);
bool video_monitor_fps_statistics(double *refresh_rate,
double *deviation, unsigned *sample_points);
/**
* video_monitor_get_fps:
* @video_info : information about the video frame
* @buf : string suitable for Window title
* @size : size of buffer.
* @buf_fps : string of raw FPS only (optional).
* @size_fps : size of raw FPS buffer.
*
* Get the amount of frames per seconds.
*
* Returns: true if framerate per seconds could be obtained,
* otherwise false.
*
**/
bool video_monitor_get_fps(
video_frame_info_t video_info,
char *buf, size_t size,
char *buf_fps, size_t size_fps);
unsigned video_pixel_get_alignment(unsigned pitch);
const video_poke_interface_t *video_driver_get_poke(void);

View File

@ -619,7 +619,7 @@ static void video_thread_loop(void *data)
thr->frame.buffer, thr->frame.width, thr->frame.height,
thr->frame.count,
thr->frame.pitch, *thr->frame.msg ? thr->frame.msg : NULL,
video_info);
&video_info);
}
slock_unlock(thr->frame.lock);
@ -706,7 +706,7 @@ static bool video_thread_has_windowed(void *data)
static bool video_thread_frame(void *data, const void *frame_,
unsigned width, unsigned height, uint64_t frame_count,
unsigned pitch, const char *msg, video_frame_info_t video_info)
unsigned pitch, const char *msg, video_frame_info_t *video_info)
{
unsigned copy_stride;
static struct retro_perf_counter thr_frame = {0};
@ -741,7 +741,7 @@ static bool video_thread_frame(void *data, const void *frame_,
{
retro_time_t target_frame_time = (retro_time_t)
roundf(1000000 / video_info.refresh_rate);
roundf(1000000 / video_info->refresh_rate);
retro_time_t target = thr->last_time + target_frame_time;
/* Ideally, use absolute time, but that is only a good idea on POSIX. */