diff options
| author | 2024-01-07 05:33:43 +0100 | |
|---|---|---|
| committer | 2024-01-18 21:12:30 -0500 | |
| commit | 23430e67724d803184b6a861e4bcb3cac0e38cb0 (patch) | |
| tree | 5d0b3dfc7175434f66d0dfb32f1d0bfa597013c4 /src/video_core/buffer_cache | |
| parent | SMMU: Fix Right Shift UB. (diff) | |
| download | yuzu-23430e67724d803184b6a861e4bcb3cac0e38cb0.tar.gz yuzu-23430e67724d803184b6a861e4bcb3cac0e38cb0.tar.xz yuzu-23430e67724d803184b6a861e4bcb3cac0e38cb0.zip | |
Core: Eliminate core/memory dependancies.
Diffstat (limited to 'src/video_core/buffer_cache')
| -rw-r--r-- | src/video_core/buffer_cache/buffer_cache.h | 21 | ||||
| -rw-r--r-- | src/video_core/buffer_cache/buffer_cache_base.h | 4 | ||||
| -rw-r--r-- | src/video_core/buffer_cache/word_manager.h | 4 |
3 files changed, 14 insertions, 15 deletions
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 @@ | |||
| 13 | 13 | ||
| 14 | namespace VideoCommon { | 14 | namespace VideoCommon { |
| 15 | 15 | ||
| 16 | using Core::Memory::YUZU_PAGESIZE; | 16 | using Core::DEVICE_PAGESIZE; |
| 17 | 17 | ||
| 18 | template <class P> | 18 | template <class P> |
| 19 | BufferCache<P>::BufferCache(Tegra::MaxwellDeviceMemoryManager& device_memory_, Runtime& runtime_) | 19 | BufferCache<P>::BufferCache(Tegra::MaxwellDeviceMemoryManager& device_memory_, Runtime& runtime_) |
| @@ -120,8 +120,8 @@ void BufferCache<P>::CachedWriteMemory(DAddr device_addr, u64 size) { | |||
| 120 | if (!is_dirty) { | 120 | if (!is_dirty) { |
| 121 | return; | 121 | return; |
| 122 | } | 122 | } |
| 123 | DAddr aligned_start = Common::AlignDown(device_addr, YUZU_PAGESIZE); | 123 | DAddr aligned_start = Common::AlignDown(device_addr, DEVICE_PAGESIZE); |
| 124 | DAddr aligned_end = Common::AlignUp(device_addr + size, YUZU_PAGESIZE); | 124 | DAddr aligned_end = Common::AlignUp(device_addr + size, DEVICE_PAGESIZE); |
| 125 | if (!IsRegionGpuModified(aligned_start, aligned_end - aligned_start)) { | 125 | if (!IsRegionGpuModified(aligned_start, aligned_end - aligned_start)) { |
| 126 | WriteMemory(device_addr, size); | 126 | WriteMemory(device_addr, size); |
| 127 | return; | 127 | return; |
| @@ -151,9 +151,8 @@ std::optional<VideoCore::RasterizerDownloadArea> BufferCache<P>::GetFlushArea(DA | |||
| 151 | u64 size) { | 151 | u64 size) { |
| 152 | std::optional<VideoCore::RasterizerDownloadArea> area{}; | 152 | std::optional<VideoCore::RasterizerDownloadArea> area{}; |
| 153 | area.emplace(); | 153 | area.emplace(); |
| 154 | DAddr device_addr_start_aligned = Common::AlignDown(device_addr, Core::Memory::YUZU_PAGESIZE); | 154 | DAddr device_addr_start_aligned = Common::AlignDown(device_addr, Core::DEVICE_PAGESIZE); |
| 155 | DAddr device_addr_end_aligned = | 155 | DAddr device_addr_end_aligned = Common::AlignUp(device_addr + size, Core::DEVICE_PAGESIZE); |
| 156 | Common::AlignUp(device_addr + size, Core::Memory::YUZU_PAGESIZE); | ||
| 157 | area->start_address = device_addr_start_aligned; | 156 | area->start_address = device_addr_start_aligned; |
| 158 | area->end_address = device_addr_end_aligned; | 157 | area->end_address = device_addr_end_aligned; |
| 159 | if (memory_tracker.IsRegionPreflushable(device_addr, size)) { | 158 | if (memory_tracker.IsRegionPreflushable(device_addr, size)) { |
| @@ -1354,10 +1353,10 @@ typename BufferCache<P>::OverlapResult BufferCache<P>::ResolveOverlaps(DAddr dev | |||
| 1354 | int stream_score = 0; | 1353 | int stream_score = 0; |
| 1355 | bool has_stream_leap = false; | 1354 | bool has_stream_leap = false; |
| 1356 | auto expand_begin = [&](DAddr add_value) { | 1355 | auto expand_begin = [&](DAddr add_value) { |
| 1357 | static constexpr DAddr min_page = CACHING_PAGESIZE + Core::Memory::YUZU_PAGESIZE; | 1356 | static constexpr DAddr min_page = CACHING_PAGESIZE + Core::DEVICE_PAGESIZE; |
| 1358 | if (add_value > begin - min_page) { | 1357 | if (add_value > begin - min_page) { |
| 1359 | begin = min_page; | 1358 | begin = min_page; |
| 1360 | device_addr = Core::Memory::YUZU_PAGESIZE; | 1359 | device_addr = Core::DEVICE_PAGESIZE; |
| 1361 | return; | 1360 | return; |
| 1362 | } | 1361 | } |
| 1363 | begin -= add_value; | 1362 | begin -= add_value; |
| @@ -1587,8 +1586,8 @@ bool BufferCache<P>::InlineMemory(DAddr dest_address, size_t copy_size, | |||
| 1587 | if (!is_dirty) { | 1586 | if (!is_dirty) { |
| 1588 | return false; | 1587 | return false; |
| 1589 | } | 1588 | } |
| 1590 | DAddr aligned_start = Common::AlignDown(dest_address, YUZU_PAGESIZE); | 1589 | DAddr aligned_start = Common::AlignDown(dest_address, DEVICE_PAGESIZE); |
| 1591 | DAddr aligned_end = Common::AlignUp(dest_address + copy_size, YUZU_PAGESIZE); | 1590 | DAddr aligned_end = Common::AlignUp(dest_address + copy_size, DEVICE_PAGESIZE); |
| 1592 | if (!IsRegionGpuModified(aligned_start, aligned_end - aligned_start)) { | 1591 | if (!IsRegionGpuModified(aligned_start, aligned_end - aligned_start)) { |
| 1593 | return false; | 1592 | return false; |
| 1594 | } | 1593 | } |
| @@ -1786,7 +1785,7 @@ Binding BufferCache<P>::StorageBufferBinding(GPUVAddr ssbo_addr, u32 cbuf_index, | |||
| 1786 | ASSERT_MSG(device_addr, "Unaligned storage buffer address not found for cbuf index {}", | 1785 | ASSERT_MSG(device_addr, "Unaligned storage buffer address not found for cbuf index {}", |
| 1787 | cbuf_index); | 1786 | cbuf_index); |
| 1788 | // The end address used for size calculation does not need to be aligned | 1787 | // The end address used for size calculation does not need to be aligned |
| 1789 | const DAddr cpu_end = Common::AlignUp(*device_addr + size, Core::Memory::YUZU_PAGESIZE); | 1788 | const DAddr cpu_end = Common::AlignUp(*device_addr + size, Core::DEVICE_PAGESIZE); |
| 1790 | 1789 | ||
| 1791 | const Binding binding{ | 1790 | const Binding binding{ |
| 1792 | .device_addr = *aligned_device_addr, | 1791 | .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: | |||
| 449 | } | 449 | } |
| 450 | 450 | ||
| 451 | static bool IsRangeGranular(DAddr device_addr, size_t size) { | 451 | static bool IsRangeGranular(DAddr device_addr, size_t size) { |
| 452 | return (device_addr & ~Core::Memory::YUZU_PAGEMASK) == | 452 | return (device_addr & ~Core::DEVICE_PAGEMASK) == |
| 453 | ((device_addr + size) & ~Core::Memory::YUZU_PAGEMASK); | 453 | ((device_addr + size) & ~Core::DEVICE_PAGEMASK); |
| 454 | } | 454 | } |
| 455 | 455 | ||
| 456 | void RunGarbageCollector(); | 456 | 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 @@ | |||
| 13 | #include "common/common_funcs.h" | 13 | #include "common/common_funcs.h" |
| 14 | #include "common/common_types.h" | 14 | #include "common/common_types.h" |
| 15 | #include "common/div_ceil.h" | 15 | #include "common/div_ceil.h" |
| 16 | #include "core/memory.h" | 16 | #include "video_core/host1x/gpu_device_memory_manager.h" |
| 17 | 17 | ||
| 18 | namespace VideoCommon { | 18 | namespace VideoCommon { |
| 19 | 19 | ||
| 20 | constexpr u64 PAGES_PER_WORD = 64; | 20 | constexpr u64 PAGES_PER_WORD = 64; |
| 21 | constexpr u64 BYTES_PER_PAGE = Core::Memory::YUZU_PAGESIZE; | 21 | constexpr u64 BYTES_PER_PAGE = Core::DEVICE_PAGESIZE; |
| 22 | constexpr u64 BYTES_PER_WORD = PAGES_PER_WORD * BYTES_PER_PAGE; | 22 | constexpr u64 BYTES_PER_WORD = PAGES_PER_WORD * BYTES_PER_PAGE; |
| 23 | 23 | ||
| 24 | enum class Type { | 24 | enum class Type { |