mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-30 21:32:50 +00:00
Replace rsx::uclock with get_system_time()
This commit is contained in:
parent
29c1c3df1f
commit
92bf6ed0a7
@ -16,7 +16,7 @@ namespace rsx
|
|||||||
{
|
{
|
||||||
if (enabled) [[unlikely]]
|
if (enabled) [[unlikely]]
|
||||||
{
|
{
|
||||||
last = rsx::uclock();
|
last = get_system_time();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ namespace rsx
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto old = last;
|
auto old = last;
|
||||||
last = rsx::uclock();
|
last = get_system_time();
|
||||||
return static_cast<s64>(last - old);
|
return static_cast<s64>(last - old);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -4,20 +4,3 @@
|
|||||||
#include <util/sysinfo.hpp>
|
#include <util/sysinfo.hpp>
|
||||||
|
|
||||||
#include "Emu/Cell/timers.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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -44,7 +44,7 @@ namespace rsx
|
|||||||
RSX(ctx)->flush_fifo();
|
RSX(ctx)->flush_fifo();
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 start = rsx::uclock();
|
u64 start = get_system_time();
|
||||||
u64 last_check_val = start;
|
u64 last_check_val = start;
|
||||||
|
|
||||||
while (sema != arg)
|
while (sema != arg)
|
||||||
@ -57,7 +57,7 @@ namespace rsx
|
|||||||
|
|
||||||
if (const auto tdr = static_cast<u64>(g_cfg.video.driver_recovery_timeout))
|
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)
|
if (current - last_check_val > 20'000)
|
||||||
{
|
{
|
||||||
@ -81,7 +81,7 @@ namespace rsx
|
|||||||
}
|
}
|
||||||
|
|
||||||
RSX(ctx)->fifo_wake_delay();
|
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)
|
void semaphore_release(context* ctx, u32 /*reg*/, u32 arg)
|
||||||
|
@ -25,11 +25,11 @@ namespace rsx
|
|||||||
{
|
{
|
||||||
if (m_last_update_timestamp_us == 0)
|
if (m_last_update_timestamp_us == 0)
|
||||||
{
|
{
|
||||||
m_last_update_timestamp_us = rsx::uclock();
|
m_last_update_timestamp_us = get_system_time();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const auto now = rsx::uclock();
|
const auto now = get_system_time();
|
||||||
m_current_frame_duration_us += (now - m_last_update_timestamp_us);
|
m_current_frame_duration_us += (now - m_last_update_timestamp_us);
|
||||||
m_last_update_timestamp_us = now;
|
m_last_update_timestamp_us = now;
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ namespace rsx
|
|||||||
return duration;
|
return duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
return rsx::uclock() + duration;
|
return get_system_time() + duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
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)
|
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();)
|
for (auto it = vis_set.begin(); it != vis_set.end();)
|
||||||
{
|
{
|
||||||
|
@ -499,7 +499,7 @@ namespace rsx
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (auto rsxthr = rsx::get_current_renderer(); rsxthr &&
|
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;
|
rsxthr->async_flip_requested |= rsx::thread::flip_request::native_ui;
|
||||||
}
|
}
|
||||||
|
@ -173,10 +173,10 @@ namespace rsx
|
|||||||
break;
|
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 (now - start_time >= 50u)
|
||||||
{
|
{
|
||||||
if (m_thread->is_stopped())
|
if (m_thread->is_stopped())
|
||||||
@ -186,7 +186,7 @@ namespace rsx
|
|||||||
|
|
||||||
m_thread->cpu_wait({});
|
m_thread->cpu_wait({});
|
||||||
|
|
||||||
const auto then = std::exchange(now, rsx::uclock());
|
const auto then = std::exchange(now, get_system_time());
|
||||||
start_time = now;
|
start_time = now;
|
||||||
m_thread->performance_counters.idle_time += now - then;
|
m_thread->performance_counters.idle_time += now - then;
|
||||||
}
|
}
|
||||||
@ -623,7 +623,7 @@ namespace rsx
|
|||||||
{
|
{
|
||||||
if (performance_counters.state == FIFO::state::running)
|
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;
|
performance_counters.state = FIFO::state::nop;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -633,7 +633,7 @@ namespace rsx
|
|||||||
{
|
{
|
||||||
if (performance_counters.state == FIFO::state::running)
|
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;
|
performance_counters.state = FIFO::state::empty;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -668,7 +668,7 @@ namespace rsx
|
|||||||
//Jump to self. Often preceded by NOP
|
//Jump to self. Often preceded by NOP
|
||||||
if (performance_counters.state == FIFO::state::running)
|
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);
|
sync_point_request.release(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -749,7 +749,7 @@ namespace rsx
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update performance counters with time spent in idle mode
|
// 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
|
do
|
||||||
|
@ -1024,7 +1024,7 @@ namespace rsx
|
|||||||
fifo_ctrl = std::make_unique<::rsx::FIFO::FIFO_control>(this);
|
fifo_ctrl = std::make_unique<::rsx::FIFO::FIFO_control>(this);
|
||||||
fifo_ctrl->set_get(ctrl->get);
|
fifo_ctrl->set_get(ctrl->get);
|
||||||
|
|
||||||
last_guest_flip_timestamp = rsx::uclock() - 1000000;
|
last_guest_flip_timestamp = get_system_time() - 1000000;
|
||||||
|
|
||||||
vblank_count = 0;
|
vblank_count = 0;
|
||||||
|
|
||||||
@ -1104,7 +1104,7 @@ namespace rsx
|
|||||||
if (Emu.IsPaused())
|
if (Emu.IsPaused())
|
||||||
{
|
{
|
||||||
// Save the difference before pause
|
// Save the difference before pause
|
||||||
start_time = rsx::uclock() - start_time;
|
start_time = get_system_time() - start_time;
|
||||||
|
|
||||||
while (Emu.IsPaused() && !is_stopped())
|
while (Emu.IsPaused() && !is_stopped())
|
||||||
{
|
{
|
||||||
@ -1112,7 +1112,7 @@ namespace rsx
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Restore difference
|
// 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)
|
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;
|
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)
|
if (recovered_fifo_cmds_history.size() == 20u)
|
||||||
{
|
{
|
||||||
@ -3381,7 +3381,7 @@ namespace rsx
|
|||||||
|
|
||||||
// Some cases do not need full delay
|
// Some cases do not need full delay
|
||||||
remaining = utils::aligned_div(remaining, div);
|
remaining = utils::aligned_div(remaining, div);
|
||||||
const u64 until = rsx::uclock() + remaining;
|
const u64 until = get_system_time() + remaining;
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
@ -3412,7 +3412,7 @@ namespace rsx
|
|||||||
busy_wait(100);
|
busy_wait(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
const u64 current = rsx::uclock();
|
const u64 current = get_system_time();
|
||||||
|
|
||||||
if (current >= until)
|
if (current >= until)
|
||||||
{
|
{
|
||||||
@ -3654,7 +3654,7 @@ namespace rsx
|
|||||||
//Average load over around 30 frames
|
//Average load over around 30 frames
|
||||||
if (!performance_counters.last_update_timestamp || performance_counters.sampled_frames > 30)
|
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 idle = performance_counters.idle_time.load();
|
||||||
const auto elapsed = timestamp - performance_counters.last_update_timestamp;
|
const auto elapsed = timestamp - performance_counters.last_update_timestamp;
|
||||||
|
|
||||||
@ -3938,7 +3938,7 @@ namespace rsx
|
|||||||
|
|
||||||
flip(m_queued_flip);
|
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;
|
flip_status = CELL_GCM_DISPLAY_FLIP_STATUS_DONE;
|
||||||
m_queued_flip.in_progress = false;
|
m_queued_flip.in_progress = false;
|
||||||
|
|
||||||
|
@ -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;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -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.
|
// 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
|
// 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.
|
// 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)
|
if ((now - m_last_cond_render_eval_hint) > 50)
|
||||||
{
|
{
|
||||||
// Schedule a sync on the next loop iteration
|
// Schedule a sync on the next loop iteration
|
||||||
|
Loading…
x
Reference in New Issue
Block a user