diff options
author | Weiyi Wang <wwylele@gmail.com> | 2017-07-22 09:15:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-22 09:15:52 +0200 |
commit | 045d0b5bbdf790952ddfedcfc8816c0afc7a2300 (patch) | |
tree | fba1a440adf7d7ecd59edaf48e215e70b7c6cf9e /src/core/memory.h | |
parent | Merge pull request #2833 from j-selby/single-header-json (diff) | |
parent | Memory: Add function to flush a virtual range from the rasterizer cache (diff) | |
download | yuzu-045d0b5bbdf790952ddfedcfc8816c0afc7a2300.tar yuzu-045d0b5bbdf790952ddfedcfc8816c0afc7a2300.tar.gz yuzu-045d0b5bbdf790952ddfedcfc8816c0afc7a2300.tar.bz2 yuzu-045d0b5bbdf790952ddfedcfc8816c0afc7a2300.tar.lz yuzu-045d0b5bbdf790952ddfedcfc8816c0afc7a2300.tar.xz yuzu-045d0b5bbdf790952ddfedcfc8816c0afc7a2300.tar.zst yuzu-045d0b5bbdf790952ddfedcfc8816c0afc7a2300.zip |
Diffstat (limited to 'src/core/memory.h')
-rw-r--r-- | src/core/memory.h | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/src/core/memory.h b/src/core/memory.h index 71fb278ad..c8c56babd 100644 --- a/src/core/memory.h +++ b/src/core/memory.h @@ -7,6 +7,7 @@ #include <array> #include <cstddef> #include <string> +#include <boost/optional.hpp> #include "common/common_types.h" namespace Memory { @@ -148,15 +149,23 @@ u8* GetPointer(VAddr virtual_address); std::string ReadCString(VAddr virtual_address, std::size_t max_length); /** -* Converts a virtual address inside a region with 1:1 mapping to physical memory to a physical -* address. This should be used by services to translate addresses for use by the hardware. -*/ + * Converts a virtual address inside a region with 1:1 mapping to physical memory to a physical + * address. This should be used by services to translate addresses for use by the hardware. + */ +boost::optional<PAddr> TryVirtualToPhysicalAddress(VAddr addr); + +/** + * Converts a virtual address inside a region with 1:1 mapping to physical memory to a physical + * address. This should be used by services to translate addresses for use by the hardware. + * + * @deprecated Use TryVirtualToPhysicalAddress(), which reports failure. + */ PAddr VirtualToPhysicalAddress(VAddr addr); /** -* Undoes a mapping performed by VirtualToPhysicalAddress(). -*/ -VAddr PhysicalToVirtualAddress(PAddr addr); + * Undoes a mapping performed by VirtualToPhysicalAddress(). + */ +boost::optional<VAddr> PhysicalToVirtualAddress(PAddr addr); /** * Gets a pointer to the memory region beginning at the specified physical address. @@ -181,6 +190,19 @@ void RasterizerFlushRegion(PAddr start, u32 size); */ void RasterizerFlushAndInvalidateRegion(PAddr start, u32 size); +enum class FlushMode { + /// Write back modified surfaces to RAM + Flush, + /// Write back modified surfaces to RAM, and also remove them from the cache + FlushAndInvalidate, +}; + +/** + * Flushes and invalidates any externally cached rasterizer resources touching the given virtual + * address region. + */ +void RasterizerFlushVirtualRegion(VAddr start, u32 size, FlushMode mode); + /** * Dynarmic has an optimization to memory accesses when the pointer to the page exists that * can be used by setting up the current page table as a callback. This function is used to |