summaryrefslogtreecommitdiffstats
path: root/src/video_core/memory_manager.h
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2019-04-22 23:09:00 +0200
committerGitHub <noreply@github.com>2019-04-22 23:09:00 +0200
commit68b707711a521f7987e1abcd1661b4575e3d270d (patch)
treeaf22e59d157b8b7a3e6260ca820aba3613197518 /src/video_core/memory_manager.h
parentMerge pull request #2400 from FernandoS27/corret-kepler-mem (diff)
parentmake ReadBlockunsafe and WriteBlockunsafe, ignore invalid pages. (diff)
downloadyuzu-68b707711a521f7987e1abcd1661b4575e3d270d.tar
yuzu-68b707711a521f7987e1abcd1661b4575e3d270d.tar.gz
yuzu-68b707711a521f7987e1abcd1661b4575e3d270d.tar.bz2
yuzu-68b707711a521f7987e1abcd1661b4575e3d270d.tar.lz
yuzu-68b707711a521f7987e1abcd1661b4575e3d270d.tar.xz
yuzu-68b707711a521f7987e1abcd1661b4575e3d270d.tar.zst
yuzu-68b707711a521f7987e1abcd1661b4575e3d270d.zip
Diffstat (limited to 'src/video_core/memory_manager.h')
-rw-r--r--src/video_core/memory_manager.h29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/video_core/memory_manager.h b/src/video_core/memory_manager.h
index 647cbf93a..e4f0c4bd6 100644
--- a/src/video_core/memory_manager.h
+++ b/src/video_core/memory_manager.h
@@ -65,9 +65,32 @@ public:
u8* GetPointer(GPUVAddr addr);
const u8* GetPointer(GPUVAddr addr) const;
- void ReadBlock(GPUVAddr src_addr, void* dest_buffer, std::size_t size) const;
- void WriteBlock(GPUVAddr dest_addr, const void* src_buffer, std::size_t size);
- void CopyBlock(GPUVAddr dest_addr, GPUVAddr src_addr, std::size_t size);
+ // Returns true if the block is continous in host memory, false otherwise
+ bool IsBlockContinous(const GPUVAddr start, const std::size_t size);
+
+ /**
+ * ReadBlock and WriteBlock are full read and write operations over virtual
+ * GPU Memory. It's important to use these when GPU memory may not be continous
+ * in the Host Memory counterpart. Note: This functions cause Host GPU Memory
+ * Flushes and Invalidations, respectively to each operation.
+ */
+ void ReadBlock(GPUVAddr src_addr, void* dest_buffer, const std::size_t size) const;
+ void WriteBlock(GPUVAddr dest_addr, const void* src_buffer, const std::size_t size);
+ void CopyBlock(GPUVAddr dest_addr, GPUVAddr src_addr, const std::size_t size);
+
+ /**
+ * ReadBlockUnsafe and WriteBlockUnsafe are special versions of ReadBlock and
+ * WriteBlock respectively. In this versions, no flushing or invalidation is actually
+ * done and their performance is similar to a memcpy. This functions can be used
+ * on either of this 2 scenarios instead of their safe counterpart:
+ * - Memory which is sure to never be represented in the Host GPU.
+ * - Memory Managed by a Cache Manager. Example: Texture Flushing should use
+ * WriteBlockUnsafe instead of WriteBlock since it shouldn't invalidate the texture
+ * being flushed.
+ */
+ void ReadBlockUnsafe(GPUVAddr src_addr, void* dest_buffer, const std::size_t size) const;
+ void WriteBlockUnsafe(GPUVAddr dest_addr, const void* src_buffer, const std::size_t size);
+ void CopyBlockUnsafe(GPUVAddr dest_addr, GPUVAddr src_addr, const std::size_t size);
private:
using VMAMap = std::map<GPUVAddr, VirtualMemoryArea>;