mirror of
https://github.com/libretro/RetroArch
synced 2025-04-01 04:20:27 +00:00
Reimplement frame count
This commit is contained in:
parent
d98902c21e
commit
0c023dcb68
@ -1624,7 +1624,7 @@ static void d3d_get_overlay_interface(void *data,
|
||||
|
||||
static bool d3d_frame(void *data, const void *frame,
|
||||
unsigned frame_width, unsigned frame_height,
|
||||
unsigned pitch,
|
||||
uint64_t frame_count, unsigned pitch,
|
||||
const char *msg)
|
||||
{
|
||||
unsigned width, height;
|
||||
@ -1975,16 +1975,7 @@ static void d3d_set_menu_texture_enable(void *data,
|
||||
}
|
||||
#endif
|
||||
|
||||
static uint64_t d3d_get_frame_count(void *data)
|
||||
{
|
||||
d3d_video_t *d3d = (d3d_video_t*)data;
|
||||
if (!d3d)
|
||||
return 0;
|
||||
return d3d->frame_count;
|
||||
}
|
||||
|
||||
static const video_poke_interface_t d3d_poke_interface = {
|
||||
d3d_get_frame_count,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL, /* get_video_output_size */
|
||||
|
@ -63,7 +63,6 @@ typedef struct ctr_video
|
||||
ctr_vertex_t* frame_coords;
|
||||
}menu;
|
||||
|
||||
uint64_t frame_count;
|
||||
uint32_t* display_list;
|
||||
int display_list_size;
|
||||
void* texture_linear;
|
||||
@ -217,7 +216,9 @@ static void* ctr_init(const video_info_t* video,
|
||||
}
|
||||
|
||||
static bool ctr_frame(void* data, const void* frame,
|
||||
unsigned width, unsigned height, unsigned pitch, const char* msg)
|
||||
unsigned width, unsigned height,
|
||||
uint64_t frame_count,
|
||||
unsigned pitch, const char* msg)
|
||||
{
|
||||
ctr_video_t* ctr = (ctr_video_t*)data;
|
||||
settings_t* settings = config_get_ptr();
|
||||
@ -362,8 +363,6 @@ static bool ctr_frame(void* data, const void* frame,
|
||||
|
||||
RARCH_PERFORMANCE_STOP(ctrframe_f);
|
||||
|
||||
ctr->frame_count++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -501,17 +500,8 @@ static void ctr_viewport_info(void* data, struct video_viewport* vp)
|
||||
return;
|
||||
}
|
||||
|
||||
static uint64_t ctr_get_frame_count(void *data)
|
||||
{
|
||||
ctr_video_t* ctr = (ctr_video_t*)data;
|
||||
if (!ctr)
|
||||
return 0;
|
||||
return ctr->frame_count;
|
||||
}
|
||||
|
||||
static const video_poke_interface_t ctr_poke_interface =
|
||||
{
|
||||
ctr_get_frame_count,
|
||||
NULL,
|
||||
ctr_set_filtering,
|
||||
NULL, /* get_video_output_size */
|
||||
|
@ -77,7 +77,6 @@ struct dispmanx_surface
|
||||
|
||||
struct dispmanx_video
|
||||
{
|
||||
uint64_t frame_count;
|
||||
DISPMANX_DISPLAY_HANDLE_T display;
|
||||
DISPMANX_UPDATE_HANDLE_T update;
|
||||
uint32_t vc_image_ptr;
|
||||
@ -395,7 +394,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, unsigned pitch, const char *msg)
|
||||
unsigned height, uint64_t frame_count, unsigned pitch, const char *msg)
|
||||
{
|
||||
struct dispmanx_video *_dispvars = data;
|
||||
|
||||
@ -435,7 +434,6 @@ static bool dispmanx_gfx_frame(void *data, const void *frame, unsigned width,
|
||||
|
||||
/* Update main surface: locate free page, blit and flip. */
|
||||
dispmanx_surface_update(_dispvars, frame, _dispvars->main_surface);
|
||||
_dispvars->frame_count++;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -554,12 +552,6 @@ static bool dispmanx_gfx_read_viewport(void *data, uint8_t *buffer)
|
||||
return true;
|
||||
}
|
||||
|
||||
static uint64_t dispmanx_gfx_get_frame_count(void *data)
|
||||
{
|
||||
struct dispmanx_video *_dispvars = data;
|
||||
return _dispvars->frame_count;
|
||||
}
|
||||
|
||||
static void dispmanx_set_aspect_ratio (void *data, unsigned aspect_ratio_idx)
|
||||
{
|
||||
struct dispmanx_video *_dispvars = data;
|
||||
@ -602,7 +594,6 @@ static void dispmanx_set_aspect_ratio (void *data, unsigned aspect_ratio_idx)
|
||||
}
|
||||
|
||||
static const video_poke_interface_t dispmanx_poke_interface = {
|
||||
dispmanx_gfx_get_frame_count,
|
||||
NULL, /* set_video_mode */
|
||||
NULL, /* set_filtering */
|
||||
NULL, /* get_video_output_size */
|
||||
|
@ -1405,7 +1405,7 @@ static void exynos_gfx_free(void *data)
|
||||
}
|
||||
|
||||
static bool exynos_gfx_frame(void *data, const void *frame, unsigned width,
|
||||
unsigned height, unsigned pitch, const char *msg)
|
||||
unsigned height, uint64_t frame_count, unsigned pitch, const char *msg)
|
||||
{
|
||||
struct exynos_video *vid = data;
|
||||
struct exynos_page *page = NULL;
|
||||
@ -1472,8 +1472,6 @@ static bool exynos_gfx_frame(void *data, const void *frame, unsigned width,
|
||||
if (exynos_flip(vid->data, page) != 0)
|
||||
goto fail;
|
||||
|
||||
vid->frame_count++;
|
||||
|
||||
return true;
|
||||
|
||||
fail:
|
||||
@ -1625,16 +1623,7 @@ static void exynos_show_mouse(void *data, bool state)
|
||||
(void)state;
|
||||
}
|
||||
|
||||
static uint64_t exynos_get_frame_count(void *data)
|
||||
{
|
||||
struct exynos_video *vid = data;
|
||||
if (!vid)
|
||||
return 0;
|
||||
return vid->frame_count;
|
||||
}
|
||||
|
||||
static const video_poke_interface_t exynos_poke_interface = {
|
||||
exynos_get_frame_count,
|
||||
NULL, /* set_video_mode */
|
||||
NULL, /* set_filtering */
|
||||
NULL, /* get_video_output_size */
|
||||
|
@ -1521,6 +1521,7 @@ static INLINE void gl_draw_texture(gl_t *gl)
|
||||
|
||||
static bool gl_frame(void *data, const void *frame,
|
||||
unsigned frame_width, unsigned frame_height,
|
||||
uint64_t frame_count,
|
||||
unsigned pitch, const char *msg)
|
||||
{
|
||||
unsigned width, height;
|
||||
@ -1528,7 +1529,6 @@ static bool gl_frame(void *data, const void *frame,
|
||||
driver_t *driver = driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
uint64_t frame_count = video_driver_get_frame_count();
|
||||
const struct font_renderer *font_driver = driver ? driver->font_osd_driver : NULL;
|
||||
|
||||
RARCH_PERFORMANCE_INIT(frame_run);
|
||||
@ -1754,8 +1754,6 @@ static bool gl_frame(void *data, const void *frame,
|
||||
|
||||
context_bind_hw_render(gl, true);
|
||||
|
||||
gl->frame_count++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -3252,17 +3250,7 @@ static void gl_get_video_output_next(void *data)
|
||||
gfx_ctx_get_video_output_next(data);
|
||||
}
|
||||
|
||||
static uint64_t gl_get_frame_count(void *data)
|
||||
{
|
||||
gl_t *gl = (gl_t*)data;
|
||||
if (!gl)
|
||||
return 0;
|
||||
return gl->frame_count;
|
||||
}
|
||||
|
||||
|
||||
static const video_poke_interface_t gl_poke_interface = {
|
||||
gl_get_frame_count,
|
||||
gl_set_video_mode,
|
||||
NULL,
|
||||
gl_get_video_output_size,
|
||||
|
@ -47,7 +47,6 @@ struct gx_overlay_data
|
||||
|
||||
typedef struct gx_video
|
||||
{
|
||||
uint64_t frame_count;
|
||||
bool should_resize;
|
||||
bool keep_aspect;
|
||||
bool double_strike;
|
||||
@ -1166,8 +1165,6 @@ static bool gx_frame(void *data, const void *frame,
|
||||
|
||||
RARCH_PERFORMANCE_STOP(gx_frame);
|
||||
|
||||
gx->frame_count++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1309,16 +1306,7 @@ static void gx_get_video_output_next(void *data)
|
||||
}
|
||||
}
|
||||
|
||||
static uint64_t gx_get_frame_count(void *data)
|
||||
{
|
||||
gx_video_t *gx = (gx_video_t*)data;
|
||||
if (!gx)
|
||||
return 0;
|
||||
return gx->frame_count;
|
||||
}
|
||||
|
||||
static const video_poke_interface_t gx_poke_interface = {
|
||||
gx_get_frame_count,
|
||||
gx_set_video_mode,
|
||||
NULL,
|
||||
gx_get_video_output_size,
|
||||
|
@ -29,7 +29,8 @@ static void *null_gfx_init(const video_info_t *video,
|
||||
}
|
||||
|
||||
static bool null_gfx_frame(void *data, const void *frame,
|
||||
unsigned width, unsigned height, unsigned pitch, const char *msg)
|
||||
unsigned width, unsigned height, uint64_t frame_count,
|
||||
unsigned pitch, const char *msg)
|
||||
{
|
||||
(void)data;
|
||||
(void)frame;
|
||||
|
@ -775,7 +775,6 @@ static void omapfb_blit_frame(omapfb_data_t *pdata, const void *src,
|
||||
|
||||
typedef struct omap_video
|
||||
{
|
||||
uint64_t frame_count;
|
||||
omapfb_data_t *omap;
|
||||
|
||||
void *font;
|
||||
@ -975,7 +974,7 @@ fail:
|
||||
}
|
||||
|
||||
static bool omap_gfx_frame(void *data, const void *frame, unsigned width,
|
||||
unsigned height, unsigned pitch, const char *msg)
|
||||
unsigned height, uint64_t frame_count, unsigned pitch, const char *msg)
|
||||
{
|
||||
omap_video_t *vid = (omap_video_t*)data;
|
||||
|
||||
@ -1005,8 +1004,6 @@ static bool omap_gfx_frame(void *data, const void *frame, unsigned width,
|
||||
if (msg)
|
||||
omap_render_msg(vid, msg);
|
||||
|
||||
vid->frame_count++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1133,16 +1130,7 @@ static void omap_gfx_set_texture_enable(void *data, bool state, bool full_screen
|
||||
(void) full_screen;
|
||||
}
|
||||
|
||||
static uint64_t omap_gfx_get_frame_count(void *data)
|
||||
{
|
||||
omap_video_t *vid = (omap_video_t*)data;
|
||||
if (!vid)
|
||||
return 0;
|
||||
return vid->frame_count;
|
||||
}
|
||||
|
||||
static const video_poke_interface_t omap_gfx_poke_interface = {
|
||||
omap_gfx_get_frame_count,
|
||||
NULL,
|
||||
NULL, /* set_filtering */
|
||||
NULL, /* get_video_output_size */
|
||||
|
@ -85,7 +85,6 @@ typedef struct psp1_menu_frame
|
||||
|
||||
typedef struct psp1_video
|
||||
{
|
||||
uint64_t frame_count;
|
||||
void* main_dList;
|
||||
void* frame_dList;
|
||||
void* draw_buffer;
|
||||
@ -464,7 +463,8 @@ error:
|
||||
//#define DISPLAY_FPS
|
||||
|
||||
static bool psp_frame(void *data, const void *frame,
|
||||
unsigned width, unsigned height, unsigned pitch, const char *msg)
|
||||
unsigned width, unsigned height, uint64_t frame_count,
|
||||
unsigned pitch, const char *msg)
|
||||
{
|
||||
static char fps_txt[128] = {0};
|
||||
static char fps_text_buf[128] = {0};
|
||||
@ -526,7 +526,6 @@ static bool psp_frame(void *data, const void *frame,
|
||||
#endif
|
||||
|
||||
psp->draw_buffer = FROM_GU_POINTER(sceGuSwapBuffers());
|
||||
psp->frame_count++;
|
||||
|
||||
RARCH_PERFORMANCE_INIT(psp_frame_run);
|
||||
RARCH_PERFORMANCE_START(psp_frame_run);
|
||||
@ -838,16 +837,7 @@ static void psp_viewport_info(void *data, struct video_viewport *vp)
|
||||
*vp = psp->vp;
|
||||
}
|
||||
|
||||
static uint64_t psp_get_frame_count(void *data)
|
||||
{
|
||||
psp1_video_t *psp = (psp1_video_t*)data;
|
||||
if (!psp)
|
||||
return 0;
|
||||
return psp->frame_count;
|
||||
}
|
||||
|
||||
static const video_poke_interface_t psp_poke_interface = {
|
||||
psp_get_frame_count,
|
||||
NULL,
|
||||
psp_set_filtering,
|
||||
NULL, /* get_video_output_size */
|
||||
|
@ -50,7 +50,6 @@ typedef struct sdl2_tex
|
||||
|
||||
typedef struct _sdl2_video
|
||||
{
|
||||
uint64_t frame_count;
|
||||
SDL_Window *window;
|
||||
SDL_Renderer *renderer;
|
||||
|
||||
@ -491,7 +490,8 @@ static void check_window(sdl2_video_t *vid)
|
||||
}
|
||||
|
||||
static bool sdl2_gfx_frame(void *data, const void *frame, unsigned width,
|
||||
unsigned height, unsigned pitch, const char *msg)
|
||||
unsigned height, uint64_t frame_count,
|
||||
unsigned pitch, const char *msg)
|
||||
{
|
||||
char buf[128] = {0};
|
||||
sdl2_video_t *vid = (sdl2_video_t*)data;
|
||||
@ -530,8 +530,6 @@ static bool sdl2_gfx_frame(void *data, const void *frame, unsigned width,
|
||||
if (video_monitor_get_fps(buf, sizeof(buf), NULL, 0))
|
||||
SDL_SetWindowTitle(vid->window, buf);
|
||||
|
||||
vid->frame_count++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -734,16 +732,7 @@ static void sdl2_grab_mouse_toggle(void *data)
|
||||
SDL_SetWindowGrab(vid->window, SDL_GetWindowGrab(vid->window));
|
||||
}
|
||||
|
||||
static uint64_t sdl2_get_frame_count(void *data)
|
||||
{
|
||||
sdl2_video_t *vid = (sdl2_video_t*)data;
|
||||
if (!vid)
|
||||
return 0;
|
||||
return vid->frame_count;
|
||||
}
|
||||
|
||||
static video_poke_interface_t sdl2_video_poke_interface = {
|
||||
sdl2_get_frame_count,
|
||||
NULL,
|
||||
sdl2_poke_set_filtering,
|
||||
NULL, /* get_video_output_size */
|
||||
|
@ -46,7 +46,6 @@ typedef struct sdl_menu_frame
|
||||
|
||||
typedef struct sdl_video
|
||||
{
|
||||
uint64_t frame_count;
|
||||
SDL_Surface *screen;
|
||||
bool quitting;
|
||||
|
||||
@ -346,7 +345,8 @@ static void sdl_gfx_check_window(sdl_video_t *vid)
|
||||
}
|
||||
|
||||
static bool sdl_gfx_frame(void *data, const void *frame, unsigned width,
|
||||
unsigned height, unsigned pitch, const char *msg)
|
||||
unsigned height, uint64_t frame_count,
|
||||
unsigned pitch, const char *msg)
|
||||
{
|
||||
char buf[128] = {0};
|
||||
sdl_video_t *vid = (sdl_video_t*)data;
|
||||
@ -378,8 +378,6 @@ static bool sdl_gfx_frame(void *data, const void *frame, unsigned width,
|
||||
|
||||
SDL_Flip(vid->screen);
|
||||
|
||||
vid->frame_count++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -516,16 +514,7 @@ static void sdl_grab_mouse_toggle(void *data)
|
||||
SDL_WM_GrabInput(mode == SDL_GRAB_ON ? SDL_GRAB_OFF : SDL_GRAB_ON);
|
||||
}
|
||||
|
||||
static void sdl_get_frame_count(void *data)
|
||||
{
|
||||
sdl_video_t *vid = (sdl_video_t*)data;
|
||||
if (!vid)
|
||||
return 0;
|
||||
return vid->frame_count;
|
||||
}
|
||||
|
||||
static const video_poke_interface_t sdl_poke_interface = {
|
||||
sdl_get_frame_count,
|
||||
NULL,
|
||||
sdl_set_filtering,
|
||||
NULL, /* get_video_output_size */
|
||||
|
@ -499,7 +499,6 @@ struct sunxi_page
|
||||
|
||||
struct sunxi_video
|
||||
{
|
||||
uint64_t frame_count;
|
||||
void *font;
|
||||
const font_renderer_driver_t *font_driver;
|
||||
|
||||
@ -761,7 +760,7 @@ static void sunxi_setup_scale (void *data,
|
||||
}
|
||||
|
||||
static bool sunxi_gfx_frame(void *data, const void *frame, unsigned width,
|
||||
unsigned height, unsigned pitch, const char *msg)
|
||||
unsigned height, uint64_t frame_count, unsigned pitch, const char *msg)
|
||||
{
|
||||
struct sunxi_video *_dispvars = (struct sunxi_video*)data;
|
||||
|
||||
@ -788,8 +787,6 @@ static bool sunxi_gfx_frame(void *data, const void *frame, unsigned width,
|
||||
|
||||
sunxi_update_main(frame, _dispvars);
|
||||
|
||||
_dispvars->frame_count++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -920,14 +917,6 @@ static void sunxi_set_texture_frame(void *data, const void *frame, bool rgb32,
|
||||
}
|
||||
}
|
||||
|
||||
static uint64_t sunxi_get_frame_count(void *data)
|
||||
{
|
||||
struct sunxi_video *_dispvars = (struct sunxi_video*)data;
|
||||
if (!_dispvars)
|
||||
return 0;
|
||||
return _dispvars->frame_count;
|
||||
}
|
||||
|
||||
static void sunxi_set_aspect_ratio (void *data, unsigned aspect_ratio_idx)
|
||||
{
|
||||
struct sunxi_video *_dispvars = (struct sunxi_video*)data;
|
||||
@ -940,7 +929,6 @@ static void sunxi_set_aspect_ratio (void *data, unsigned aspect_ratio_idx)
|
||||
}
|
||||
|
||||
static const video_poke_interface_t sunxi_poke_interface = {
|
||||
sunxi_get_frame_count,
|
||||
NULL, /* set_video_mode */
|
||||
NULL, /* set_filtering */
|
||||
NULL, /* get_video_output_size */
|
||||
|
@ -34,7 +34,6 @@
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint64_t frame_count;
|
||||
bool should_resize;
|
||||
float mScreenAspect;
|
||||
bool mKeepAspect;
|
||||
@ -311,7 +310,8 @@ 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, unsigned pitch, const char *msg)
|
||||
unsigned frame_width, unsigned frame_height,
|
||||
uint64_t frame_count, unsigned pitch, const char *msg)
|
||||
{
|
||||
unsigned width, height;
|
||||
vg_t *vg = (vg_t*)data;
|
||||
@ -359,8 +359,6 @@ static bool vg_frame(void *data, const void *frame,
|
||||
|
||||
gfx_ctx_swap_buffers(vg);
|
||||
|
||||
vg->frame_count++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,6 @@ static bool g_quitting;
|
||||
|
||||
typedef struct gl
|
||||
{
|
||||
uint64_t frame_count;
|
||||
unsigned char *screen;
|
||||
struct XenosVertexBuffer *vb;
|
||||
struct XenosDevice * gl_device;
|
||||
@ -194,7 +193,8 @@ static void *xenon360_gfx_init(const video_info_t *video, const input_driver_t *
|
||||
return gl;
|
||||
}
|
||||
|
||||
static bool xenon360_gfx_frame(void *data, const void *frame, unsigned width, unsigned height, unsigned pitch, const char *msg)
|
||||
static bool xenon360_gfx_frame(void *data, const void *frame, unsigned width, unsigned height,
|
||||
uint64_t frame_count, unsigned pitch, const char *msg)
|
||||
{
|
||||
gl_t *vid = data;
|
||||
|
||||
@ -239,8 +239,6 @@ static bool xenon360_gfx_frame(void *data, const void *frame, unsigned width, un
|
||||
Xe_Resolve(vid->gl_device);
|
||||
Xe_Sync(vid->gl_device);
|
||||
|
||||
vid->frame_count++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,6 @@
|
||||
|
||||
typedef struct xv
|
||||
{
|
||||
uint64_t frame_count;
|
||||
Display *display;
|
||||
GC gc;
|
||||
Window window;
|
||||
@ -763,7 +762,8 @@ static void xv_render_msg(xv_t *xv, const char *msg,
|
||||
}
|
||||
|
||||
static bool xv_frame(void *data, const void *frame, unsigned width,
|
||||
unsigned height, unsigned pitch, const char *msg)
|
||||
unsigned height, uint64_t frame_count,
|
||||
unsigned pitch, const char *msg)
|
||||
{
|
||||
XWindowAttributes target;
|
||||
char buf[128] = {0};
|
||||
@ -794,8 +794,6 @@ static bool xv_frame(void *data, const void *frame, unsigned width,
|
||||
if (video_monitor_get_fps(buf, sizeof(buf), NULL, 0))
|
||||
XStoreName(xv->display, xv->window, buf);
|
||||
|
||||
xv->frame_count++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -236,13 +236,13 @@ bool gfx_ctx_check_window(void *data, bool *quit, bool *resize,
|
||||
unsigned *width, unsigned *height)
|
||||
{
|
||||
const gfx_ctx_driver_t *ctx = gfx_ctx_get_ptr();
|
||||
uint64_t frame_count = video_driver_get_frame_count();
|
||||
uint64_t *frame_count = video_driver_get_frame_count();
|
||||
|
||||
if (!data)
|
||||
return false;
|
||||
|
||||
ctx->check_window(data, quit, resize, width, height,
|
||||
(unsigned int)frame_count);
|
||||
(unsigned int)*frame_count);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -283,22 +283,11 @@ uintptr_t video_driver_get_current_framebuffer(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint64_t video_driver_get_frame_count(void)
|
||||
{
|
||||
static bool warn_once = true;
|
||||
driver_t *driver = driver_get_ptr();
|
||||
const video_poke_interface_t *poke = video_driver_get_poke_ptr(driver);
|
||||
static uint64_t video_frame_count;
|
||||
|
||||
if (!poke || !poke->get_frame_count)
|
||||
uint64_t *video_driver_get_frame_count(void)
|
||||
{
|
||||
if (warn_once)
|
||||
{
|
||||
RARCH_WARN("Frame count not implemented!\n");
|
||||
warn_once = false;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return poke->get_frame_count(driver->video_data);
|
||||
return &video_frame_count;
|
||||
}
|
||||
|
||||
retro_proc_address_t video_driver_get_proc_address(const char *sym)
|
||||
@ -395,6 +384,9 @@ static void init_video_input(const input_driver_t *tmp)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
|
||||
/* Reset video frame count */
|
||||
video_frame_count = 0;
|
||||
|
||||
/* Video driver didn't provide an input driver,
|
||||
* so we use configured one. */
|
||||
RARCH_LOG("Graphics driver did not initialize an input driver. Attempting to pick a suitable driver.\n");
|
||||
@ -1091,14 +1083,13 @@ bool video_monitor_get_fps(char *buf, size_t size,
|
||||
retro_time_t new_time;
|
||||
static retro_time_t curr_time;
|
||||
static retro_time_t fps_time;
|
||||
uint64_t frame_count = video_driver_get_frame_count();
|
||||
rarch_system_info_t *system = rarch_system_info_get_ptr();
|
||||
|
||||
*buf = '\0';
|
||||
|
||||
new_time = rarch_get_time_usec();
|
||||
|
||||
if (frame_count)
|
||||
if (video_frame_count)
|
||||
{
|
||||
bool ret = false;
|
||||
unsigned write_index = video_state.frame_time_samples_count++ &
|
||||
@ -1107,19 +1098,19 @@ bool video_monitor_get_fps(char *buf, size_t size,
|
||||
video_state.frame_time_samples[write_index] = new_time - fps_time;
|
||||
fps_time = new_time;
|
||||
|
||||
if ((frame_count % FPS_UPDATE_INTERVAL) == 0)
|
||||
if ((video_frame_count % FPS_UPDATE_INTERVAL) == 0)
|
||||
{
|
||||
last_fps = TIME_TO_FPS(curr_time, new_time, FPS_UPDATE_INTERVAL);
|
||||
curr_time = new_time;
|
||||
|
||||
snprintf(buf, size, "%s || FPS: %6.1f || Frames: " U64_SIGN,
|
||||
system->title_buf, last_fps, (unsigned long long)frame_count);
|
||||
system->title_buf, last_fps, (unsigned long long)video_frame_count);
|
||||
ret = true;
|
||||
}
|
||||
|
||||
if (buf_fps)
|
||||
snprintf(buf_fps, size_fps, "FPS: %6.1f || Frames: " U64_SIGN,
|
||||
last_fps, (unsigned long long)frame_count);
|
||||
last_fps, (unsigned long long)video_frame_count);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -100,7 +100,6 @@ enum texture_filter_type
|
||||
|
||||
typedef struct video_poke_interface
|
||||
{
|
||||
uint64_t (*get_frame_count)(void *data);
|
||||
void (*set_video_mode)(void *data, unsigned width, unsigned height, bool fullscreen);
|
||||
void (*set_filtering)(void *data, unsigned index, bool smooth);
|
||||
void (*get_video_output_size)(void *data, unsigned *width, unsigned *height);
|
||||
@ -138,7 +137,7 @@ typedef struct video_driver
|
||||
|
||||
/* msg is for showing a message on the screen along with the video frame. */
|
||||
bool (*frame)(void *data, const void *frame, unsigned width,
|
||||
unsigned height, unsigned pitch, const char *msg);
|
||||
unsigned height, uint64_t frame_count, unsigned pitch, const char *msg);
|
||||
|
||||
/* Should we care about syncing to vblank? Fast forwarding. */
|
||||
void (*set_nonblock_state)(void *data, bool toggle);
|
||||
@ -338,8 +337,6 @@ void video_driver_set_size_width(unsigned width);
|
||||
|
||||
void video_driver_set_size_height(unsigned width);
|
||||
|
||||
uint64_t video_driver_get_frame_count(void);
|
||||
|
||||
float video_driver_get_aspect_ratio(void);
|
||||
|
||||
void video_driver_set_aspect_ratio_value(float value);
|
||||
@ -383,6 +380,8 @@ void video_driver_cached_frame_get(const void **data, unsigned *width,
|
||||
|
||||
bool video_driver_cached_frame_has_valid_fb(void);
|
||||
|
||||
uint64_t *video_driver_get_frame_count(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -395,6 +395,7 @@ static void thread_loop(void *data)
|
||||
if (thr->driver && thr->driver->frame)
|
||||
ret = thr->driver->frame(thr->driver_data,
|
||||
thr->frame.buffer, thr->frame.width, thr->frame.height,
|
||||
thr->frame.count,
|
||||
thr->frame.pitch, *thr->frame.msg ? thr->frame.msg : NULL);
|
||||
|
||||
slock_unlock(thr->frame.lock);
|
||||
@ -483,7 +484,8 @@ static bool thread_has_windowed(void *data)
|
||||
}
|
||||
|
||||
static bool thread_frame(void *data, const void *frame_,
|
||||
unsigned width, unsigned height, unsigned pitch, const char *msg)
|
||||
unsigned width, unsigned height, uint64_t frame_count,
|
||||
unsigned pitch, const char *msg)
|
||||
{
|
||||
unsigned copy_stride;
|
||||
const uint8_t *src = NULL;
|
||||
@ -498,7 +500,7 @@ static bool thread_frame(void *data, const void *frame_,
|
||||
|
||||
if (thr->driver && thr->driver->frame)
|
||||
return thr->driver->frame(thr->driver_data, frame_,
|
||||
width, height, pitch, msg);
|
||||
width, height, frame_count, pitch, msg);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -549,6 +551,7 @@ static bool thread_frame(void *data, const void *frame_,
|
||||
thr->frame.updated = true;
|
||||
thr->frame.width = width;
|
||||
thr->frame.height = height;
|
||||
thr->frame.count = frame_count;
|
||||
thr->frame.pitch = copy_stride;
|
||||
|
||||
if (msg)
|
||||
@ -994,21 +997,7 @@ static struct video_shader *thread_get_current_shader(void *data)
|
||||
return thr->poke->get_current_shader(thr->driver_data);
|
||||
}
|
||||
|
||||
static uint64_t thread_get_frame_count(void *data)
|
||||
{
|
||||
uint64_t ret;
|
||||
thread_video_t *thr = (thread_video_t*)data;
|
||||
if (!thr)
|
||||
return 0;
|
||||
|
||||
slock_lock(thr->lock);
|
||||
ret = thr->hit_count+thr->miss_count;
|
||||
slock_unlock(thr->lock);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const video_poke_interface_t thread_poke = {
|
||||
thread_get_frame_count,
|
||||
thread_set_video_mode,
|
||||
thread_set_filtering,
|
||||
thread_get_video_output_size,
|
||||
|
@ -213,6 +213,7 @@ typedef struct thread_video
|
||||
unsigned pitch;
|
||||
bool updated;
|
||||
bool within_thread;
|
||||
uint64_t count;
|
||||
char msg[PATH_MAX_LENGTH];
|
||||
} frame;
|
||||
|
||||
|
@ -56,6 +56,7 @@
|
||||
static void video_frame(const void *data, unsigned width,
|
||||
unsigned height, size_t pitch)
|
||||
{
|
||||
uint64_t *frame_count = NULL;
|
||||
unsigned output_width = 0;
|
||||
unsigned output_height = 0;
|
||||
unsigned output_pitch = 0;
|
||||
@ -105,8 +106,13 @@ static void video_frame(const void *data, unsigned width,
|
||||
pitch = output_pitch;
|
||||
}
|
||||
|
||||
if (!video->frame(driver->video_data, data, width, height, pitch, driver->current_msg))
|
||||
frame_count = video_driver_get_frame_count();
|
||||
|
||||
if (!video->frame(driver->video_data, data, width, height, *frame_count,
|
||||
pitch, driver->current_msg))
|
||||
driver->video_active = false;
|
||||
|
||||
*frame_count = *frame_count + 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -341,7 +341,7 @@ static void glui_render_menu_list(glui_handle_t *glui,
|
||||
{
|
||||
unsigned width, height;
|
||||
size_t i = 0;
|
||||
uint64_t frame_count = video_driver_get_frame_count();
|
||||
uint64_t *frame_count = video_driver_get_frame_count();
|
||||
size_t end = menu_entries_get_end();
|
||||
menu_display_t *disp = menu_display_get_ptr();
|
||||
menu_entries_t *entries = menu_entries_get_ptr();
|
||||
@ -367,7 +367,7 @@ static void glui_render_menu_list(glui_handle_t *glui,
|
||||
|
||||
entry_selected = entries->navigation.selection_ptr == i;
|
||||
|
||||
glui_render_label_value(glui, y, width, frame_count / 40,
|
||||
glui_render_label_value(glui, y, width, *frame_count / 40,
|
||||
entry_selected ? hover_color : normal_color, entry_selected,
|
||||
entry.path, entry.value);
|
||||
}
|
||||
@ -390,7 +390,7 @@ static void glui_frame(void)
|
||||
menu_display_t *disp = menu_display_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
menu_input_t *menu_input = menu_input_get_ptr();
|
||||
uint64_t frame_count = video_driver_get_frame_count();
|
||||
uint64_t *frame_count = video_driver_get_frame_count();
|
||||
const uint32_t normal_color = FONT_COLOR_ARGB_TO_RGBA(
|
||||
settings->menu.entry_normal_color);
|
||||
const uint32_t hover_color = FONT_COLOR_ARGB_TO_RGBA(
|
||||
@ -443,7 +443,7 @@ static void glui_frame(void)
|
||||
ticker_limit = (width - glui->margin*2) / glui->glyph_width -
|
||||
strlen(menu_hash_to_str(MENU_VALUE_BACK)) * 2;
|
||||
menu_animation_ticker_str(title_buf, ticker_limit,
|
||||
frame_count / 100, title, true);
|
||||
*frame_count / 100, title, true);
|
||||
glui_blit_line(width / 2, 0, title_buf,
|
||||
title_color, TEXT_ALIGN_CENTER);
|
||||
|
||||
|
@ -377,7 +377,7 @@ static void rgui_render(void)
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
menu_animation_t *anim = menu_animation_get_ptr();
|
||||
uint64_t frame_count = video_driver_get_frame_count();
|
||||
uint64_t *frame_count = video_driver_get_frame_count();
|
||||
rgui_t *rgui = NULL;
|
||||
|
||||
title[0] = '\0';
|
||||
@ -466,7 +466,7 @@ static void rgui_render(void)
|
||||
menu_entries_get_title(title, sizeof(title));
|
||||
|
||||
menu_animation_ticker_str(title_buf, RGUI_TERM_WIDTH - 10,
|
||||
frame_count / RGUI_TERM_START_X, title, true);
|
||||
*frame_count / RGUI_TERM_START_X, title, true);
|
||||
|
||||
hover_color = HOVER_COLOR(settings);
|
||||
normal_color = NORMAL_COLOR(settings);
|
||||
@ -527,9 +527,9 @@ static void rgui_render(void)
|
||||
menu_entry_get_path(i, entry_path, sizeof(entry_path));
|
||||
|
||||
menu_animation_ticker_str(entry_title_buf, RGUI_TERM_WIDTH - (entry_spacing + 1 + 2),
|
||||
frame_count / RGUI_TERM_START_X, entry_path, entry_selected);
|
||||
*frame_count / RGUI_TERM_START_X, entry_path, entry_selected);
|
||||
menu_animation_ticker_str(type_str_buf, entry_spacing,
|
||||
frame_count / RGUI_TERM_START_X,
|
||||
*frame_count / RGUI_TERM_START_X,
|
||||
entry_value, entry_selected);
|
||||
|
||||
snprintf(message, sizeof(message), "%c %-*.*s %-*s",
|
||||
|
@ -133,7 +133,7 @@ static void rmenu_render(void)
|
||||
menu_animation_t *anim = menu_animation_get_ptr();
|
||||
menu_list_t *menu_list = menu_list_get_ptr();
|
||||
menu_navigation_t *nav = menu_navigation_get_ptr();
|
||||
uint64_t frame_count = video_driver_get_frame_count();
|
||||
uint64_t *frame_count = video_driver_get_frame_count();
|
||||
size_t entries_end = menu_entries_get_end();
|
||||
|
||||
if (!menu)
|
||||
@ -172,7 +172,7 @@ static void rmenu_render(void)
|
||||
menu_entries_get_title(title, sizeof(title));
|
||||
|
||||
menu_animation_ticker_str(title_buf, RMENU_TERM_WIDTH,
|
||||
frame_count / 15, title, true);
|
||||
*frame_count / 15, title, true);
|
||||
|
||||
font_parms.x = POSITION_EDGE_MIN + POSITION_OFFSET;
|
||||
font_parms.y = POSITION_EDGE_MIN + POSITION_RENDER_OFFSET
|
||||
@ -207,9 +207,9 @@ static void rmenu_render(void)
|
||||
menu_entry_get_path(i, entry_path, sizeof(entry_path));
|
||||
|
||||
menu_animation_ticker_str(entry_title_buf, RMENU_TERM_WIDTH - (entry_spacing + 1 + 2),
|
||||
frame_count / 15, entry_path, entry_selected);
|
||||
*frame_count / 15, entry_path, entry_selected);
|
||||
menu_animation_ticker_str(type_str_buf, entry_spacing,
|
||||
frame_count / 15, entry_value, entry_selected);
|
||||
*frame_count / 15, entry_value, entry_selected);
|
||||
|
||||
snprintf(message, sizeof(message), "%c %s",
|
||||
entry_selected ? '>' : ' ', entry_title_buf);
|
||||
|
@ -1230,7 +1230,7 @@ static void xmb_draw_items(xmb_handle_t *xmb, gl_t *gl,
|
||||
const char *label = NULL;
|
||||
xmb_node_t *core_node = NULL;
|
||||
size_t end = 0;
|
||||
uint64_t frame_count = video_driver_get_frame_count();
|
||||
uint64_t *frame_count = video_driver_get_frame_count();
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
@ -1390,7 +1390,7 @@ static void xmb_draw_items(xmb_handle_t *xmb, gl_t *gl,
|
||||
}
|
||||
|
||||
menu_animation_ticker_str(name, ticker_limit,
|
||||
frame_count / 20, entry.path,
|
||||
*frame_count / 20, entry.path,
|
||||
(i == current));
|
||||
|
||||
xmb_draw_text(menu, xmb, name,
|
||||
@ -1400,7 +1400,7 @@ static void xmb_draw_items(xmb_handle_t *xmb, gl_t *gl,
|
||||
1, node->label_alpha, TEXT_ALIGN_LEFT);
|
||||
|
||||
menu_animation_ticker_str(value, 35,
|
||||
frame_count / 20, entry.value,
|
||||
*frame_count / 20, entry.value,
|
||||
(i == current));
|
||||
|
||||
|
||||
|
@ -612,9 +612,8 @@ static INLINE int time_to_exit(driver_t *driver, global_t *global,
|
||||
bool shutdown_pressed = system && system->shutdown;
|
||||
bool video_alive = video && video->alive(driver->video_data);
|
||||
bool movie_end = (global->bsv.movie_end && global->bsv.eof_exit);
|
||||
uint64_t frame_count = (driver && driver->video_poke && driver->video_poke->get_frame_count) ?
|
||||
driver->video_poke->get_frame_count(driver->video_data) : 0;
|
||||
bool frame_count_end = global->max_frames && (frame_count >= global->max_frames);
|
||||
uint64_t *frame_count = video_driver_get_frame_count();
|
||||
bool frame_count_end = global->max_frames && (*frame_count >= global->max_frames);
|
||||
|
||||
if (shutdown_pressed || cmd->quit_key_pressed || frame_count_end || movie_end
|
||||
|| !video_alive)
|
||||
|
Loading…
x
Reference in New Issue
Block a user