Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rsx: Implement atomic vertex upload (with Strict Rendering Mode) #12591

Merged
merged 3 commits into from Sep 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion rpcs3/Emu/Cell/SPURecompiler.cpp
Expand Up @@ -6563,7 +6563,7 @@ class spu_llvm_recompiler : public spu_recompiler_base, public cpu_translator
break;
}

if (u64 cmdh = ci->getZExtValue() & ~(MFC_BARRIER_MASK | MFC_FENCE_MASK | MFC_RESULT_MASK); g_cfg.core.rsx_fifo_accuracy || !g_use_rtm)
if (u64 cmdh = ci->getZExtValue() & ~(MFC_BARRIER_MASK | MFC_FENCE_MASK | MFC_RESULT_MASK); g_cfg.core.rsx_fifo_accuracy || g_cfg.video.strict_rendering_mode || !g_use_rtm)
{
// TODO: don't require TSX (current implementation is TSX-only)
if (cmdh == MFC_PUT_CMD || cmdh == MFC_SNDSIG_CMD)
Expand Down
6 changes: 5 additions & 1 deletion rpcs3/Emu/Cell/SPUThread.cpp
Expand Up @@ -2063,7 +2063,7 @@ void spu_thread::do_dma_transfer(spu_thread* _this, const spu_mfc_cmd& args, u8*
src = zero_buf;
}

rsx::reservation_lock<false, 1> rsx_lock(eal, args.size, !is_get && g_cfg.core.rsx_fifo_accuracy && !g_cfg.core.spu_accurate_dma);
rsx::reservation_lock<false, 1> rsx_lock(eal, args.size, !is_get && (g_cfg.video.strict_rendering_mode || (g_cfg.core.rsx_fifo_accuracy && !g_cfg.core.spu_accurate_dma && eal < rsx::constants::local_mem_base)));

if ((!g_use_rtm && !is_get) || g_cfg.core.spu_accurate_dma) [[unlikely]]
{
Expand Down Expand Up @@ -4458,7 +4458,9 @@ bool spu_thread::set_ch_value(u32 ch, u32 value)

if (res == CELL_EAGAIN)
{
// Restore mailboxes state
ch_out_mbox.set_value(data);
ch_in_mbox.try_pop(data);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This to me looks like it needs some testing. Any ideas on what games could be affected by this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EAGAIN is a fake error code for savestates here, it means the syscall ia aborted because it cannot be completed because the thread-to-be-signalled has aborted execution in savestates.

return false;
}

Expand Down Expand Up @@ -4529,7 +4531,9 @@ bool spu_thread::set_ch_value(u32 ch, u32 value)

if (res == CELL_EAGAIN)
{
// Restore mailboxes state
ch_out_mbox.set_value(data);
ch_in_mbox.try_pop(data);
return false;
}

Expand Down
5 changes: 5 additions & 0 deletions rpcs3/Emu/RSX/RSXOffload.cpp
@@ -1,5 +1,6 @@
#include "stdafx.h"

#include "Emu/Memory/vm.h"
#include "Common/BufferUtils.h"
#include "RSXOffload.h"
#include "RSXThread.h"
Expand Down Expand Up @@ -44,6 +45,8 @@ namespace rsx
{
case raw_copy:
{
const u32 vm_addr = vm::try_get_addr(job.src).first;
rsx::reservation_lock<true, 1> rsx_lock(vm_addr, job.length, g_cfg.video.strict_rendering_mode && vm_addr);
std::memcpy(job.dst, job.src, job.length);
break;
}
Expand Down Expand Up @@ -108,6 +111,8 @@ namespace rsx
{
if (length <= max_immediate_transfer_size || !g_cfg.video.multithreaded_rsx)
{
const u32 vm_addr = vm::try_get_addr(src).first;
rsx::reservation_lock<true, 1> rsx_lock(vm_addr, length, g_cfg.video.strict_rendering_mode && vm_addr);
std::memcpy(dst, src, length);
}
else
Expand Down
2 changes: 1 addition & 1 deletion rpcs3/Emu/RSX/RSXThread.cpp
Expand Up @@ -814,7 +814,7 @@ namespace rsx
u64 local_vblank_count = 0;

// TODO: exit condition
while (!is_stopped() && !unsent_gcm_events)
while (!is_stopped() && !unsent_gcm_events && thread_ctrl::state() != thread_state::aborting)
{
// Get current time
const u64 current = get_system_time();
Expand Down
2 changes: 1 addition & 1 deletion rpcs3/Emu/RSX/RSXThread.h
Expand Up @@ -879,7 +879,7 @@ namespace rsx

reservation_lock(u32 addr, u32 length, bool setting)
{
if (setting && addr < constants::local_mem_base)
if (setting)
kd-11 marked this conversation as resolved.
Show resolved Hide resolved
{
lock_range(addr, length);
}
Expand Down