vm::spu max address was overflowing resulting in issues, so cast to u64 where needed. Fixes #6145.
    Use vm::get_addr instead of manually substructing vm::base(0) from pointer in texture cache code.
    Prefer std::atomic_thread_fence over _mm_?fence(), adjust usage to be more correct.
    Used sequantially consistent ordering in semaphore_release for TSX path as well.
    Improved memory ordering for sys_rsx_context_iounmap/map.
    Fixed sync bugs in HLE gcm because of not using atomic instructions.
    Use release memory barrier in lwsync for PPU LLVM, according to this xbox360 programming guide lwsync is a hw release memory barrier.
    Also use release barrier where lwsync was originally used in liblv2 sys_lwmutex and cellSync.
    Use acquire barrier for isync instruction, see https://devblogs.microsoft.com/oldnewthing/20180814-00/?p=99485
This commit is contained in:
Eladash 2019-06-29 18:48:42 +03:00 committed by Ivan
parent 1ee7b91646
commit 43f919c04b
20 changed files with 85 additions and 65 deletions

View file

@ -1,4 +1,4 @@
#include "stdafx.h"
#include "stdafx.h"
#include "rsx_methods.h"
#include "RSXThread.h"
#include "Emu/Memory/vm_reservation.h"
@ -10,6 +10,7 @@
#include "Capture/rsx_capture.h"
#include <thread>
#include <atomic>
template <>
void fmt_class_string<frame_limit_type>::format(std::string& out, u64 arg)
@ -66,13 +67,13 @@ namespace rsx
// Get raw BE value
arg = be_t<u32>{arg}.raw();
const auto& sema = vm::_ref<nse_t<u32>>(addr);
const auto& sema = vm::_ref<atomic_t<nse_t<u32>>>(addr);
// TODO: Remove vblank semaphore hack
if (sema == arg || addr == rsx->ctxt_addr + 0x30) return;
if (sema.load() == arg || addr == rsx->ctxt_addr + 0x30) return;
u64 start = get_system_time();
while (sema != arg)
while (sema.load() != arg)
{
if (Emu.IsStopped())
return;
@ -107,7 +108,7 @@ namespace rsx
rsx->performance_counters.idle_time += (get_system_time() - start);
}
void semaphore_release(thread* rsx, u32 _reg, u32 arg)
void semaphore_release(thread* rsx, u32 /*_reg*/, u32 arg)
{
rsx->sync();
rsx->sync_point_request = true;
@ -115,7 +116,7 @@ namespace rsx
if (LIKELY(g_use_rtm))
{
vm::write32(addr, arg);
vm::_ref<atomic_t<u32>>(addr) = arg;
}
else
{