From c6cac2ffaad4ac27f35cea25022d9c59c7ecfbf4 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Sun, 30 Apr 2023 17:14:06 +0200 Subject: GPU: Add Reactive flushing --- src/video_core/gpu.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/video_core/gpu.cpp') diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index 2e7f9c5ed..295a416a8 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp @@ -283,6 +283,21 @@ struct GPU::Impl { gpu_thread.FlushRegion(addr, size); } + VideoCore::RasterizerDownloadArea OnCPURead(VAddr addr, u64 size) { + auto raster_area = rasterizer->GetFlushArea(addr, size); + if (raster_area.preemtive) { + return raster_area; + } + raster_area.preemtive = true; + const u64 fence = RequestSyncOperation([this, &raster_area]() { + rasterizer->FlushRegion(raster_area.start_address, + raster_area.end_address - raster_area.start_address); + }); + gpu_thread.TickGPU(); + WaitForSyncOperation(fence); + return raster_area; + } + /// Notify rasterizer that any caches of the specified region should be invalidated void InvalidateRegion(VAddr addr, u64 size) { gpu_thread.InvalidateRegion(addr, size); @@ -538,6 +553,10 @@ void GPU::SwapBuffers(const Tegra::FramebufferConfig* framebuffer) { impl->SwapBuffers(framebuffer); } +VideoCore::RasterizerDownloadArea GPU::OnCPURead(VAddr addr, u64 size) { + return impl->OnCPURead(addr, size); +} + void GPU::FlushRegion(VAddr addr, u64 size) { impl->FlushRegion(addr, size); } -- cgit v1.2.3