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

rsx: Fix compiler warnings

This commit is contained in:
kd-11 2022-09-27 20:34:11 +03:00 committed by kd-11
parent de28c812e8
commit 5281a85b67
4 changed files with 32 additions and 31 deletions

View File

@ -109,10 +109,12 @@ namespace rsx
_capacity = size;
}
void resize(u32 size)
template <typename T> requires UnsignedInt<T>
void resize(T size)
{
reserve(size);
_size = size;
const auto new_size = static_cast<u32>(size);
reserve(new_size);
_size = new_size;
}
void push_back(const Ty& val)

View File

@ -3523,7 +3523,7 @@ namespace rsx
const usz avg_frame_time = diffs / 59;
u32 lowered_delay = 0;
u32 highered_delay = 0;
u32 raised_delay = 0;
bool can_reevaluate = true;
u64 prev_preempt_count = umax;
@ -3543,7 +3543,7 @@ namespace rsx
}
else if (prev_preempt_count < frame_times[i].preempt_count)
{
highered_delay++;
raised_delay++;
}
if (i > frame_times.size() - 30)
@ -3556,7 +3556,7 @@ namespace rsx
prev_preempt_count = frame_times[i].preempt_count;
}
preempt_count = std::min<u32>(frame_times.back().preempt_count, max_preempt_count);
preempt_count = std::min<u64>(frame_times.back().preempt_count, max_preempt_count);
u32 fails = 0;
u32 hard_fails = 0;
@ -3576,7 +3576,7 @@ namespace rsx
{
if (diff_of_diff >= avg_frame_time / 3)
{
highered_delay++;
raised_delay++;
hard_fails++;
if (i == frame_times.size())
@ -3632,7 +3632,7 @@ namespace rsx
}
else
{
preempt_count = std::min<u32>(preempt_count + 4, max_preempt_count);
preempt_count = std::min<u64>(preempt_count + 4, max_preempt_count);
}
}
else
@ -3641,26 +3641,26 @@ namespace rsx
}
}
// Sudden FPS drop detection
else if ((fails > 13 || hard_fails > 2 || !(abs_dst(fps_10, 300) < 20 || abs_dst(fps_10, 600) < 30 || abs_dst(fps_10, g_cfg.video.vblank_rate * 10) < 30 || abs_dst(fps_10, g_cfg.video.vblank_rate * 10 / 2) < 20)) && lowered_delay < highered_delay && is_last_frame_a_fail)
else if ((fails > 13 || hard_fails > 2 || !(abs_dst(fps_10, 300) < 20 || abs_dst(fps_10, 600) < 30 || abs_dst(fps_10, g_cfg.video.vblank_rate * 10) < 30 || abs_dst(fps_10, g_cfg.video.vblank_rate * 10 / 2) < 20)) && lowered_delay < raised_delay && is_last_frame_a_fail)
{
lower_preemption_count();
}
perf_log.trace("CPU preemption control: reeval=%d, preempt_count=%d, fails=%d, hard=%d, avg_frame_time=%d, highered=%d, lowered=%d, taken=%u", can_reevaluate, preempt_count, fails, hard_fails, avg_frame_time, highered_delay, lowered_delay, ::g_lv2_preempts_taken.load());
perf_log.trace("CPU preemption control: reeval=%d, preempt_count=%llu, fails=%u, hard=%u, avg_frame_time=%llu, highered=%u, lowered=%u, taken=%u", can_reevaluate, preempt_count, fails, hard_fails, avg_frame_time, raised_delay, lowered_delay, ::g_lv2_preempts_taken.load());
if (hard_measures_taken)
{
preempt_fail_old_preempt_count = std::max<u32>(preempt_fail_old_preempt_count, std::min<u32>(frame_times.back().preempt_count, max_preempt_count));
preempt_fail_old_preempt_count = std::max<u64>(preempt_fail_old_preempt_count, std::min<u64>(frame_times.back().preempt_count, max_preempt_count));
}
else if (preempt_fail_old_preempt_count)
{
perf_log.error("Lowering current preemption count significantly due to a performance drop, if this issue persists frequently consider lowering max preemptions count to 'new-count' or lower. (old-count=%d, new-count=%d)", preempt_fail_old_preempt_count, preempt_count);
perf_log.error("Lowering current preemption count significantly due to a performance drop, if this issue persists frequently consider lowering max preemptions count to 'new-count' or lower. (old-count=%llu, new-count=%llu)", preempt_fail_old_preempt_count, preempt_count);
preempt_fail_old_preempt_count = 0;
}
const u64 tsc_diff = (current_tsc - frame_times.back().tsc);
const u64 time_diff = (current_time - frame_times.back().timestamp);
const u64 preempt_diff = tsc_diff * (1'000'000 / 30) / (time_diff * std::max<u32>(preempt_count, 1));
const u64 preempt_diff = tsc_diff * (1'000'000 / 30) / (time_diff * std::max<u64>(preempt_count, 1ull));
if (!preempt_count)
{

View File

@ -467,6 +467,19 @@ namespace rsx
struct sampled_image_descriptor_base;
struct desync_fifo_cmd_info
{
u32 cmd;
u64 timestamp;
};
struct frame_time_t
{
u64 preempt_count;
u64 timestamp;
u64 tsc;
};
class thread : public cpu_thread
{
u64 timestamp_ctrl = 0;
@ -681,24 +694,10 @@ namespace rsx
atomic_t<bool> sync_point_request = false;
bool in_begin_end = false;
struct desync_fifo_cmd_info
{
u32 cmd;
u64 timestamp;
};
std::queue<desync_fifo_cmd_info> recovered_fifo_cmds_history;
struct frame_time_t
{
u64 preempt_count;
u64 timestamp;
u64 tsc;
};
std::deque<frame_time_t> frame_times;
u32 prevent_preempt_increase_tickets = 0;
u32 preempt_fail_old_preempt_count = 0;
u64 preempt_fail_old_preempt_count = 0;
atomic_t<s32> async_tasks_pending{ 0 };

View File

@ -507,7 +507,7 @@ namespace rsx
if (fifo_span.size() < rcount)
{
rcount = fifo_span.size();
rcount = ::size32(fifo_span);
}
if (rsx->m_graphics_state & rsx::pipeline_state::transform_constants_dirty)
@ -560,7 +560,7 @@ namespace rsx
if (fifo_span.size() < rcount)
{
rcount = fifo_span.size();
rcount = ::size32(fifo_span);
}
copy_data_swap_u32(&rsx::method_registers.transform_program[load_pos * 4 + index % 4], fifo_span.data(), rcount);
@ -1030,7 +1030,7 @@ namespace rsx
if (fifo_span.size() < count)
{
count = fifo_span.size();
count = ::size32(fifo_span);
}
// Skip "handled methods"