From 23430e67724d803184b6a861e4bcb3cac0e38cb0 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Sun, 7 Jan 2024 05:33:43 +0100 Subject: Core: Eliminate core/memory dependancies. --- src/video_core/buffer_cache/buffer_cache.h | 21 ++++++++++----------- src/video_core/buffer_cache/buffer_cache_base.h | 4 ++-- src/video_core/buffer_cache/word_manager.h | 4 ++-- 3 files changed, 14 insertions(+), 15 deletions(-) (limited to 'src/video_core/buffer_cache') diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h index 5325a715a..b4bf369d1 100644 --- a/src/video_core/buffer_cache/buffer_cache.h +++ b/src/video_core/buffer_cache/buffer_cache.h @@ -13,7 +13,7 @@ namespace VideoCommon { -using Core::Memory::YUZU_PAGESIZE; +using Core::DEVICE_PAGESIZE; template BufferCache

::BufferCache(Tegra::MaxwellDeviceMemoryManager& device_memory_, Runtime& runtime_) @@ -120,8 +120,8 @@ void BufferCache

::CachedWriteMemory(DAddr device_addr, u64 size) { if (!is_dirty) { return; } - DAddr aligned_start = Common::AlignDown(device_addr, YUZU_PAGESIZE); - DAddr aligned_end = Common::AlignUp(device_addr + size, YUZU_PAGESIZE); + DAddr aligned_start = Common::AlignDown(device_addr, DEVICE_PAGESIZE); + DAddr aligned_end = Common::AlignUp(device_addr + size, DEVICE_PAGESIZE); if (!IsRegionGpuModified(aligned_start, aligned_end - aligned_start)) { WriteMemory(device_addr, size); return; @@ -151,9 +151,8 @@ std::optional BufferCache

::GetFlushArea(DA u64 size) { std::optional area{}; area.emplace(); - DAddr device_addr_start_aligned = Common::AlignDown(device_addr, Core::Memory::YUZU_PAGESIZE); - DAddr device_addr_end_aligned = - Common::AlignUp(device_addr + size, Core::Memory::YUZU_PAGESIZE); + DAddr device_addr_start_aligned = Common::AlignDown(device_addr, Core::DEVICE_PAGESIZE); + DAddr device_addr_end_aligned = Common::AlignUp(device_addr + size, Core::DEVICE_PAGESIZE); area->start_address = device_addr_start_aligned; area->end_address = device_addr_end_aligned; if (memory_tracker.IsRegionPreflushable(device_addr, size)) { @@ -1354,10 +1353,10 @@ typename BufferCache

::OverlapResult BufferCache

::ResolveOverlaps(DAddr dev int stream_score = 0; bool has_stream_leap = false; auto expand_begin = [&](DAddr add_value) { - static constexpr DAddr min_page = CACHING_PAGESIZE + Core::Memory::YUZU_PAGESIZE; + static constexpr DAddr min_page = CACHING_PAGESIZE + Core::DEVICE_PAGESIZE; if (add_value > begin - min_page) { begin = min_page; - device_addr = Core::Memory::YUZU_PAGESIZE; + device_addr = Core::DEVICE_PAGESIZE; return; } begin -= add_value; @@ -1587,8 +1586,8 @@ bool BufferCache

::InlineMemory(DAddr dest_address, size_t copy_size, if (!is_dirty) { return false; } - DAddr aligned_start = Common::AlignDown(dest_address, YUZU_PAGESIZE); - DAddr aligned_end = Common::AlignUp(dest_address + copy_size, YUZU_PAGESIZE); + DAddr aligned_start = Common::AlignDown(dest_address, DEVICE_PAGESIZE); + DAddr aligned_end = Common::AlignUp(dest_address + copy_size, DEVICE_PAGESIZE); if (!IsRegionGpuModified(aligned_start, aligned_end - aligned_start)) { return false; } @@ -1786,7 +1785,7 @@ Binding BufferCache

::StorageBufferBinding(GPUVAddr ssbo_addr, u32 cbuf_index, ASSERT_MSG(device_addr, "Unaligned storage buffer address not found for cbuf index {}", cbuf_index); // The end address used for size calculation does not need to be aligned - const DAddr cpu_end = Common::AlignUp(*device_addr + size, Core::Memory::YUZU_PAGESIZE); + const DAddr cpu_end = Common::AlignUp(*device_addr + size, Core::DEVICE_PAGESIZE); const Binding binding{ .device_addr = *aligned_device_addr, diff --git a/src/video_core/buffer_cache/buffer_cache_base.h b/src/video_core/buffer_cache/buffer_cache_base.h index 4074003e4..80dbb81e7 100644 --- a/src/video_core/buffer_cache/buffer_cache_base.h +++ b/src/video_core/buffer_cache/buffer_cache_base.h @@ -449,8 +449,8 @@ private: } static bool IsRangeGranular(DAddr device_addr, size_t size) { - return (device_addr & ~Core::Memory::YUZU_PAGEMASK) == - ((device_addr + size) & ~Core::Memory::YUZU_PAGEMASK); + return (device_addr & ~Core::DEVICE_PAGEMASK) == + ((device_addr + size) & ~Core::DEVICE_PAGEMASK); } void RunGarbageCollector(); diff --git a/src/video_core/buffer_cache/word_manager.h b/src/video_core/buffer_cache/word_manager.h index 1ca333b32..3db9d8b42 100644 --- a/src/video_core/buffer_cache/word_manager.h +++ b/src/video_core/buffer_cache/word_manager.h @@ -13,12 +13,12 @@ #include "common/common_funcs.h" #include "common/common_types.h" #include "common/div_ceil.h" -#include "core/memory.h" +#include "video_core/host1x/gpu_device_memory_manager.h" namespace VideoCommon { constexpr u64 PAGES_PER_WORD = 64; -constexpr u64 BYTES_PER_PAGE = Core::Memory::YUZU_PAGESIZE; +constexpr u64 BYTES_PER_PAGE = Core::DEVICE_PAGESIZE; constexpr u64 BYTES_PER_WORD = PAGES_PER_WORD * BYTES_PER_PAGE; enum class Type { -- cgit v1.2.3