diff options
author | Mai <mathew1800@gmail.com> | 2022-12-11 22:09:31 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-11 22:09:31 +0100 |
commit | d5684dbe7d7a562a79e267350ef9a45f23dfb817 (patch) | |
tree | b0d46890c04d8eada6e95f7a25a79f89ff8f6beb /src/core | |
parent | Merge pull request #9409 from liamwhite/smaa2 (diff) | |
parent | memory: correct semantics of data cache management operations (diff) | |
download | yuzu-d5684dbe7d7a562a79e267350ef9a45f23dfb817.tar yuzu-d5684dbe7d7a562a79e267350ef9a45f23dfb817.tar.gz yuzu-d5684dbe7d7a562a79e267350ef9a45f23dfb817.tar.bz2 yuzu-d5684dbe7d7a562a79e267350ef9a45f23dfb817.tar.lz yuzu-d5684dbe7d7a562a79e267350ef9a45f23dfb817.tar.xz yuzu-d5684dbe7d7a562a79e267350ef9a45f23dfb817.tar.zst yuzu-d5684dbe7d7a562a79e267350ef9a45f23dfb817.zip |
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/memory.cpp | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/core/memory.cpp b/src/core/memory.cpp index b3f50223b..26be74df4 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp @@ -6,7 +6,6 @@ #include "common/assert.h" #include "common/atomic_ops.h" -#include "common/cache_management.h" #include "common/common_types.h" #include "common/logging/log.h" #include "common/page_table.h" @@ -340,10 +339,9 @@ struct Memory::Impl { LOG_ERROR(HW_Memory, "Unmapped cache maintenance @ {:#018X}", current_vaddr); throw InvalidMemoryException(); }, - [&](const std::size_t block_size, u8* const host_ptr) { cb(block_size, host_ptr); }, + [&](const std::size_t block_size, u8* const host_ptr) {}, [&](const VAddr current_vaddr, const std::size_t block_size, u8* const host_ptr) { - system.GPU().FlushRegion(current_vaddr, block_size); - cb(block_size, host_ptr); + cb(current_vaddr, block_size); }, [](const std::size_t block_size) {}); } catch (InvalidMemoryException&) { @@ -354,27 +352,30 @@ struct Memory::Impl { } Result InvalidateDataCache(const Kernel::KProcess& process, VAddr dest_addr, std::size_t size) { - auto perform = [&](const std::size_t block_size, u8* const host_ptr) { - // Do nothing; this operation (dc ivac) cannot be supported - // from EL0 + auto on_rasterizer = [&](const VAddr current_vaddr, const std::size_t block_size) { + // dc ivac: Invalidate to point of coherency + // GPU flush -> CPU invalidate + system.GPU().FlushRegion(current_vaddr, block_size); }; - return PerformCacheOperation(process, dest_addr, size, perform); + return PerformCacheOperation(process, dest_addr, size, on_rasterizer); } Result StoreDataCache(const Kernel::KProcess& process, VAddr dest_addr, std::size_t size) { - auto perform = [&](const std::size_t block_size, u8* const host_ptr) { + auto on_rasterizer = [&](const VAddr current_vaddr, const std::size_t block_size) { // dc cvac: Store to point of coherency - Common::DataCacheLineCleanByVAToPoC(host_ptr, block_size); + // CPU flush -> GPU invalidate + system.GPU().InvalidateRegion(current_vaddr, block_size); }; - return PerformCacheOperation(process, dest_addr, size, perform); + return PerformCacheOperation(process, dest_addr, size, on_rasterizer); } Result FlushDataCache(const Kernel::KProcess& process, VAddr dest_addr, std::size_t size) { - auto perform = [&](const std::size_t block_size, u8* const host_ptr) { + auto on_rasterizer = [&](const VAddr current_vaddr, const std::size_t block_size) { // dc civac: Store to point of coherency, and invalidate from cache - Common::DataCacheLineCleanAndInvalidateByVAToPoC(host_ptr, block_size); + // CPU flush -> GPU invalidate + system.GPU().InvalidateRegion(current_vaddr, block_size); }; - return PerformCacheOperation(process, dest_addr, size, perform); + return PerformCacheOperation(process, dest_addr, size, on_rasterizer); } void MarkRegionDebug(VAddr vaddr, u64 size, bool debug) { |