rsx: Flush MM queue before applying nv3089 block transfers
Some checks failed
Generate Translation Template / Generate Translation Template (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Has been cancelled
Build RPCS3 / RPCS3 Windows (push) Has been cancelled

This commit is contained in:
kd-11 2025-05-25 20:00:19 +03:00 committed by kd-11
parent 3e674a896f
commit 1ff6bdd777
3 changed files with 37 additions and 0 deletions

View file

@ -90,6 +90,31 @@ namespace rsx
}
}
void mm_flush(const rsx::simple_array<utils::address_range>& ranges)
{
std::lock_guard lock(g_mprotect_queue_lock);
if (g_deferred_mprotect_queue.empty())
{
return;
}
const auto ranges64 = ranges.map([](const auto& r)
{
const u64 start = reinterpret_cast<uintptr_t>(vm::base(r.start));
const u64 end = start + r.length();
return std::make_pair(start, end);
});
for (const auto& block : g_deferred_mprotect_queue)
{
if (ranges64.any(FN(block.overlaps(x.first, x.second))))
{
mm_flush_mprotect_queue_internal();
return;
}
}
}
void mm_flush_lazy()
{
if (!g_cfg.video.multithreaded_rsx)

View file

@ -3,6 +3,9 @@
#include <util/types.hpp>
#include <util/vm.hpp>
#include "Emu/RSX/Common/simple_array.hpp"
#include "Utilities/address_range.h"
namespace rsx
{
struct MM_block
@ -36,5 +39,6 @@ namespace rsx
void mm_protect(void* start, u64 length, utils::protection prot);
void mm_flush_lazy();
void mm_flush(u32 vm_address);
void mm_flush(const rsx::simple_array<utils::address_range>& ranges);
void mm_flush();
}

View file

@ -3,6 +3,7 @@
#include "Emu/RSX/RSXThread.h"
#include "Emu/RSX/Core/RSXReservationLock.hpp"
#include "Emu/RSX/Host/MM.h"
#include "context_accessors.define.h"
@ -57,6 +58,13 @@ namespace rsx
auto res = ::rsx::reservation_lock<true>(write_address, write_length, read_address, read_length);
rsx::simple_array<utils::address_range> flush_mm_ranges =
{
utils::address_range::start_length(write_address, write_length).to_page_range(),
utils::address_range::start_length(read_address, read_length).to_page_range()
};
rsx::mm_flush(flush_mm_ranges);
u8 *dst = vm::_ptr<u8>(write_address);
const u8 *src = vm::_ptr<u8>(read_address);