diff options
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp | 3 | ||||
| -rw-r--r-- | src/core/memory.cpp | 13 |
2 files changed, 10 insertions, 6 deletions
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp index a34b9e753..b031ebc66 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | #include "core/core.h" | 10 | #include "core/core.h" |
| 11 | #include "core/hle/service/nvdrv/devices/nvhost_as_gpu.h" | 11 | #include "core/hle/service/nvdrv/devices/nvhost_as_gpu.h" |
| 12 | #include "core/hle/service/nvdrv/devices/nvmap.h" | 12 | #include "core/hle/service/nvdrv/devices/nvmap.h" |
| 13 | #include "core/memory.h" | ||
| 13 | #include "video_core/memory_manager.h" | 14 | #include "video_core/memory_manager.h" |
| 14 | #include "video_core/rasterizer_interface.h" | 15 | #include "video_core/rasterizer_interface.h" |
| 15 | #include "video_core/renderer_base.h" | 16 | #include "video_core/renderer_base.h" |
| @@ -178,7 +179,7 @@ u32 nvhost_as_gpu::UnmapBuffer(const std::vector<u8>& input, std::vector<u8>& ou | |||
| 178 | auto& gpu = system_instance.GPU(); | 179 | auto& gpu = system_instance.GPU(); |
| 179 | auto cpu_addr = gpu.MemoryManager().GpuToCpuAddress(params.offset); | 180 | auto cpu_addr = gpu.MemoryManager().GpuToCpuAddress(params.offset); |
| 180 | ASSERT(cpu_addr); | 181 | ASSERT(cpu_addr); |
| 181 | gpu.FlushAndInvalidateRegion(*cpu_addr, itr->second.size); | 182 | gpu.FlushAndInvalidateRegion(ToCacheAddr(Memory::GetPointer(*cpu_addr)), itr->second.size); |
| 182 | 183 | ||
| 183 | params.offset = gpu.MemoryManager().UnmapBuffer(params.offset, itr->second.size); | 184 | params.offset = gpu.MemoryManager().UnmapBuffer(params.offset, itr->second.size); |
| 184 | 185 | ||
diff --git a/src/core/memory.cpp b/src/core/memory.cpp index 6591c45d2..4fde53033 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp | |||
| @@ -67,8 +67,11 @@ static void MapPages(PageTable& page_table, VAddr base, u64 size, u8* memory, Pa | |||
| 67 | LOG_DEBUG(HW_Memory, "Mapping {} onto {:016X}-{:016X}", fmt::ptr(memory), base * PAGE_SIZE, | 67 | LOG_DEBUG(HW_Memory, "Mapping {} onto {:016X}-{:016X}", fmt::ptr(memory), base * PAGE_SIZE, |
| 68 | (base + size) * PAGE_SIZE); | 68 | (base + size) * PAGE_SIZE); |
| 69 | 69 | ||
| 70 | RasterizerFlushVirtualRegion(base << PAGE_BITS, size * PAGE_SIZE, | 70 | // During boot, current_page_table might not be set yet, in which case we need not flush |
| 71 | FlushMode::FlushAndInvalidate); | 71 | if (current_page_table) { |
| 72 | RasterizerFlushVirtualRegion(base << PAGE_BITS, size * PAGE_SIZE, | ||
| 73 | FlushMode::FlushAndInvalidate); | ||
| 74 | } | ||
| 72 | 75 | ||
| 73 | VAddr end = base + size; | 76 | VAddr end = base + size; |
| 74 | ASSERT_MSG(end <= page_table.pointers.size(), "out of range mapping at {:016X}", | 77 | ASSERT_MSG(end <= page_table.pointers.size(), "out of range mapping at {:016X}", |
| @@ -359,13 +362,13 @@ void RasterizerFlushVirtualRegion(VAddr start, u64 size, FlushMode mode) { | |||
| 359 | auto& gpu = system_instance.GPU(); | 362 | auto& gpu = system_instance.GPU(); |
| 360 | switch (mode) { | 363 | switch (mode) { |
| 361 | case FlushMode::Flush: | 364 | case FlushMode::Flush: |
| 362 | gpu.FlushRegion(overlap_start, overlap_size); | 365 | gpu.FlushRegion(ToCacheAddr(GetPointer(overlap_start)), overlap_size); |
| 363 | break; | 366 | break; |
| 364 | case FlushMode::Invalidate: | 367 | case FlushMode::Invalidate: |
| 365 | gpu.InvalidateRegion(overlap_start, overlap_size); | 368 | gpu.InvalidateRegion(ToCacheAddr(GetPointer(overlap_start)), overlap_size); |
| 366 | break; | 369 | break; |
| 367 | case FlushMode::FlushAndInvalidate: | 370 | case FlushMode::FlushAndInvalidate: |
| 368 | gpu.FlushAndInvalidateRegion(overlap_start, overlap_size); | 371 | gpu.FlushAndInvalidateRegion(ToCacheAddr(GetPointer(overlap_start)), overlap_size); |
| 369 | break; | 372 | break; |
| 370 | } | 373 | } |
| 371 | }; | 374 | }; |