1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 02:32:36 +01:00

Replace rsx::uclock with get_system_time()

This commit is contained in:
elad335 2024-10-29 15:52:39 +02:00 committed by Elad
parent 29c1c3df1f
commit 92bf6ed0a7
10 changed files with 28 additions and 45 deletions

View File

@ -16,7 +16,7 @@ namespace rsx
{
if (enabled) [[unlikely]]
{
last = rsx::uclock();
last = get_system_time();
}
}
@ -28,7 +28,7 @@ namespace rsx
}
auto old = last;
last = rsx::uclock();
last = get_system_time();
return static_cast<s64>(last - old);
}
};

View File

@ -4,20 +4,3 @@
#include <util/sysinfo.hpp>
#include "Emu/Cell/timers.hpp"
namespace rsx
{
static inline u64 uclock()
{
static const ullong s_tsc_scaled_freq = (utils::get_tsc_freq() / 1000000);
if (s_tsc_scaled_freq)
{
return utils::get_tsc() / s_tsc_scaled_freq;
}
else
{
return get_system_time();
}
}
}

View File

@ -44,7 +44,7 @@ namespace rsx
RSX(ctx)->flush_fifo();
}
u64 start = rsx::uclock();
u64 start = get_system_time();
u64 last_check_val = start;
while (sema != arg)
@ -57,7 +57,7 @@ namespace rsx
if (const auto tdr = static_cast<u64>(g_cfg.video.driver_recovery_timeout))
{
const u64 current = rsx::uclock();
const u64 current = get_system_time();
if (current - last_check_val > 20'000)
{
@ -81,7 +81,7 @@ namespace rsx
}
RSX(ctx)->fifo_wake_delay();
RSX(ctx)->performance_counters.idle_time += (rsx::uclock() - start);
RSX(ctx)->performance_counters.idle_time += (get_system_time() - start);
}
void semaphore_release(context* ctx, u32 /*reg*/, u32 arg)

View File

@ -25,11 +25,11 @@ namespace rsx
{
if (m_last_update_timestamp_us == 0)
{
m_last_update_timestamp_us = rsx::uclock();
m_last_update_timestamp_us = get_system_time();
}
else
{
const auto now = rsx::uclock();
const auto now = get_system_time();
m_current_frame_duration_us += (now - m_last_update_timestamp_us);
m_last_update_timestamp_us = now;
}

View File

@ -13,7 +13,7 @@ namespace rsx
return duration;
}
return rsx::uclock() + duration;
return get_system_time() + duration;
}
template <typename T>
@ -168,7 +168,7 @@ namespace rsx
void message::update_queue(std::deque<message_item>& vis_set, std::deque<message_item>& ready_set, message_pin_location origin)
{
const u64 cur_time = rsx::uclock();
const u64 cur_time = get_system_time();
for (auto it = vis_set.begin(); it != vis_set.end();)
{

View File

@ -499,7 +499,7 @@ namespace rsx
}
if (auto rsxthr = rsx::get_current_renderer(); rsxthr &&
(min_refresh_duration_us + rsxthr->last_host_flip_timestamp) < rsx::uclock())
(min_refresh_duration_us + rsxthr->last_host_flip_timestamp) < get_system_time())
{
rsxthr->async_flip_requested |= rsx::thread::flip_request::native_ui;
}

View File

@ -173,10 +173,10 @@ namespace rsx
break;
}
start_time = rsx::uclock();
start_time = get_system_time();
}
auto now = rsx::uclock();
auto now = get_system_time();
if (now - start_time >= 50u)
{
if (m_thread->is_stopped())
@ -186,7 +186,7 @@ namespace rsx
m_thread->cpu_wait({});
const auto then = std::exchange(now, rsx::uclock());
const auto then = std::exchange(now, get_system_time());
start_time = now;
m_thread->performance_counters.idle_time += now - then;
}
@ -623,7 +623,7 @@ namespace rsx
{
if (performance_counters.state == FIFO::state::running)
{
performance_counters.FIFO_idle_timestamp = rsx::uclock();
performance_counters.FIFO_idle_timestamp = get_system_time();
performance_counters.state = FIFO::state::nop;
}
@ -633,7 +633,7 @@ namespace rsx
{
if (performance_counters.state == FIFO::state::running)
{
performance_counters.FIFO_idle_timestamp = rsx::uclock();
performance_counters.FIFO_idle_timestamp = get_system_time();
performance_counters.state = FIFO::state::empty;
}
else
@ -668,7 +668,7 @@ namespace rsx
//Jump to self. Often preceded by NOP
if (performance_counters.state == FIFO::state::running)
{
performance_counters.FIFO_idle_timestamp = rsx::uclock();
performance_counters.FIFO_idle_timestamp = get_system_time();
sync_point_request.release(true);
}
@ -749,7 +749,7 @@ namespace rsx
}
// Update performance counters with time spent in idle mode
performance_counters.idle_time += (rsx::uclock() - performance_counters.FIFO_idle_timestamp);
performance_counters.idle_time += (get_system_time() - performance_counters.FIFO_idle_timestamp);
}
do

