Notification font + statistics adjustments (#15089)
This commit is contained in:
parent
dc6b6d5cdb
commit
da076faa47
|
@ -1145,7 +1145,7 @@ bool video_display_server_has_refresh_rate(float hz)
|
||||||
|
|
||||||
if (video_list)
|
if (video_list)
|
||||||
{
|
{
|
||||||
video_driver_state_t *video_st = &video_driver_st;
|
video_driver_state_t *video_st = &video_driver_st;
|
||||||
unsigned video_driver_width = video_st->width;
|
unsigned video_driver_width = video_st->width;
|
||||||
unsigned video_driver_height = video_st->height;
|
unsigned video_driver_height = video_st->height;
|
||||||
|
|
||||||
|
@ -1498,8 +1498,7 @@ void video_driver_free_internal(void)
|
||||||
input_driver_state_t *input_st = input_state_get_ptr();
|
input_driver_state_t *input_st = input_state_get_ptr();
|
||||||
video_driver_state_t *video_st = &video_driver_st;
|
video_driver_state_t *video_st = &video_driver_st;
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
bool is_threaded =
|
bool is_threaded = VIDEO_DRIVER_IS_THREADED_INTERNAL(video_st);
|
||||||
VIDEO_DRIVER_IS_THREADED_INTERNAL(video_st);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
command_event(CMD_EVENT_OVERLAY_DEINIT, NULL);
|
command_event(CMD_EVENT_OVERLAY_DEINIT, NULL);
|
||||||
|
@ -2731,6 +2730,7 @@ void video_driver_build_info(video_frame_info_t *video_info)
|
||||||
video_info->monitor_index = settings->uints.video_monitor_index;
|
video_info->monitor_index = settings->uints.video_monitor_index;
|
||||||
|
|
||||||
video_info->font_enable = settings->bools.video_font_enable;
|
video_info->font_enable = settings->bools.video_font_enable;
|
||||||
|
video_info->font_size = settings->floats.video_font_size;
|
||||||
video_info->font_msg_pos_x = settings->floats.video_msg_pos_x;
|
video_info->font_msg_pos_x = settings->floats.video_msg_pos_x;
|
||||||
video_info->font_msg_pos_y = settings->floats.video_msg_pos_y;
|
video_info->font_msg_pos_y = settings->floats.video_msg_pos_y;
|
||||||
video_info->font_msg_color_r = settings->floats.video_msg_color_r;
|
video_info->font_msg_color_r = settings->floats.video_msg_color_r;
|
||||||
|
@ -3447,7 +3447,6 @@ bool video_driver_init_internal(bool *video_is_threaded, bool verbosity_enabled)
|
||||||
video.vsync = settings->bools.video_vsync
|
video.vsync = settings->bools.video_vsync
|
||||||
&& (!(runloop_st->flags & RUNLOOP_FLAG_FORCE_NONBLOCK));
|
&& (!(runloop_st->flags & RUNLOOP_FLAG_FORCE_NONBLOCK));
|
||||||
video.force_aspect = settings->bools.video_force_aspect;
|
video.force_aspect = settings->bools.video_force_aspect;
|
||||||
video.font_enable = settings->bools.video_font_enable;
|
|
||||||
video.swap_interval = runloop_get_video_swap_interval(
|
video.swap_interval = runloop_get_video_swap_interval(
|
||||||
settings->uints.video_swap_interval);
|
settings->uints.video_swap_interval);
|
||||||
video.adaptive_vsync = settings->bools.video_adaptive_vsync;
|
video.adaptive_vsync = settings->bools.video_adaptive_vsync;
|
||||||
|
@ -3458,6 +3457,7 @@ bool video_driver_init_internal(bool *video_is_threaded, bool verbosity_enabled)
|
||||||
video.smooth = settings->bools.video_smooth;
|
video.smooth = settings->bools.video_smooth;
|
||||||
video.ctx_scaling = settings->bools.video_ctx_scaling;
|
video.ctx_scaling = settings->bools.video_ctx_scaling;
|
||||||
video.input_scale = scale;
|
video.input_scale = scale;
|
||||||
|
video.font_enable = settings->bools.video_font_enable;
|
||||||
video.font_size = settings->floats.video_font_size;
|
video.font_size = settings->floats.video_font_size;
|
||||||
video.path_font = settings->paths.path_font;
|
video.path_font = settings->paths.path_font;
|
||||||
#ifdef HAVE_VIDEO_FILTER
|
#ifdef HAVE_VIDEO_FILTER
|
||||||
|
@ -3990,14 +3990,32 @@ void video_driver_frame(const void *data, unsigned width,
|
||||||
if (render_frame && video_info.statistics_show)
|
if (render_frame && video_info.statistics_show)
|
||||||
{
|
{
|
||||||
audio_statistics_t audio_stats;
|
audio_statistics_t audio_stats;
|
||||||
char runahead_stats[128];
|
char latency_stats[128];
|
||||||
|
char tmp[128];
|
||||||
|
size_t len;
|
||||||
double stddev = 0.0;
|
double stddev = 0.0;
|
||||||
|
float scale = 1.0f;
|
||||||
|
float font_size_scale = video_info.font_size / 100;
|
||||||
struct retro_system_av_info *av_info = &video_st->av_info;
|
struct retro_system_av_info *av_info = &video_st->av_info;
|
||||||
unsigned red = 255;
|
unsigned red = 235;
|
||||||
unsigned green = 255;
|
unsigned green = 235;
|
||||||
unsigned blue = 255;
|
unsigned blue = 235;
|
||||||
unsigned alpha = 255;
|
unsigned alpha = 255;
|
||||||
|
|
||||||
|
scale = ((float)video_info.height / 480)
|
||||||
|
* 0.50f * (DEFAULT_FONT_SIZE / video_info.font_size);
|
||||||
|
scale = (scale < font_size_scale)
|
||||||
|
? font_size_scale : scale;
|
||||||
|
scale = (scale > 1.00f)
|
||||||
|
? 1.00f : scale;
|
||||||
|
|
||||||
|
if (scale > font_size_scale)
|
||||||
|
{
|
||||||
|
scale *= 100;
|
||||||
|
scale = ceil(scale);
|
||||||
|
scale /= 100;
|
||||||
|
}
|
||||||
|
|
||||||
audio_stats.samples = 0;
|
audio_stats.samples = 0;
|
||||||
audio_stats.average_buffer_saturation = 0.0f;
|
audio_stats.average_buffer_saturation = 0.0f;
|
||||||
audio_stats.std_deviation_percentage = 0.0f;
|
audio_stats.std_deviation_percentage = 0.0f;
|
||||||
|
@ -4006,62 +4024,94 @@ void video_driver_frame(const void *data, unsigned width,
|
||||||
|
|
||||||
video_monitor_fps_statistics(NULL, &stddev, NULL);
|
video_monitor_fps_statistics(NULL, &stddev, NULL);
|
||||||
|
|
||||||
video_info.osd_stat_params.x = 0.010f;
|
video_info.osd_stat_params.x = 0.008f;
|
||||||
video_info.osd_stat_params.y = 0.950f;
|
video_info.osd_stat_params.y = 0.960f;
|
||||||
video_info.osd_stat_params.scale = 1.0f;
|
video_info.osd_stat_params.scale = scale;
|
||||||
video_info.osd_stat_params.full_screen = true;
|
video_info.osd_stat_params.full_screen = true;
|
||||||
video_info.osd_stat_params.drop_x = -2;
|
video_info.osd_stat_params.drop_x = (video_info.font_size / DEFAULT_FONT_SIZE) * 3;
|
||||||
video_info.osd_stat_params.drop_y = -2;
|
video_info.osd_stat_params.drop_y = (video_info.font_size / DEFAULT_FONT_SIZE) * -3;
|
||||||
video_info.osd_stat_params.drop_mod = 0.3f;
|
video_info.osd_stat_params.drop_mod = 0.1f;
|
||||||
video_info.osd_stat_params.drop_alpha = 1.0f;
|
video_info.osd_stat_params.drop_alpha = 0.9f;
|
||||||
video_info.osd_stat_params.color = COLOR_ABGR(
|
video_info.osd_stat_params.color = COLOR_ABGR(
|
||||||
red, green, blue, alpha);
|
alpha, blue, green, red);
|
||||||
|
|
||||||
audio_compute_buffer_statistics(&audio_stats);
|
audio_compute_buffer_statistics(&audio_stats);
|
||||||
|
|
||||||
runahead_stats[0] = '\0';
|
latency_stats[0] = '\0';
|
||||||
|
tmp[0] = '\0';
|
||||||
|
len = 0;
|
||||||
|
|
||||||
|
if (video_st->frame_delay_target > 0)
|
||||||
|
len = snprintf(tmp, sizeof(latency_stats),
|
||||||
|
" Frame Delay: %2u ms\n"
|
||||||
|
" - Target: %2u ms\n",
|
||||||
|
video_st->frame_delay_effective,
|
||||||
|
video_st->frame_delay_target);
|
||||||
|
|
||||||
if (video_info.runahead && !video_info.runahead_second_instance)
|
if (video_info.runahead && !video_info.runahead_second_instance)
|
||||||
snprintf(runahead_stats, sizeof(runahead_stats),
|
len = snprintf(tmp + len, sizeof(latency_stats),
|
||||||
" -Run-Ahead Mode: Single Instance\n -Latency frames removed: %u\n",
|
" Run-Ahead: %2u frames\n"
|
||||||
video_info.runahead_frames);
|
" - Single Instance\n",
|
||||||
|
video_info.runahead_frames);
|
||||||
else if (video_info.runahead && video_info.runahead_second_instance)
|
else if (video_info.runahead && video_info.runahead_second_instance)
|
||||||
snprintf(runahead_stats, sizeof(runahead_stats),
|
len = snprintf(tmp + len, sizeof(latency_stats),
|
||||||
" -Run-Ahead Mode: Second Instance\n -Latency frames removed: %u\n",
|
" Run-Ahead: %2u frames\n"
|
||||||
video_info.runahead_frames);
|
" - Second Instance\n",
|
||||||
|
video_info.runahead_frames);
|
||||||
else if (video_info.preemptive_frames)
|
else if (video_info.preemptive_frames)
|
||||||
snprintf(runahead_stats, sizeof(runahead_stats),
|
len = snprintf(tmp + len, sizeof(latency_stats),
|
||||||
" -Run-Ahead Mode: Preemptive Frames\n -Latency frames removed: %u\n",
|
" Run-Ahead: %2u frames\n"
|
||||||
video_info.runahead_frames);
|
" - Preemptive Frames\n",
|
||||||
|
video_info.runahead_frames);
|
||||||
|
|
||||||
|
if (len)
|
||||||
|
{
|
||||||
|
strlcpy(latency_stats, "LATENCY\n", sizeof(latency_stats));
|
||||||
|
strlcat(latency_stats, tmp, sizeof(latency_stats));
|
||||||
|
}
|
||||||
|
|
||||||
snprintf(video_info.stat_text,
|
snprintf(video_info.stat_text,
|
||||||
sizeof(video_info.stat_text),
|
sizeof(video_info.stat_text),
|
||||||
"Video Statistics:\n -Frame rate: %6.2f fps\n -Frame time: %6.2f ms\n -Frame time deviation: %.3f %%\n"
|
"CORE AV_INFO\n"
|
||||||
" -Frame count: %" PRIu64"\n -Frame delay (target/effective): %u/%u ms\n%s -Viewport: %d x %d x %3.2f\n"
|
" Size: %u x %u\n"
|
||||||
"Audio Statistics:\n -Average buffer saturation: %.2f %%\n -Standard deviation: %.2f %%\n -Time spent close to underrun: %.2f %%\n -Time spent close to blocking: %.2f %%\n -Sample count: %d\n"
|
" Max Size: %u x %u\n"
|
||||||
"Core Geometry:\n -Size: %u x %u\n -Max Size: %u x %u\n -Aspect: %3.2f\nCore Timing:\n -FPS: %3.2f\n -Sample Rate: %6.2f\n",
|
" Aspect: %3.3f\n"
|
||||||
last_fps,
|
" FPS: %3.2f\n"
|
||||||
frame_time / 1000.0f,
|
" Sample Rate: %6.2f\n"
|
||||||
100.0f * stddev,
|
"VIDEO\n"
|
||||||
video_st->frame_count,
|
" Viewport: %d x %d\n"
|
||||||
video_st->frame_delay_target,
|
" Refresh: %5.2f hz\n"
|
||||||
video_st->frame_delay_effective,
|
" Frame Rate: %5.2f fps\n"
|
||||||
runahead_stats,
|
" Frame Time: %5.2f ms\n"
|
||||||
video_info.width,
|
" - Deviation: %5.2f %%\n"
|
||||||
video_info.height,
|
" Frames: %5" PRIu64"\n"
|
||||||
video_info.refresh_rate,
|
"AUDIO\n"
|
||||||
audio_stats.average_buffer_saturation,
|
" Saturation: %5.2f %%\n"
|
||||||
audio_stats.std_deviation_percentage,
|
" Deviation: %5.2f %%\n"
|
||||||
audio_stats.close_to_underrun,
|
" Underrun: %5.2f %%\n"
|
||||||
audio_stats.close_to_blocking,
|
" Blocking: %5.2f %%\n"
|
||||||
audio_stats.samples,
|
" Samples: %5d\n"
|
||||||
|
"%s",
|
||||||
av_info->geometry.base_width,
|
av_info->geometry.base_width,
|
||||||
av_info->geometry.base_height,
|
av_info->geometry.base_height,
|
||||||
av_info->geometry.max_width,
|
av_info->geometry.max_width,
|
||||||
av_info->geometry.max_height,
|
av_info->geometry.max_height,
|
||||||
av_info->geometry.aspect_ratio,
|
av_info->geometry.aspect_ratio,
|
||||||
av_info->timing.fps,
|
av_info->timing.fps,
|
||||||
av_info->timing.sample_rate);
|
av_info->timing.sample_rate,
|
||||||
|
video_info.width,
|
||||||
|
video_info.height,
|
||||||
|
video_info.refresh_rate,
|
||||||
|
last_fps,
|
||||||
|
frame_time / 1000.0f,
|
||||||
|
100.0f * stddev,
|
||||||
|
video_st->frame_count,
|
||||||
|
audio_stats.average_buffer_saturation,
|
||||||
|
audio_stats.std_deviation_percentage,
|
||||||
|
audio_stats.close_to_underrun,
|
||||||
|
audio_stats.close_to_blocking,
|
||||||
|
audio_stats.samples,
|
||||||
|
latency_stats);
|
||||||
|
|
||||||
/* TODO/FIXME - add OSD chat text here */
|
/* TODO/FIXME - add OSD chat text here */
|
||||||
}
|
}
|
||||||
|
|
|
@ -424,6 +424,7 @@ typedef struct video_frame_info
|
||||||
float menu_header_opacity;
|
float menu_header_opacity;
|
||||||
float menu_footer_opacity;
|
float menu_footer_opacity;
|
||||||
float refresh_rate;
|
float refresh_rate;
|
||||||
|
float font_size;
|
||||||
float font_msg_pos_x;
|
float font_msg_pos_x;
|
||||||
float font_msg_pos_y;
|
float font_msg_pos_y;
|
||||||
float font_msg_color_r;
|
float font_msg_color_r;
|
||||||
|
@ -431,7 +432,6 @@ typedef struct video_frame_info
|
||||||
float font_msg_color_b;
|
float font_msg_color_b;
|
||||||
float xmb_alpha_factor;
|
float xmb_alpha_factor;
|
||||||
|
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
/* Drop shadow offset.
|
/* Drop shadow offset.
|
||||||
|
|
|
@ -971,7 +971,7 @@ int generic_action_ok_displaylist_push(const char *path,
|
||||||
|
|
||||||
action_ok_get_file_browser_start_path(
|
action_ok_get_file_browser_start_path(
|
||||||
settings->paths.path_font,
|
settings->paths.path_font,
|
||||||
NULL,
|
settings->paths.directory_assets,
|
||||||
parent_dir, sizeof(parent_dir), true);
|
parent_dir, sizeof(parent_dir), true);
|
||||||
|
|
||||||
info_path = parent_dir;
|
info_path = parent_dir;
|
||||||
|
|
|
@ -232,6 +232,17 @@ static int action_scan_input_desc(const char *path,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int action_scan_video_font_path(const char *path,
|
||||||
|
const char *label, unsigned type, size_t idx)
|
||||||
|
{
|
||||||
|
settings_t *settings = config_get_ptr();
|
||||||
|
|
||||||
|
strlcpy(settings->paths.path_font, "null", sizeof(settings->paths.path_font));
|
||||||
|
command_event(CMD_EVENT_REINIT, NULL);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int menu_cbs_init_bind_scan_compare_type(menu_file_list_cbs_t *cbs,
|
static int menu_cbs_init_bind_scan_compare_type(menu_file_list_cbs_t *cbs,
|
||||||
unsigned type)
|
unsigned type)
|
||||||
{
|
{
|
||||||
|
@ -279,10 +290,21 @@ int menu_cbs_init_bind_scan(menu_file_list_cbs_t *cbs,
|
||||||
|
|
||||||
if (cbs->setting)
|
if (cbs->setting)
|
||||||
{
|
{
|
||||||
if (cbs->setting->type == ST_BIND)
|
switch (cbs->setting->type)
|
||||||
{
|
{
|
||||||
BIND_ACTION_SCAN(cbs, action_scan_input_desc);
|
case ST_BIND:
|
||||||
return 0;
|
BIND_ACTION_SCAN(cbs, action_scan_input_desc);
|
||||||
|
return 0;
|
||||||
|
case ST_PATH:
|
||||||
|
if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_FONT_PATH)))
|
||||||
|
{
|
||||||
|
BIND_ACTION_SCAN(cbs, action_scan_video_font_path);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
case ST_NONE:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14760,10 +14760,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
||||||
unsigned setting_type = MENU_SETTING_DROPDOWN_SETTING_FLOAT_ITEM;
|
unsigned setting_type = MENU_SETTING_DROPDOWN_SETTING_FLOAT_ITEM;
|
||||||
float step = setting->step;
|
float step = setting->step;
|
||||||
float half_step = step * 0.5f;
|
float half_step = step * 0.5f;
|
||||||
float min = (setting->flags & SD_FLAG_ENFORCE_MINRANGE) ?
|
float min = (setting->flags & SD_FLAG_ENFORCE_MINRANGE) ? setting->min : 0.00f;
|
||||||
setting->min : 0.00f;
|
float max = (setting->flags & SD_FLAG_ENFORCE_MAXRANGE) ? setting->max : 9999.00f;
|
||||||
float max = (setting->flags & SD_FLAG_ENFORCE_MAXRANGE) ?
|
|
||||||
setting->max : 9999.00f;
|
|
||||||
bool checked_found = false;
|
bool checked_found = false;
|
||||||
unsigned checked = 0;
|
unsigned checked = 0;
|
||||||
unsigned entry_index = 0;
|
unsigned entry_index = 0;
|
||||||
|
@ -14836,10 +14834,8 @@ setting->max : 9999.00f;
|
||||||
unsigned orig_value = *setting->value.target.unsigned_integer;
|
unsigned orig_value = *setting->value.target.unsigned_integer;
|
||||||
unsigned setting_type = MENU_SETTING_DROPDOWN_SETTING_UINT_ITEM;
|
unsigned setting_type = MENU_SETTING_DROPDOWN_SETTING_UINT_ITEM;
|
||||||
float step = setting->step;
|
float step = setting->step;
|
||||||
float min = (setting->flags & SD_FLAG_ENFORCE_MINRANGE) ?
|
float min = (setting->flags & SD_FLAG_ENFORCE_MINRANGE) ? setting->min : 0.00f;
|
||||||
setting->min : 0.00f;
|
float max = (setting->flags & SD_FLAG_ENFORCE_MAXRANGE) ? setting->max : 9999.00f;
|
||||||
float max = (setting->flags & SD_FLAG_ENFORCE_MAXRANGE) ?
|
|
||||||
setting->max : 9999.00f;
|
|
||||||
bool checked_found = false;
|
bool checked_found = false;
|
||||||
unsigned checked = 0;
|
unsigned checked = 0;
|
||||||
unsigned entry_index = 0;
|
unsigned entry_index = 0;
|
||||||
|
|
|
@ -3121,6 +3121,19 @@ static void setting_get_string_representation_video_filter(rarch_setting_t *sett
|
||||||
"", len);
|
"", len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void setting_get_string_representation_video_font_path(rarch_setting_t *setting,
|
||||||
|
char *s, size_t len)
|
||||||
|
{
|
||||||
|
if (!setting)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (string_is_empty(setting->value.target.string))
|
||||||
|
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DONT_CARE), len);
|
||||||
|
else
|
||||||
|
fill_pathname(s, path_basename(setting->value.target.string),
|
||||||
|
"", len);
|
||||||
|
}
|
||||||
|
|
||||||
static void setting_get_string_representation_state_slot(rarch_setting_t *setting,
|
static void setting_get_string_representation_state_slot(rarch_setting_t *setting,
|
||||||
char *s, size_t len)
|
char *s, size_t len)
|
||||||
{
|
{
|
||||||
|
@ -15280,6 +15293,7 @@ static bool setting_append_list(
|
||||||
MENU_SETTINGS_LIST_CURRENT_ADD_VALUES(list, list_info, "ttf");
|
MENU_SETTINGS_LIST_CURRENT_ADD_VALUES(list, list_info, "ttf");
|
||||||
MENU_SETTINGS_LIST_CURRENT_ADD_CMD(list, list_info, CMD_EVENT_REINIT);
|
MENU_SETTINGS_LIST_CURRENT_ADD_CMD(list, list_info, CMD_EVENT_REINIT);
|
||||||
(*list)[list_info->index - 1].ui_type = ST_UI_TYPE_FONT_SELECTOR;
|
(*list)[list_info->index - 1].ui_type = ST_UI_TYPE_FONT_SELECTOR;
|
||||||
|
(*list)[list_info->index - 1].get_string_representation = &setting_get_string_representation_video_font_path;
|
||||||
|
|
||||||
CONFIG_FLOAT(
|
CONFIG_FLOAT(
|
||||||
list, list_info,
|
list, list_info,
|
||||||
|
|
Loading…
Reference in New Issue