From 4a86638ce898e3bd68ade8e7ba794253782ea411 Mon Sep 17 00:00:00 2001 From: kd-11 Date: Mon, 28 Mar 2022 23:57:44 +0300 Subject: [PATCH] rsx: Avoid unnecessary memprotect syscalls --- rpcs3/Emu/RSX/Common/texture_cache.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rpcs3/Emu/RSX/Common/texture_cache.cpp b/rpcs3/Emu/RSX/Common/texture_cache.cpp index 95a396f941..c59c053ffc 100644 --- a/rpcs3/Emu/RSX/Common/texture_cache.cpp +++ b/rpcs3/Emu/RSX/Common/texture_cache.cpp @@ -96,6 +96,9 @@ namespace rsx tex_cache_checker.remove(locked_range, protection); #endif + // Save previous state to compare for changes + const auto prev_confirmed_range = confirmed_range; + if (prot != utils::protection::rw) { if (confirmed_range.valid()) @@ -113,7 +116,7 @@ namespace rsx init_lockable_range(confirmed_range); } - protect(prot, true); + protect(prot, confirmed_range != prev_confirmed_range); } void buffered_section::unprotect()