View File

@ -1024,7 +1024,7 @@ namespace rsx
fifo_ctrl = std::make_unique<::rsx::FIFO::FIFO_control>(this);
fifo_ctrl->set_get(ctrl->get);
last_guest_flip_timestamp = rsx::uclock() - 1000000;
last_guest_flip_timestamp = get_system_time() - 1000000;
vblank_count = 0;
@ -1104,7 +1104,7 @@ namespace rsx
if (Emu.IsPaused())
{
// Save the difference before pause
start_time = rsx::uclock() - start_time;
start_time = get_system_time() - start_time;
while (Emu.IsPaused() && !is_stopped())
{
@ -1112,7 +1112,7 @@ namespace rsx
}
// Restore difference
start_time = rsx::uclock() - start_time;
start_time = get_system_time() - start_time;
}
}
})));
@ -3057,7 +3057,7 @@ namespace rsx
}
}
last_host_flip_timestamp = rsx::uclock();
last_host_flip_timestamp = get_system_time();
}
void thread::check_zcull_status(bool framebuffer_swap)
@ -3299,7 +3299,7 @@ namespace rsx
{
bool kill_itself = g_cfg.core.rsx_fifo_accuracy == rsx_fifo_mode::as_ps3;
const u64 current_time = rsx::uclock();
const u64 current_time = get_system_time();
if (recovered_fifo_cmds_history.size() == 20u)
{
@ -3381,7 +3381,7 @@ namespace rsx
// Some cases do not need full delay
remaining = utils::aligned_div(remaining, div);
const u64 until = rsx::uclock() + remaining;
const u64 until = get_system_time() + remaining;
while (true)
{
@ -3412,7 +3412,7 @@ namespace rsx
busy_wait(100);
}
const u64 current = rsx::uclock();
const u64 current = get_system_time();
if (current >= until)
{
@ -3654,7 +3654,7 @@ namespace rsx
//Average load over around 30 frames
if (!performance_counters.last_update_timestamp || performance_counters.sampled_frames > 30)
{
const auto timestamp = rsx::uclock();
const auto timestamp = get_system_time();
const auto idle = performance_counters.idle_time.load();
const auto elapsed = timestamp - performance_counters.last_update_timestamp;
@ -3938,7 +3938,7 @@ namespace rsx
flip(m_queued_flip);
last_guest_flip_timestamp = rsx::uclock() - 1000000;
last_guest_flip_timestamp = get_system_time() - 1000000;
flip_status = CELL_GCM_DISPLAY_FLIP_STATUS_DONE;
m_queued_flip.in_progress = false;

View File

@ -542,7 +542,7 @@ namespace rsx
}
}
if (m_tsc = rsx::uclock(); m_tsc < m_next_tsc)
if (m_tsc = get_system_time(); m_tsc < m_next_tsc)
{
return;
}

View File

@ -1892,7 +1892,7 @@ void VKGSRender::sync_hint(rsx::FIFO::interrupt_hint hint, rsx::reports::sync_hi
// OK, cell will be accessing the results, probably.
// Try to avoid flush spam, it is more costly to flush the CB than it is to just upload the vertex data
// This is supposed to be an optimization afterall.
const auto now = rsx::uclock();
const auto now = get_system_time();
if ((now - m_last_cond_render_eval_hint) > 50)
{
// Schedule a sync on the next loop iteration