Advertisement
Guest User

Untitled

a guest
Sep 29th, 2018
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 11.25 KB | None | 0 0
  1. diff --git a/audio/audio_driver.c b/audio/audio_driver.c
  2. index 9e083a54f4..410e97586d 100644
  3. --- a/audio/audio_driver.c
  4. +++ b/audio/audio_driver.c
  5. @@ -889,7 +889,9 @@ void audio_driver_monitor_adjust_system_rates(void)
  6.     timing_skew             = fabs(1.0f - info->fps / video_refresh_rate);
  7.     audio_driver_input      = info->sample_rate;
  8.  
  9. -   if (timing_skew <= max_timing_skew && !settings->bools.vrr_runloop_enable)
  10. +   if (timing_skew <= max_timing_skew && (!settings->bools.vrr_runloop_enable ||
  11. +      (settings->bools.vrr_runloop_enable && settings->bools.vrr_above_range_skew &&
  12. +         (info->fps > video_refresh_rate))))
  13.        audio_driver_input *= (video_refresh_rate / info->fps);
  14.  
  15.     RARCH_LOG("[Audio]: Set audio input rate to: %.2f Hz.\n",
  16. diff --git a/config.def.h b/config.def.h
  17. index 7aeaf11dd0..12a7ae410e 100644
  18. --- a/config.def.h
  19. +++ b/config.def.h
  20. @@ -623,6 +623,9 @@ static const float fastforward_ratio = 0.0;
  21.  /* Enable runloop for variable refresh rate screens. Force x1 speed while handling fast forward too. */
  22.  static const bool vrr_runloop_enable = false;
  23.  
  24. +/* Allow deviation within max_timing_skew range when the content framerate is above max refresh rate. */
  25. +static const bool vrr_above_range_skew = false;
  26. +
  27.  /* Run core logic one or more frames ahead then load the state back to reduce perceived input lag. */
  28.  static const unsigned run_ahead_frames = 1;
  29.  
  30. diff --git a/configuration.c b/configuration.c
  31. index fae1a05383..7a36b2d4be 100644
  32. --- a/configuration.c
  33. +++ b/configuration.c
  34. @@ -1292,6 +1292,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
  35.     SETTING_BOOL("suspend_screensaver_enable",    &settings->bools.ui_suspend_screensaver_enable, true, true, false);
  36.     SETTING_BOOL("rewind_enable",                 &settings->bools.rewind_enable, true, rewind_enable, false);
  37.     SETTING_BOOL("vrr_runloop_enable",            &settings->bools.vrr_runloop_enable, true, vrr_runloop_enable, false);
  38. +   SETTING_BOOL("vrr_above_range_skew",          &settings->bools.vrr_above_range_skew, true, vrr_above_range_skew, false);
  39.     SETTING_BOOL("apply_cheats_after_toggle",     &settings->bools.apply_cheats_after_toggle, true, apply_cheats_after_toggle, false);
  40.     SETTING_BOOL("apply_cheats_after_load",       &settings->bools.apply_cheats_after_load, true, apply_cheats_after_load, false);
  41.     SETTING_BOOL("run_ahead_enabled",             &settings->bools.run_ahead_enabled, true, false, false);
  42. diff --git a/configuration.h b/configuration.h
  43. index e9aeedf17d..1da194405c 100644
  44. --- a/configuration.h
  45. +++ b/configuration.h
  46. @@ -251,6 +251,7 @@ typedef struct settings
  47.        bool playlist_entry_rename;
  48.        bool rewind_enable;
  49.        bool vrr_runloop_enable;
  50. +      bool vrr_above_range_skew;
  51.        bool apply_cheats_after_toggle;
  52.        bool apply_cheats_after_load;
  53.        bool run_ahead_enabled;
  54. diff --git a/gfx/video_driver.c b/gfx/video_driver.c
  55. index 5a9b8c8e07..a92ea3b41e 100644
  56. --- a/gfx/video_driver.c
  57. +++ b/gfx/video_driver.c
  58. @@ -1459,7 +1459,9 @@ void video_driver_monitor_adjust_system_rates(void)
  59.     timing_skew                             = fabs(
  60.           1.0f - info->fps / timing_skew_hz);
  61.  
  62. -   if (!settings->bools.vrr_runloop_enable)
  63. +   if (!settings->bools.vrr_runloop_enable ||
  64. +      (settings->bools.vrr_runloop_enable && settings->bools.vrr_above_range_skew &&
  65. +      (info->fps > video_refresh_rate)))
  66.     {
  67.        /* We don't want to adjust pitch too much. If we have extreme cases,
  68.         * just don't readjust at all. */
  69. diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h
  70. index a66314de60..c46d8e63cb 100644
  71. --- a/intl/msg_hash_lbl.h
  72. +++ b/intl/msg_hash_lbl.h
  73. @@ -965,6 +965,8 @@ MSG_HASH(MENU_ENUM_LABEL_REWIND_SETTINGS,
  74.        "rewind_settings")
  75.  MSG_HASH(MENU_ENUM_LABEL_VRR_RUNLOOP_ENABLE,
  76.        "vrr_runloop_enable")
  77. +MSG_HASH(MENU_ENUM_LABEL_VRR_ABOVE_RANGE_SKEW,
  78. +      "vrr_above_range_skew")
  79.  MSG_HASH(MENU_ENUM_LABEL_CHEAT_SETTINGS,
  80.        "cheat_settings")
  81.  MSG_HASH(MENU_ENUM_LABEL_RGUI_BROWSER_DIRECTORY,
  82. diff --git a/intl/msg_hash_us.c b/intl/msg_hash_us.c
  83. index 833aee1915..ba77e2c362 100644
  84. --- a/intl/msg_hash_us.c
  85. +++ b/intl/msg_hash_us.c
  86. @@ -1263,6 +1263,16 @@ int menu_hash_get_help_us_enum(enum msg_hash_enums msg, char *s, size_t len)
  87.                               "No deviation from the core requested refresh rate,\n"
  88.                               "no sound Dynamic Rate Control).");
  89.              break;
  90. +        case MENU_ENUM_LABEL_VRR_ABOVE_RANGE_SKEW:
  91. +            snprintf(s, len,
  92. +                     "Allow above range deviation for Sync to Exact Content Framerate.\n"
  93. +                             " \n"
  94. +                             "This option will revert to deviation\n"
  95. +                             "behaviour when the content framerate\n"
  96. +                             "goes slightly above the monitor refresh rate\n"
  97. +                             "(within the Audio Maximum Timing Skew range).\n"
  98. +                             "Recommended for VRR Monitors limited to 60hz.");
  99. +            break;
  100.          case MENU_ENUM_LABEL_VIDEO_MONITOR_INDEX:
  101.              snprintf(s, len,
  102.                       "Which monitor to prefer.\n"
  103. diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h
  104. index 9ed88725b2..f95e5096f1 100644
  105. --- a/intl/msg_hash_us.h
  106. +++ b/intl/msg_hash_us.h
  107. @@ -825,6 +825,10 @@ MSG_HASH(
  108.      MENU_ENUM_LABEL_VALUE_VRR_RUNLOOP_ENABLE,
  109.      "Sync to Exact Content Framerate (G-Sync, FreeSync)"
  110.      )
  111. +MSG_HASH(
  112. +    MENU_ENUM_LABEL_VALUE_VRR_ABOVE_RANGE_SKEW,
  113. +    "Allow above range deviation for Sync to Exact Content Framerate"
  114. +    )
  115.  MSG_HASH(
  116.      MENU_ENUM_LABEL_VALUE_FRAME_THROTTLE_SETTINGS,
  117.      "Frame Throttle"
  118. @@ -5480,6 +5484,10 @@ MSG_HASH(
  119.      MENU_ENUM_SUBLABEL_VRR_RUNLOOP_ENABLE,
  120.      "No deviation from core requested timing. Use for Variable Refresh Rate screens, G-Sync, FreeSync."
  121.      )
  122. +MSG_HASH(
  123. +    MENU_ENUM_SUBLABEL_VRR_ABOVE_RANGE_SKEW,
  124. +    "Make an exception and deviate when slightly above the monitor refresh rate for Sync to Exact Content Framerate."
  125. +    )
  126.  MSG_HASH(
  127.      MENU_ENUM_SUBLABEL_XMB_LAYOUT,
  128.      "Select a different layout for the XMB interface."
  129. diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c
  130. index 0d72663fef..616e481f91 100644
  131. --- a/menu/cbs/menu_cbs_sublabel.c
  132. +++ b/menu/cbs/menu_cbs_sublabel.c
  133. @@ -209,6 +209,7 @@ default_sublabel_macro(action_bind_sublabel_savestate_auto_index,          MENU_
  134.  default_sublabel_macro(action_bind_sublabel_block_sram_overwrite,          MENU_ENUM_SUBLABEL_BLOCK_SRAM_OVERWRITE)
  135.  default_sublabel_macro(action_bind_sublabel_fastforward_ratio,             MENU_ENUM_SUBLABEL_FASTFORWARD_RATIO)
  136.  default_sublabel_macro(action_bind_sublabel_vrr_runloop_enable,            MENU_ENUM_SUBLABEL_VRR_RUNLOOP_ENABLE)
  137. +default_sublabel_macro(action_bind_sublabel_vrr_above_range_skew,          MENU_ENUM_SUBLABEL_VRR_ABOVE_RANGE_SKEW)
  138.  default_sublabel_macro(action_bind_sublabel_slowmotion_ratio,              MENU_ENUM_SUBLABEL_SLOWMOTION_RATIO)
  139.  default_sublabel_macro(action_bind_sublabel_run_ahead_enabled,             MENU_ENUM_SUBLABEL_RUN_AHEAD_ENABLED)
  140.  default_sublabel_macro(action_bind_sublabel_run_ahead_secondary_instance,  MENU_ENUM_SUBLABEL_RUN_AHEAD_SECONDARY_INSTANCE)
  141. @@ -1519,6 +1520,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
  142.           case MENU_ENUM_LABEL_VRR_RUNLOOP_ENABLE:
  143.              BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_vrr_runloop_enable);
  144.              break;
  145. +         case MENU_ENUM_LABEL_VRR_ABOVE_RANGE_SKEW:
  146. +            BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_vrr_above_range_skew);
  147. +            break;
  148.           case MENU_ENUM_LABEL_BLOCK_SRAM_OVERWRITE:
  149.              BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_block_sram_overwrite);
  150.              break;
  151. diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c
  152. index 3b47914c46..c85740fa87 100644
  153. --- a/menu/menu_displaylist.c
  154. +++ b/menu/menu_displaylist.c
  155. @@ -5171,6 +5171,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
  156.           menu_displaylist_parse_settings_enum(menu, info,
  157.                 MENU_ENUM_LABEL_VRR_RUNLOOP_ENABLE,
  158.                 PARSE_ONLY_BOOL, false);
  159. +         menu_displaylist_parse_settings_enum(menu, info,
  160. +               MENU_ENUM_LABEL_VRR_ABOVE_RANGE_SKEW,
  161. +               PARSE_ONLY_BOOL, false);
  162.  
  163.           {
  164.              settings_t      *settings     = config_get_ptr();
  165. diff --git a/menu/menu_setting.c b/menu/menu_setting.c
  166. index 0418ba464a..7cf8327d45 100644
  167. --- a/menu/menu_setting.c
  168. +++ b/menu/menu_setting.c
  169. @@ -6689,6 +6689,22 @@ static bool setting_append_list(
  170.                 SD_FLAG_NONE
  171.                 );
  172.  
  173. +         CONFIG_BOOL(
  174. +               list, list_info,
  175. +               &settings->bools.vrr_above_range_skew,
  176. +               MENU_ENUM_LABEL_VRR_ABOVE_RANGE_SKEW,
  177. +               MENU_ENUM_LABEL_VALUE_VRR_ABOVE_RANGE_SKEW,
  178. +               false,
  179. +               MENU_ENUM_LABEL_VALUE_OFF,
  180. +               MENU_ENUM_LABEL_VALUE_ON,
  181. +               &group_info,
  182. +               &subgroup_info,
  183. +               parent_group,
  184. +               general_write_handler,
  185. +               general_read_handler,
  186. +               SD_FLAG_NONE
  187. +               );
  188. +
  189.           CONFIG_FLOAT(
  190.                 list, list_info,
  191.                 &settings->floats.slowmotion_ratio,
  192. diff --git a/msg_hash.h b/msg_hash.h
  193. index 3987382c32..00fd55fa2f 100644
  194. --- a/msg_hash.h
  195. +++ b/msg_hash.h
  196. @@ -1347,6 +1347,7 @@ enum msg_hash_enums
  197.  
  198.     MENU_LABEL(FASTFORWARD_RATIO),
  199.     MENU_LABEL(VRR_RUNLOOP_ENABLE),
  200. +   MENU_LABEL(VRR_ABOVE_RANGE_SKEW),
  201.     MENU_LABEL(REWIND_ENABLE),
  202.     MENU_LABEL(CHEAT_APPLY_AFTER_TOGGLE),
  203.     MENU_LABEL(CHEAT_APPLY_AFTER_LOAD),
  204. diff --git a/retroarch.c b/retroarch.c
  205. index d307b43c6b..17a0306993 100644
  206. --- a/retroarch.c
  207. +++ b/retroarch.c
  208. @@ -3393,6 +3393,9 @@ int runloop_iterate(unsigned *sleep_ms)
  209.     unsigned i;
  210.     bool input_nonblock_state                    = input_driver_is_nonblock_state();
  211.     settings_t *settings                         = config_get_ptr();
  212. +   struct retro_system_av_info *av_info         = video_viewport_get_system_av_info();
  213. +   bool vrr_runloop_above_refresh_deviation     =
  214. +      ((av_info->timing.fps > settings->floats.video_refresh_rate) && settings->bools.vrr_above_range_skew)? true : false;
  215.     unsigned max_users                           = *(input_driver_get_uint(INPUT_ACTION_MAX_USERS));
  216.  
  217.  #ifdef HAVE_DISCORD
  218. @@ -3526,16 +3529,13 @@ int runloop_iterate(unsigned *sleep_ms)
  219.        autosave_unlock();
  220.  
  221.     /* Condition for max speed x0.0 when vrr_runloop is off to skip that part */
  222. -   if (settings->floats.fastforward_ratio || settings->bools.vrr_runloop_enable)
  223. +   if (settings->floats.fastforward_ratio || (settings->bools.vrr_runloop_enable && !vrr_runloop_above_refresh_deviation))
  224.        end:
  225.     {
  226.        retro_time_t to_sleep_ms;
  227.  
  228. -      if (settings->bools.vrr_runloop_enable)
  229. +      if (settings->bools.vrr_runloop_enable && !vrr_runloop_above_refresh_deviation)
  230.        {
  231. -         struct retro_system_av_info *av_info =
  232. -         video_viewport_get_system_av_info();
  233. -
  234.           /* Sync on video only, block audio later. */
  235.           if (fastforward_after_frames && settings->bools.audio_sync)
  236.           {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement