mirror of
https://github.com/libretro/RetroArch
synced 2025-02-20 06:40:18 +00:00
Less dependencies on driver.h
This commit is contained in:
parent
0703b3c867
commit
e3897c8641
@ -15,9 +15,7 @@
|
||||
*/
|
||||
|
||||
#include "audio_monitor.h"
|
||||
#include "../driver.h"
|
||||
#include "../general.h"
|
||||
#include "../retroarch.h"
|
||||
|
||||
void audio_monitor_adjust_system_rates(void)
|
||||
{
|
||||
|
23
driver.c
23
driver.c
@ -208,6 +208,29 @@ void driver_adjust_system_rates(void)
|
||||
{
|
||||
audio_monitor_adjust_system_rates();
|
||||
video_monitor_adjust_system_rates();
|
||||
|
||||
if (!driver.video_data)
|
||||
return;
|
||||
|
||||
if (g_extern.system.force_nonblock)
|
||||
rarch_main_command(RARCH_CMD_VIDEO_SET_NONBLOCKING_STATE);
|
||||
else
|
||||
driver_set_nonblock_state(driver.nonblock_state);
|
||||
}
|
||||
|
||||
/**
|
||||
* driver_set_refresh_rate:
|
||||
* @hz : New refresh rate for monitor.
|
||||
*
|
||||
* Sets monitor refresh rate to new value by calling
|
||||
* video_monitor_set_refresh_rate(). Subsequently
|
||||
* calls audio_monitor_set_refresh_rate().
|
||||
**/
|
||||
void driver_set_refresh_rate(float hz)
|
||||
{
|
||||
video_monitor_set_refresh_rate(hz);
|
||||
driver_adjust_system_rates();
|
||||
audio_monitor_set_refresh_rate();
|
||||
}
|
||||
|
||||
/**
|
||||
|
10
driver.h
10
driver.h
@ -360,6 +360,16 @@ void driver_set_nonblock_state(bool enable);
|
||||
|
||||
void driver_adjust_system_rates(void);
|
||||
|
||||
/**
|
||||
* driver_set_refresh_rate:
|
||||
* @hz : New refresh rate for monitor.
|
||||
*
|
||||
* Sets monitor refresh rate to new value by calling
|
||||
* video_monitor_set_refresh_rate(). Subsequently
|
||||
* calls audio_monitor_set_refresh_rate().
|
||||
**/
|
||||
void driver_set_refresh_rate(float hz);
|
||||
|
||||
/**
|
||||
* driver_get_current_framebuffer:
|
||||
*
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include "../drivers_font_renderer/bitmap.h"
|
||||
#include "../../menu/menu.h"
|
||||
#include "../gfx_common.h"
|
||||
#include "../video_monitor.h"
|
||||
|
||||
#ifdef HW_RVL
|
||||
#include "../../wii/mem2_manager.h"
|
||||
@ -293,16 +292,16 @@ void gx_set_video_mode(void *data, unsigned fbWidth, unsigned lines)
|
||||
if (tvmode == VI_PAL)
|
||||
{
|
||||
if (modetype == VI_NON_INTERLACE)
|
||||
video_monitor_set_refresh_rate(50.0801f);
|
||||
driver_set_refresh_rate(50.0801f);
|
||||
else
|
||||
video_monitor_set_refresh_rate(50.0f);
|
||||
driver_set_refresh_rate(50.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (modetype == VI_NON_INTERLACE)
|
||||
video_monitor_set_refresh_rate(59.8261f);
|
||||
driver_set_refresh_rate(59.8261f);
|
||||
else
|
||||
video_monitor_set_refresh_rate(59.94f);
|
||||
driver_set_refresh_rate(59.94f);
|
||||
}
|
||||
|
||||
/* Don't spam the queue when scrolling through resolutions. */
|
||||
|
@ -15,8 +15,6 @@
|
||||
*/
|
||||
|
||||
#include "video_monitor.h"
|
||||
#include "../audio/audio_monitor.h"
|
||||
#include "../driver.h"
|
||||
#include "../general.h"
|
||||
#include "../retroarch.h"
|
||||
|
||||
@ -33,29 +31,21 @@ void video_monitor_adjust_system_rates(void)
|
||||
|
||||
timing_skew = fabs(1.0f - info->fps / g_settings.video.refresh_rate);
|
||||
|
||||
if (timing_skew > g_settings.audio.max_timing_skew)
|
||||
{
|
||||
/* We don't want to adjust pitch too much. If we have extreme cases,
|
||||
* just don't readjust at all. */
|
||||
RARCH_LOG("Timings deviate too much. Will not adjust. (Display = %.2f Hz, Game = %.2f Hz)\n",
|
||||
g_settings.video.refresh_rate,
|
||||
(float)info->fps);
|
||||
|
||||
/* We won't be able to do VSync reliably as game FPS > monitor FPS. */
|
||||
if (info->fps > g_settings.video.refresh_rate)
|
||||
{
|
||||
g_extern.system.force_nonblock = true;
|
||||
RARCH_LOG("Game FPS > Monitor FPS. Cannot rely on VSync.\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (!driver.video_data)
|
||||
/* We don't want to adjust pitch too much. If we have extreme cases,
|
||||
* just don't readjust at all. */
|
||||
if (timing_skew <= g_settings.audio.max_timing_skew)
|
||||
return;
|
||||
|
||||
if (g_extern.system.force_nonblock)
|
||||
rarch_main_command(RARCH_CMD_VIDEO_SET_NONBLOCKING_STATE);
|
||||
else
|
||||
driver_set_nonblock_state(driver.nonblock_state);
|
||||
RARCH_LOG("Timings deviate too much. Will not adjust. (Display = %.2f Hz, Game = %.2f Hz)\n",
|
||||
g_settings.video.refresh_rate,
|
||||
(float)info->fps);
|
||||
|
||||
/* We won't be able to do VSync reliably when game FPS > monitor FPS. */
|
||||
if (info->fps <= g_settings.video.refresh_rate)
|
||||
return;
|
||||
|
||||
g_extern.system.force_nonblock = true;
|
||||
RARCH_LOG("Game FPS > Monitor FPS. Cannot rely on VSync.\n");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -72,8 +62,6 @@ void video_monitor_set_refresh_rate(float hz)
|
||||
RARCH_LOG("%s\n", msg);
|
||||
|
||||
g_settings.video.refresh_rate = hz;
|
||||
driver_adjust_system_rates();
|
||||
audio_monitor_set_refresh_rate();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include "settings_data.h"
|
||||
#include "dynamic.h"
|
||||
#include <file/file_path.h>
|
||||
#include "gfx/video_monitor.h"
|
||||
#include "input/input_autodetect.h"
|
||||
#include "input/input_common.h"
|
||||
#include "config.def.h"
|
||||
@ -1013,7 +1012,7 @@ static int setting_data_action_ok_video_refresh_rate_auto(
|
||||
if (video_monitor_fps_statistics(&video_refresh_rate,
|
||||
&deviation, &sample_points))
|
||||
{
|
||||
video_monitor_set_refresh_rate(video_refresh_rate);
|
||||
driver_set_refresh_rate(video_refresh_rate);
|
||||
/* Incase refresh rate update forced non-block video. */
|
||||
rarch_main_command(RARCH_CMD_VIDEO_SET_BLOCKING_STATE);
|
||||
}
|
||||
@ -3099,7 +3098,7 @@ static void general_write_handler(void *data)
|
||||
{
|
||||
if (driver.video && driver.video_data)
|
||||
{
|
||||
video_monitor_set_refresh_rate(*setting->value.fraction);
|
||||
driver_set_refresh_rate(*setting->value.fraction);
|
||||
|
||||
/* In case refresh rate update forced non-block video. */
|
||||
rarch_cmd = RARCH_CMD_VIDEO_SET_BLOCKING_STATE;
|
||||
|
Loading…
x
Reference in New Issue
Block a user