From b7c2bfbcded84b1a7efd17e8598834bf08df86d9 Mon Sep 17 00:00:00 2001 From: kd-11 Date: Sun, 21 Feb 2021 21:54:13 +0300 Subject: [PATCH] vk: Fix cyclic read-write in dma_block::load/flush Some DMA block entries are stubs whose parents are DMA_block_EXT entries. Performing load() in this case becomes a memcpy(address, same_address_again, length) which wastes performance and introduces bugs. --- rpcs3/Emu/RSX/VK/VKDMA.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/rpcs3/Emu/RSX/VK/VKDMA.cpp b/rpcs3/Emu/RSX/VK/VKDMA.cpp index b0e46d1d39..44893ac31f 100644 --- a/rpcs3/Emu/RSX/VK/VKDMA.cpp +++ b/rpcs3/Emu/RSX/VK/VKDMA.cpp @@ -95,6 +95,13 @@ namespace vk void dma_block::flush(const utils::address_range& range) { + if (inheritance_info.parent) + { + // Parent may be a different type of block + inheritance_info.parent->flush(range); + return; + } + auto src = map_range(range); auto dst = vm::get_super_ptr(range.start); std::memcpy(dst, src, range.length()); @@ -105,6 +112,13 @@ namespace vk void dma_block::load(const utils::address_range& range) { + if (inheritance_info.parent) + { + // Parent may be a different type of block + inheritance_info.parent->load(range); + return; + } + auto src = vm::get_super_ptr(range.start); auto dst = map_range(range); std::memcpy(dst, src, range.length());