Skip to content

Commit

Permalink
Clean up and reduce refresh rate logging (libretro#16259)
Browse files Browse the repository at this point in the history
  • Loading branch information
sonninnos authored and Sunderland93 committed Dec 26, 2024
1 parent 9b84856 commit 0653a7a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 18 deletions.
19 changes: 14 additions & 5 deletions gfx/video_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -1174,7 +1174,7 @@ bool video_display_server_set_resolution(unsigned width, unsigned height,
int int_hz, float hz, int center, int monitor_index, int xoffset, int padjust)
{
video_driver_state_t *video_st = &video_driver_st;
RARCH_DBG("[Video]: Display server set resolution, hz: %f\n",hz);
RARCH_DBG("[Video]: Display server set resolution to %ux%u %.3f Hz.\n", width, height, hz);
if (current_display_server && current_display_server->set_resolution)
return current_display_server->set_resolution(
video_st->current_display_server_data, width, height, int_hz,
Expand Down Expand Up @@ -1291,7 +1291,7 @@ void video_switch_refresh_rate_maybe(
bool video_display_server_set_refresh_rate(float hz)
{
video_driver_state_t *video_st = &video_driver_st;
RARCH_DBG("[Video]: Display server set refresh rate %f\n", hz);
RARCH_DBG("[Video]: Display server set refresh rate to %.3f Hz.\n", hz);
if (current_display_server && current_display_server->set_resolution)
return current_display_server->set_resolution(
video_st->current_display_server_data, 0, 0, (int)hz,
Expand All @@ -1308,9 +1308,18 @@ void video_display_server_restore_refresh_rate(void)

if (!refresh_rate_original || refresh_rate_current == refresh_rate_original)
return;
RARCH_DBG("[Video]: Display server restore refresh rate %f\n", refresh_rate_original);
video_monitor_set_refresh_rate(refresh_rate_original);
video_display_server_set_refresh_rate(refresh_rate_original);

RARCH_DBG("[Video]: Restoring original refresh rate: %.3f Hz.\n", video_st->video_refresh_rate_original);

if (video_display_server_set_refresh_rate(refresh_rate_original))
{
/* Set the av_info fps also to the original refresh rate */
/* to avoid re-initialization problems */
struct retro_system_av_info *av_info = &video_st->av_info;
av_info->timing.fps = video_st->video_refresh_rate_original;

video_monitor_set_refresh_rate(refresh_rate_original);
}
}

const char *video_display_server_get_output_options(void)
Expand Down
8 changes: 1 addition & 7 deletions retroarch.c
Original file line number Diff line number Diff line change
Expand Up @@ -8156,14 +8156,8 @@ bool retroarch_main_quit(void)
/* Restore original refresh rate, if it has been changed
* automatically in SET_SYSTEM_AV_INFO */
if (video_st->video_refresh_rate_original)
{
RARCH_DBG("[Video]: Restoring original refresh rate: %f Hz\n", video_st->video_refresh_rate_original);
/* Set the av_info fps also to the original refresh rate */
/* to avoid re-initialization problems */
av_info->timing.fps = video_st->video_refresh_rate_original;

video_display_server_restore_refresh_rate();
}

if (!(runloop_st->flags & RUNLOOP_FLAG_SHUTDOWN_INITIATED))
{
if (settings->bools.savestate_auto_save &&
Expand Down
6 changes: 0 additions & 6 deletions runloop.c
Original file line number Diff line number Diff line change
Expand Up @@ -4097,13 +4097,7 @@ void runloop_event_deinit_core(void)
/* Restore original refresh rate, if it has been changed
* automatically in SET_SYSTEM_AV_INFO */
if (video_st->video_refresh_rate_original)
{
/* Set the av_info fps also to the original refresh rate */
/* to avoid re-initialization problems */
struct retro_system_av_info *av_info = &video_st->av_info;
av_info->timing.fps = video_st->video_refresh_rate_original;
video_display_server_restore_refresh_rate();
}

/* Recalibrate frame delay target */
if (settings->bools.video_frame_delay_auto)
Expand Down

0 comments on commit 0653a7a

Please sign in to comment.