diff options
| -rw-r--r-- | src/core/memory.cpp | 9 | ||||
| -rw-r--r-- | src/core/memory.h | 1 | ||||
| -rw-r--r-- | src/video_core/memory_manager.cpp | 12 |
3 files changed, 18 insertions, 4 deletions
diff --git a/src/core/memory.cpp b/src/core/memory.cpp index 34ad7cadd..2ac792566 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp | |||
| @@ -551,6 +551,11 @@ struct Memory::Impl { | |||
| 551 | []() {}); | 551 | []() {}); |
| 552 | } | 552 | } |
| 553 | 553 | ||
| 554 | [[nodiscard]] u8* GetPointerSilent(const VAddr vaddr) const { | ||
| 555 | return GetPointerImpl( | ||
| 556 | vaddr, []() {}, []() {}); | ||
| 557 | } | ||
| 558 | |||
| 554 | /** | 559 | /** |
| 555 | * Reads a particular data type out of memory at the given virtual address. | 560 | * Reads a particular data type out of memory at the given virtual address. |
| 556 | * | 561 | * |
| @@ -686,6 +691,10 @@ u8* Memory::GetPointer(VAddr vaddr) { | |||
| 686 | return impl->GetPointer(vaddr); | 691 | return impl->GetPointer(vaddr); |
| 687 | } | 692 | } |
| 688 | 693 | ||
| 694 | u8* Memory::GetPointerSilent(VAddr vaddr) { | ||
| 695 | return impl->GetPointerSilent(vaddr); | ||
| 696 | } | ||
| 697 | |||
| 689 | const u8* Memory::GetPointer(VAddr vaddr) const { | 698 | const u8* Memory::GetPointer(VAddr vaddr) const { |
| 690 | return impl->GetPointer(vaddr); | 699 | return impl->GetPointer(vaddr); |
| 691 | } | 700 | } |
diff --git a/src/core/memory.h b/src/core/memory.h index a11ff8766..81eac448b 100644 --- a/src/core/memory.h +++ b/src/core/memory.h | |||
| @@ -114,6 +114,7 @@ public: | |||
| 114 | * If the address is not valid, nullptr will be returned. | 114 | * If the address is not valid, nullptr will be returned. |
| 115 | */ | 115 | */ |
| 116 | u8* GetPointer(VAddr vaddr); | 116 | u8* GetPointer(VAddr vaddr); |
| 117 | u8* GetPointerSilent(VAddr vaddr); | ||
| 117 | 118 | ||
| 118 | template <typename T> | 119 | template <typename T> |
| 119 | T* GetPointer(VAddr vaddr) { | 120 | T* GetPointer(VAddr vaddr) { |
diff --git a/src/video_core/memory_manager.cpp b/src/video_core/memory_manager.cpp index e1a8b5391..0f97db272 100644 --- a/src/video_core/memory_manager.cpp +++ b/src/video_core/memory_manager.cpp | |||
| @@ -134,11 +134,15 @@ GPUVAddr MemoryManager::BigPageTableOp(GPUVAddr gpu_addr, [[maybe_unused]] VAddr | |||
| 134 | big_page_table_cpu[index] = sub_value; | 134 | big_page_table_cpu[index] = sub_value; |
| 135 | const bool is_continous = ([&] { | 135 | const bool is_continous = ([&] { |
| 136 | uintptr_t base_ptr{ | 136 | uintptr_t base_ptr{ |
| 137 | reinterpret_cast<uintptr_t>(memory.GetPointer(current_cpu_addr))}; | 137 | reinterpret_cast<uintptr_t>(memory.GetPointerSilent(current_cpu_addr))}; |
| 138 | if (base_ptr == 0) { | ||
| 139 | return false; | ||
| 140 | } | ||
| 138 | for (VAddr start_cpu = current_cpu_addr + page_size; | 141 | for (VAddr start_cpu = current_cpu_addr + page_size; |
| 139 | start_cpu < current_cpu_addr + big_page_size; start_cpu += page_size) { | 142 | start_cpu < current_cpu_addr + big_page_size; start_cpu += page_size) { |
| 140 | base_ptr += page_size; | 143 | base_ptr += page_size; |
| 141 | if (base_ptr != reinterpret_cast<uintptr_t>(memory.GetPointer(start_cpu))) { | 144 | auto next_ptr = reinterpret_cast<uintptr_t>(memory.GetPointerSilent(start_cpu)); |
| 145 | if (next_ptr == 0 || base_ptr != next_ptr) { | ||
| 142 | return false; | 146 | return false; |
| 143 | } | 147 | } |
| 144 | } | 148 | } |
| @@ -359,7 +363,7 @@ void MemoryManager::ReadBlockImpl(GPUVAddr gpu_src_addr, void* dest_buffer, | |||
| 359 | if constexpr (is_safe) { | 363 | if constexpr (is_safe) { |
| 360 | rasterizer->FlushRegion(cpu_addr_base, copy_amount); | 364 | rasterizer->FlushRegion(cpu_addr_base, copy_amount); |
| 361 | } | 365 | } |
| 362 | if (!IsBigPageContinous(page_index)) { | 366 | if (!IsBigPageContinous(page_index)) [[unlikely]] { |
| 363 | memory.ReadBlockUnsafe(cpu_addr_base, dest_buffer, copy_amount); | 367 | memory.ReadBlockUnsafe(cpu_addr_base, dest_buffer, copy_amount); |
| 364 | } else { | 368 | } else { |
| 365 | u8* physical = memory.GetPointer(cpu_addr_base); | 369 | u8* physical = memory.GetPointer(cpu_addr_base); |
| @@ -407,7 +411,7 @@ void MemoryManager::WriteBlockImpl(GPUVAddr gpu_dest_addr, const void* src_buffe | |||
| 407 | if constexpr (is_safe) { | 411 | if constexpr (is_safe) { |
| 408 | rasterizer->InvalidateRegion(cpu_addr_base, copy_amount); | 412 | rasterizer->InvalidateRegion(cpu_addr_base, copy_amount); |
| 409 | } | 413 | } |
| 410 | if (!IsBigPageContinous(page_index)) { | 414 | if (!IsBigPageContinous(page_index)) [[unlikely]] { |
| 411 | memory.WriteBlockUnsafe(cpu_addr_base, src_buffer, copy_amount); | 415 | memory.WriteBlockUnsafe(cpu_addr_base, src_buffer, copy_amount); |
| 412 | } else { | 416 | } else { |
| 413 | u8* physical = memory.GetPointer(cpu_addr_base); | 417 | u8* physical = memory.GetPointer(cpu_addr_base); |