overlay_params: Add FPS limit method

pull/961/head
Hannes Mann 1 year ago committed by flightlessmango
parent d323752d0b
commit f92c8b1b76

@ -331,6 +331,7 @@ Parameters that are enabled by default have to be explicitly disabled. These (cu
| `font_size=` | Customizeable font size (default=24) |
| `font_size_text=` | Customizeable font size for other text like media metadata (default=24) |
| `fps_limit` | Limit the apps framerate. Comma-separated list of one or more FPS values. `0` means unlimited. |
| `fps_limit_method` | If FPS limiter should wait before or after presenting a frame. Choose `late` (default) for the lowest latency or `early` for the smoothest frametimes. |
| `fps_only` | Show FPS only. ***Not meant to be used with other display params*** |
| `frame_count` | Display frame count |
| `frametime` | Display frametime next to FPS text |

@ -8,6 +8,9 @@
### Limit the application FPS. Comma-separated list of one or more FPS values (e.g. 0,30,60). 0 means unlimited (unless VSynced)
# fps_limit=
### early = wait before present, late = wait after present
# fps_limit_method=
### VSync [0-3] 0 = adaptive; 1 = off; 2 = mailbox; 3 = on
# vsync=

@ -61,6 +61,7 @@ struct fps_limit {
Clock::duration targetFrameTime;
Clock::duration frameOverhead;
Clock::duration sleepTime;
enum fps_limit_method method;
};
struct benchmark_stats {

@ -188,6 +188,16 @@ parse_fps_limit(const char *str)
return fps_limit;
}
static enum fps_limit_method
parse_fps_limit_method(const char *str)
{
if (!strcmp(str, "early")) {
return FPS_LIMIT_METHOD_EARLY;
}
return FPS_LIMIT_METHOD_LATE;
}
static bool
parse_no_display(const char *str)
{
@ -597,6 +607,7 @@ parse_overlay_config(struct overlay_params *params,
params->height = 140;
params->control = -1;
params->fps_limit = { 0 };
params->fps_limit_method = FPS_LIMIT_METHOD_LATE;
params->vsync = -1;
params->gl_vsync = -2;
params->offset_x = 0;
@ -802,6 +813,8 @@ parse_overlay_config(struct overlay_params *params,
else
fps_limit_stats.targetFrameTime = {};
fps_limit_stats.method = params->fps_limit_method;
#ifdef HAVE_DBUS
if (params->enabled[OVERLAY_PARAM_ENABLED_media_player]) {
if (dbusmgr::dbus_mgr.init(dbusmgr::SRV_MPRIS))

@ -108,6 +108,7 @@ typedef unsigned long KeySym;
OVERLAY_PARAM_CUSTOM(no_display) \
OVERLAY_PARAM_CUSTOM(control) \
OVERLAY_PARAM_CUSTOM(fps_limit) \
OVERLAY_PARAM_CUSTOM(fps_limit_method) \
OVERLAY_PARAM_CUSTOM(vsync) \
OVERLAY_PARAM_CUSTOM(gl_vsync) \
OVERLAY_PARAM_CUSTOM(gl_size_query) \
@ -200,6 +201,11 @@ enum gl_size_query {
GL_SIZE_SCISSORBOX, // needed?
};
enum fps_limit_method {
FPS_LIMIT_METHOD_EARLY,
FPS_LIMIT_METHOD_LATE
};
enum overlay_param_enabled {
#define OVERLAY_PARAM_BOOL(name) OVERLAY_PARAM_ENABLED_##name,
#define OVERLAY_PARAM_CUSTOM(name)
@ -215,6 +221,7 @@ struct overlay_params {
int control;
uint32_t fps_sampling_period; /* ns */
std::vector<std::uint32_t> fps_limit;
enum fps_limit_method fps_limit_method;
bool help;
bool no_display;
bool full;

Loading…
Cancel
Save