rsx: Avoid calling slow functions every draw call

- Use TSC for timing where interval duration matters.
- Use atomic counter for ordering timestamps otherwise.
This commit is contained in:
kd-11 2022-03-06 15:09:28 +03:00 committed by kd-11
parent 762b594927
commit cfecbb24ca
10 changed files with 80 additions and 31 deletions

View file

@ -3,6 +3,7 @@
#include "RSXFIFO.h"
#include "RSXThread.h"
#include "Capture/rsx_capture.h"
#include "Common/time.hpp"
#include "Emu/Cell/lv2/sys_rsx.h"
namespace rsx
@ -395,7 +396,7 @@ namespace rsx
{
if (performance_counters.state == FIFO_state::running)
{
performance_counters.FIFO_idle_timestamp = get_system_time();
performance_counters.FIFO_idle_timestamp = rsx::uclock();
performance_counters.state = FIFO_state::nop;
}
@ -405,7 +406,7 @@ namespace rsx
{
if (performance_counters.state == FIFO_state::running)
{
performance_counters.FIFO_idle_timestamp = get_system_time();
performance_counters.FIFO_idle_timestamp = rsx::uclock();
performance_counters.state = FIFO_state::empty;
}
else
@ -437,7 +438,7 @@ namespace rsx
//Jump to self. Often preceded by NOP
if (performance_counters.state == FIFO_state::running)
{
performance_counters.FIFO_idle_timestamp = get_system_time();
performance_counters.FIFO_idle_timestamp = rsx::uclock();
sync_point_request.release(true);
}
@ -456,7 +457,7 @@ namespace rsx
//Jump to self. Often preceded by NOP
if (performance_counters.state == FIFO_state::running)
{
performance_counters.FIFO_idle_timestamp = get_system_time();
performance_counters.FIFO_idle_timestamp = rsx::uclock();
sync_point_request.release(true);
}
@ -513,7 +514,7 @@ namespace rsx
}
// Update performance counters with time spent in idle mode
performance_counters.idle_time += (get_system_time() - performance_counters.FIFO_idle_timestamp);
performance_counters.idle_time += (rsx::uclock() - performance_counters.FIFO_idle_timestamp);
}
do