From 393f2418c5bf0ddb40c48ef86cab642e06b502c2 Mon Sep 17 00:00:00 2001 From: Subv Date: Mon, 17 Sep 2018 09:46:53 -0500 Subject: [PATCH] GPU/DMA: Flush the source memory region before a DMA transfer and invalidate the destination region after the transfer. --- src/video_core/engines/maxwell_dma.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/video_core/engines/maxwell_dma.cpp b/src/video_core/engines/maxwell_dma.cpp index afc80bfd65..6cfc5a4ef8 100644 --- a/src/video_core/engines/maxwell_dma.cpp +++ b/src/video_core/engines/maxwell_dma.cpp @@ -65,6 +65,10 @@ void MaxwellDMA::HandleCopy() { } ASSERT(regs.exec.enable_2d == 1); + + // TODO(Subv): For now, manually flush the regions until we implement GPU-accelerated copying. + rasterizer.FlushRegion(source_cpu, copy_size); + u8* src_buffer = Memory::GetPointer(source_cpu); u8* dst_buffer = Memory::GetPointer(dest_cpu); @@ -77,6 +81,9 @@ void MaxwellDMA::HandleCopy() { Texture::CopySwizzledData(regs.dst_params.size_x, regs.dst_params.size_y, 1, 1, dst_buffer, src_buffer, false, regs.dst_params.BlockHeight()); } + + // We have to invalidate the destination region to evict any outdated surfaces from the cache. + rasterizer.InvalidateRegion(dest_cpu, copy_size); } } // namespace Engines