mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-14 18:37:27 +00:00
rsx: Attempt to fix frame limiter
This commit is contained in:
parent
3c88477270
commit
e0df2c584f
@ -3401,21 +3401,11 @@ namespace rsx
|
|||||||
|
|
||||||
if (limit)
|
if (limit)
|
||||||
{
|
{
|
||||||
const u64 time = rsx::uclock() - Emu.GetPauseTime();
|
|
||||||
const u64 needed_us = static_cast<u64>(1000000 / limit);
|
const u64 needed_us = static_cast<u64>(1000000 / limit);
|
||||||
|
const u64 time = std::max<u64>(get_system_time(), target_rsx_flip_time > needed_us ? target_rsx_flip_time - needed_us : 0);
|
||||||
|
|
||||||
if (int_flip_index == 0)
|
if (int_flip_index)
|
||||||
{
|
{
|
||||||
target_rsx_flip_time = time;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
target_rsx_flip_time += needed_us;
|
|
||||||
}
|
|
||||||
while (time >= target_rsx_flip_time + needed_us);
|
|
||||||
|
|
||||||
if (target_rsx_flip_time > time + 1000)
|
if (target_rsx_flip_time > time + 1000)
|
||||||
{
|
{
|
||||||
const auto delay_us = target_rsx_flip_time - time;
|
const auto delay_us = target_rsx_flip_time - time;
|
||||||
@ -3424,6 +3414,7 @@ namespace rsx
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
target_rsx_flip_time = std::max(time, target_rsx_flip_time) + needed_us;
|
||||||
flip_notification_count = 1;
|
flip_notification_count = 1;
|
||||||
}
|
}
|
||||||
else if (frame_limit == frame_limit_type::_ps3)
|
else if (frame_limit == frame_limit_type::_ps3)
|
||||||
|
@ -199,7 +199,13 @@ namespace vk
|
|||||||
VkResult wait_for_event(event* pEvent, u64 timeout)
|
VkResult wait_for_event(event* pEvent, u64 timeout)
|
||||||
{
|
{
|
||||||
// Convert timeout to TSC cycles. Timeout accuracy isn't super-important, only fast response when event is signaled (within 10us if possible)
|
// Convert timeout to TSC cycles. Timeout accuracy isn't super-important, only fast response when event is signaled (within 10us if possible)
|
||||||
timeout *= (utils::get_tsc_freq() / 1'000'000);
|
const u64 freq = utils::get_tsc_freq();
|
||||||
|
|
||||||
|
if (freq)
|
||||||
|
{
|
||||||
|
timeout *= (freq / 1'000'000);
|
||||||
|
}
|
||||||
|
|
||||||
u64 start = 0;
|
u64 start = 0;
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
@ -217,14 +223,15 @@ namespace vk
|
|||||||
|
|
||||||
if (timeout)
|
if (timeout)
|
||||||
{
|
{
|
||||||
|
const auto now = freq ? utils::get_tsc() : get_system_time();
|
||||||
|
|
||||||
if (!start)
|
if (!start)
|
||||||
{
|
{
|
||||||
start = utils::get_tsc();
|
start = now;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (const auto now = utils::get_tsc();
|
if ((now > start) &&
|
||||||
(now > start) &&
|
|
||||||
(now - start) > timeout)
|
(now - start) > timeout)
|
||||||
{
|
{
|
||||||
rsx_log.error("[vulkan] vk::wait_for_event has timed out!");
|
rsx_log.error("[vulkan] vk::wait_for_event has timed out!");
|
||||||
|
Loading…
Reference in New Issue
Block a user