summaryrefslogtreecommitdiff
path: root/src/core/memory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/memory.cpp')
-rw-r--r--src/core/memory.cpp41
1 files changed, 1 insertions, 40 deletions
diff --git a/src/core/memory.cpp b/src/core/memory.cpp
index 01ec231f6..74a598852 100644
--- a/src/core/memory.cpp
+++ b/src/core/memory.cpp
@@ -4,7 +4,6 @@
4 4
5#include <array> 5#include <array>
6#include <cstring> 6#include <cstring>
7#include "audio_core/audio_core.h"
8#include "common/assert.h" 7#include "common/assert.h"
9#include "common/common_types.h" 8#include "common/common_types.h"
10#include "common/logging/log.h" 9#include "common/logging/log.h"
@@ -311,7 +310,6 @@ u8* GetPhysicalPointer(PAddr address) {
311 target_pointer = vram.data() + offset_into_region; 310 target_pointer = vram.data() + offset_into_region;
312 break; 311 break;
313 case DSP_RAM_PADDR: 312 case DSP_RAM_PADDR:
314 target_pointer = AudioCore::GetDspMemory().data() + offset_into_region;
315 break; 313 break;
316 case FCRAM_PADDR: 314 case FCRAM_PADDR:
317 for (const auto& region : Kernel::memory_regions) { 315 for (const auto& region : Kernel::memory_regions) {
@@ -413,53 +411,16 @@ void RasterizerMarkRegionCached(PAddr start, u64 size, int count_delta) {
413 } 411 }
414} 412}
415 413
416void RasterizerFlushRegion(PAddr start, u64 size) { 414void RasterizerFlushRegion(PAddr start, u64 size) {}
417 if (VideoCore::g_renderer != nullptr) {
418 VideoCore::g_renderer->Rasterizer()->FlushRegion(start, size);
419 }
420}
421 415
422void RasterizerFlushAndInvalidateRegion(PAddr start, u64 size) { 416void RasterizerFlushAndInvalidateRegion(PAddr start, u64 size) {
423 // Since pages are unmapped on shutdown after video core is shutdown, the renderer may be 417 // Since pages are unmapped on shutdown after video core is shutdown, the renderer may be
424 // null here 418 // null here
425 if (VideoCore::g_renderer != nullptr) {
426 VideoCore::g_renderer->Rasterizer()->FlushAndInvalidateRegion(start, size);
427 }
428} 419}
429 420
430void RasterizerFlushVirtualRegion(VAddr start, u64 size, FlushMode mode) { 421void RasterizerFlushVirtualRegion(VAddr start, u64 size, FlushMode mode) {
431 // Since pages are unmapped on shutdown after video core is shutdown, the renderer may be 422 // Since pages are unmapped on shutdown after video core is shutdown, the renderer may be
432 // null here 423 // null here
433 if (VideoCore::g_renderer != nullptr) {
434 VAddr end = start + size;
435
436 auto CheckRegion = [&](VAddr region_start, VAddr region_end) {
437 if (start >= region_end || end <= region_start) {
438 // No overlap with region
439 return;
440 }
441
442 VAddr overlap_start = std::max(start, region_start);
443 VAddr overlap_end = std::min(end, region_end);
444
445 PAddr physical_start = TryVirtualToPhysicalAddress(overlap_start).value();
446 u32 overlap_size = static_cast<u32>(overlap_end - overlap_start);
447
448 auto* rasterizer = VideoCore::g_renderer->Rasterizer();
449 switch (mode) {
450 case FlushMode::Flush:
451 rasterizer->FlushRegion(physical_start, overlap_size);
452 break;
453 case FlushMode::FlushAndInvalidate:
454 rasterizer->FlushAndInvalidateRegion(physical_start, overlap_size);
455 break;
456 }
457 };
458
459 CheckRegion(LINEAR_HEAP_VADDR, LINEAR_HEAP_VADDR_END);
460 CheckRegion(NEW_LINEAR_HEAP_VADDR, NEW_LINEAR_HEAP_VADDR_END);
461 CheckRegion(VRAM_VADDR, VRAM_VADDR_END);
462 }
463} 424}
464 425
465u8 Read8(const VAddr addr) { 426u8 Read8(const VAddr addr) {