System: Obey optimal frame pacing setting on Linux

This was previously being ignored.
wip3-rebase
Stenzek 2 days ago
parent 24ecfdd94f
commit d01e2ca61f
No known key found for this signature in database

@ -2370,19 +2370,9 @@ void System::Throttle(Timer::Value current_time, Timer::Value sleep_until)
// If we are running the GDB server and have clients, then use it to sleep instead.
// That way in a query->response->query->response chain, we don't process only one message per frame.
if (GDBServer::HasAnyClients())
{
GDBServer::PollUntil(sleep_until);
}
else
{
// Use a spinwait if we undersleep for all platforms except android.. don't want to burn battery.
// Linux also seems to do a much better job of waking up at the requested time.
#ifndef __linux__
Timer::SleepUntil(sleep_until, g_settings.display_optimal_frame_pacing);
#else
Timer::SleepUntil(sleep_until, false);
#endif
}
#if 0
const Timer::Value time_after_sleep = Timer::GetCurrentValue();

@ -79,8 +79,6 @@ static bool LoadOverlaySettings();
static bool LoadOverlayTexture();
static bool LoadOverlayPreset(Error* error, Image* image);
static void SleepUntilPresentTime(u64 present_time);
namespace {
struct Locals
@ -1571,7 +1569,7 @@ bool VideoPresenter::PresentFrame(GPUBackend* backend, u64 present_time)
{
// No explicit present support, simulate it with Flush.
g_gpu_device->FlushCommands();
SleepUntilPresentTime(present_time);
Timer::SleepUntil(present_time, true);
}
g_gpu_device->EndPresent(swap_chain, explicit_present, timed_present ? present_time : 0);
@ -1581,7 +1579,7 @@ bool VideoPresenter::PresentFrame(GPUBackend* backend, u64 present_time)
if (explicit_present)
{
SleepUntilPresentTime(present_time);
Timer::SleepUntil(present_time, true);
g_gpu_device->SubmitPresent(swap_chain);
}
@ -1614,18 +1612,6 @@ bool VideoPresenter::PresentFrame(GPUBackend* backend, u64 present_time)
return true;
}
void VideoPresenter::SleepUntilPresentTime(u64 present_time)
{
// Use a spinwait if we undersleep for all platforms except android.. don't want to burn battery.
// Linux also seems to do a much better job of waking up at the requested time.
#if !defined(__linux__) && !defined(__ANDROID__)
Timer::SleepUntil(present_time, true);
#else
Timer::SleepUntil(present_time, false);
#endif
}
bool VideoPresenter::RenderScreenshotToBuffer(u32 width, u32 height, bool postfx, bool apply_aspect_ratio,
Image* out_image, Error* error)
{

Loading…
Cancel
Save