summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2019-02-19 02:58:32 +0100
committerbunnei <bunneidev@gmail.com>2019-03-15 03:34:42 +0100
commit2eaf6c41a4686028c0abc84d1be6fd48a67cf49f (patch)
tree6ad0848c848aea68e637386cad5068e13c831b92 /src/core
parentMerge pull request #2233 from ReinUsesLisp/morton-cleanup (diff)
downloadyuzu-2eaf6c41a4686028c0abc84d1be6fd48a67cf49f.tar
yuzu-2eaf6c41a4686028c0abc84d1be6fd48a67cf49f.tar.gz
yuzu-2eaf6c41a4686028c0abc84d1be6fd48a67cf49f.tar.bz2
yuzu-2eaf6c41a4686028c0abc84d1be6fd48a67cf49f.tar.lz
yuzu-2eaf6c41a4686028c0abc84d1be6fd48a67cf49f.tar.xz
yuzu-2eaf6c41a4686028c0abc84d1be6fd48a67cf49f.tar.zst
yuzu-2eaf6c41a4686028c0abc84d1be6fd48a67cf49f.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp3
-rw-r--r--src/core/memory.cpp13
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 @@
#include "core/core.h"
#include "core/hle/service/nvdrv/devices/nvhost_as_gpu.h"
#include "core/hle/service/nvdrv/devices/nvmap.h"
+#include "core/memory.h"
#include "video_core/memory_manager.h"
#include "video_core/rasterizer_interface.h"
#include "video_core/renderer_base.h"
@@ -178,7 +179,7 @@ u32 nvhost_as_gpu::UnmapBuffer(const std::vector<u8>& input, std::vector<u8>& ou
auto& gpu = system_instance.GPU();
auto cpu_addr = gpu.MemoryManager().GpuToCpuAddress(params.offset);
ASSERT(cpu_addr);
- gpu.FlushAndInvalidateRegion(*cpu_addr, itr->second.size);
+ gpu.FlushAndInvalidateRegion(ToCacheAddr(Memory::GetPointer(*cpu_addr)), itr->second.size);
params.offset = gpu.MemoryManager().UnmapBuffer(params.offset, itr->second.size);
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
LOG_DEBUG(HW_Memory, "Mapping {} onto {:016X}-{:016X}", fmt::ptr(memory), base * PAGE_SIZE,
(base + size) * PAGE_SIZE);
- RasterizerFlushVirtualRegion(base << PAGE_BITS, size * PAGE_SIZE,
- FlushMode::FlushAndInvalidate);
+ // During boot, current_page_table might not be set yet, in which case we need not flush
+ if (current_page_table) {
+ RasterizerFlushVirtualRegion(base << PAGE_BITS, size * PAGE_SIZE,
+ FlushMode::FlushAndInvalidate);
+ }
VAddr end = base + size;
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) {
auto& gpu = system_instance.GPU();
switch (mode) {
case FlushMode::Flush:
- gpu.FlushRegion(overlap_start, overlap_size);
+ gpu.FlushRegion(ToCacheAddr(GetPointer(overlap_start)), overlap_size);
break;
case FlushMode::Invalidate:
- gpu.InvalidateRegion(overlap_start, overlap_size);
+ gpu.InvalidateRegion(ToCacheAddr(GetPointer(overlap_start)), overlap_size);
break;
case FlushMode::FlushAndInvalidate:
- gpu.FlushAndInvalidateRegion(overlap_start, overlap_size);
+ gpu.FlushAndInvalidateRegion(ToCacheAddr(GetPointer(overlap_start)), overlap_size);
break;
}
};