diff options
Diffstat (limited to '')
-rw-r--r-- | src/video_core/memory_manager.h | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/src/video_core/memory_manager.h b/src/video_core/memory_manager.h index 2936364f0..4202c26ff 100644 --- a/src/video_core/memory_manager.h +++ b/src/video_core/memory_manager.h @@ -5,12 +5,15 @@ #include <atomic> #include <map> +#include <mutex> #include <optional> #include <vector> +#include <boost/container/small_vector.hpp> #include "common/common_types.h" #include "common/multi_level_page_table.h" #include "common/range_map.h" +#include "common/scratch_buffer.h" #include "common/virtual_buffer.h" #include "video_core/cache_types.h" #include "video_core/pte_kind.h" @@ -94,7 +97,7 @@ public: /** * Checks if a gpu region is mapped by a single range of cpu addresses. */ - [[nodiscard]] bool IsContinousRange(GPUVAddr gpu_addr, std::size_t size) const; + [[nodiscard]] bool IsContinuousRange(GPUVAddr gpu_addr, std::size_t size) const; /** * Checks if a gpu region is mapped entirely. @@ -103,11 +106,11 @@ public: /** * Returns a vector with all the subranges of cpu addresses mapped beneath. - * if the region is continous, a single pair will be returned. If it's unmapped, an empty vector - * will be returned; + * if the region is continuous, a single pair will be returned. If it's unmapped, an empty + * vector will be returned; */ - std::vector<std::pair<GPUVAddr, std::size_t>> GetSubmappedRange(GPUVAddr gpu_addr, - std::size_t size) const; + boost::container::small_vector<std::pair<GPUVAddr, std::size_t>, 32> GetSubmappedRange( + GPUVAddr gpu_addr, std::size_t size) const; GPUVAddr Map(GPUVAddr gpu_addr, VAddr cpu_addr, std::size_t size, PTEKind kind = PTEKind::INVALID, bool is_big_pages = true); @@ -123,7 +126,7 @@ public: bool IsMemoryDirty(GPUVAddr gpu_addr, size_t size, VideoCommon::CacheType which = VideoCommon::CacheType::All) const; - size_t MaxContinousRange(GPUVAddr gpu_addr, size_t size) const; + size_t MaxContinuousRange(GPUVAddr gpu_addr, size_t size) const; bool IsWithinGPUAddressRange(GPUVAddr gpu_addr) const { return gpu_addr < address_space_size; @@ -141,7 +144,7 @@ private: inline void MemoryOperation(GPUVAddr gpu_src_addr, std::size_t size, FuncMapped&& func_mapped, FuncReserved&& func_reserved, FuncUnmapped&& func_unmapped) const; - template <bool is_safe, bool use_fastmem> + template <bool is_safe> void ReadBlockImpl(GPUVAddr gpu_src_addr, void* dest_buffer, std::size_t size, VideoCommon::CacheType which) const; @@ -158,13 +161,14 @@ private: } } - inline bool IsBigPageContinous(size_t big_page_index) const; - inline void SetBigPageContinous(size_t big_page_index, bool value); + inline bool IsBigPageContinuous(size_t big_page_index) const; + inline void SetBigPageContinuous(size_t big_page_index, bool value); template <bool is_gpu_address> void GetSubmappedRangeImpl( GPUVAddr gpu_addr, std::size_t size, - std::vector<std::pair<std::conditional_t<is_gpu_address, GPUVAddr, VAddr>, std::size_t>>& + boost::container::small_vector< + std::pair<std::conditional_t<is_gpu_address, GPUVAddr, VAddr>, std::size_t>, 32>& result) const; Core::System& system; @@ -213,16 +217,20 @@ private: Common::RangeMap<GPUVAddr, PTEKind> kind_map; Common::VirtualBuffer<u32> big_page_table_cpu; - std::vector<u64> big_page_continous; - std::vector<std::pair<VAddr, std::size_t>> page_stash{}; - u8* fastmem_arena{}; + std::vector<u64> big_page_continuous; + boost::container::small_vector<std::pair<VAddr, std::size_t>, 32> page_stash{}; + boost::container::small_vector<std::pair<VAddr, std::size_t>, 32> page_stash2{}; + + mutable std::mutex guard; - constexpr static size_t continous_bits = 64; + static constexpr size_t continuous_bits = 64; const size_t unique_identifier; std::unique_ptr<VideoCommon::InvalidationAccumulator> accumulator; static std::atomic<size_t> unique_identifier_generator; + + Common::ScratchBuffer<u8> tmp_buffer; }; } // namespace Tegra |