From 7a9d1ad2f873003e6aad637e8749b77b91247da3 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Sun, 24 Dec 2023 18:20:02 +0100 Subject: NVDRV: Implement sessions and initial implementation of SMMU --- src/video_core/gpu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/video_core/gpu.cpp') diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index 11549d448..1e915682f 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp @@ -85,7 +85,7 @@ struct GPU::Impl { void BindRenderer(std::unique_ptr renderer_) { renderer = std::move(renderer_); rasterizer = renderer->ReadRasterizer(); - host1x.MemoryManager().BindRasterizer(rasterizer); + host1x.MemoryManager().BindInterface(rasterizer); } /// Flush all current written commands into the host GPU for execution. -- cgit v1.2.3 From 0a2536a0df1f4aea406f2132d3edda0430acc9d1 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Mon, 25 Dec 2023 07:32:16 +0100 Subject: SMMU: Initial adaptation to video_core. --- src/video_core/gpu.cpp | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'src/video_core/gpu.cpp') diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index 1e915682f..5f780507b 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp @@ -34,6 +34,8 @@ #include "video_core/renderer_base.h" #include "video_core/shader_notify.h" +#pragma optimize("", off) + namespace Tegra { struct GPU::Impl { @@ -95,8 +97,8 @@ struct GPU::Impl { /// Synchronizes CPU writes with Host GPU memory. void InvalidateGPUCache() { - std::function callback_writes( - [this](VAddr address, size_t size) { rasterizer->OnCacheInvalidation(address, size); }); + std::function callback_writes( + [this](PAddr address, size_t size) { rasterizer->OnCacheInvalidation(address, size); }); system.GatherGPUDirtyMemory(callback_writes); } @@ -279,11 +281,11 @@ struct GPU::Impl { } /// Notify rasterizer that any caches of the specified region should be flushed to Switch memory - void FlushRegion(VAddr addr, u64 size) { + void FlushRegion(DAddr addr, u64 size) { gpu_thread.FlushRegion(addr, size); } - VideoCore::RasterizerDownloadArea OnCPURead(VAddr addr, u64 size) { + VideoCore::RasterizerDownloadArea OnCPURead(DAddr addr, u64 size) { auto raster_area = rasterizer->GetFlushArea(addr, size); if (raster_area.preemtive) { return raster_area; @@ -299,16 +301,16 @@ struct GPU::Impl { } /// Notify rasterizer that any caches of the specified region should be invalidated - void InvalidateRegion(VAddr addr, u64 size) { + void InvalidateRegion(DAddr addr, u64 size) { gpu_thread.InvalidateRegion(addr, size); } - bool OnCPUWrite(VAddr addr, u64 size) { + bool OnCPUWrite(DAddr addr, u64 size) { return rasterizer->OnCPUWrite(addr, size); } /// Notify rasterizer that any caches of the specified region should be flushed and invalidated - void FlushAndInvalidateRegion(VAddr addr, u64 size) { + void FlushAndInvalidateRegion(DAddr addr, u64 size) { gpu_thread.FlushAndInvalidateRegion(addr, size); } @@ -437,7 +439,7 @@ void GPU::OnCommandListEnd() { impl->OnCommandListEnd(); } -u64 GPU::RequestFlush(VAddr addr, std::size_t size) { +u64 GPU::RequestFlush(DAddr addr, std::size_t size) { return impl->RequestSyncOperation( [this, addr, size]() { impl->rasterizer->FlushRegion(addr, size); }); } @@ -557,23 +559,23 @@ void GPU::SwapBuffers(const Tegra::FramebufferConfig* framebuffer) { impl->SwapBuffers(framebuffer); } -VideoCore::RasterizerDownloadArea GPU::OnCPURead(VAddr addr, u64 size) { +VideoCore::RasterizerDownloadArea GPU::OnCPURead(PAddr addr, u64 size) { return impl->OnCPURead(addr, size); } -void GPU::FlushRegion(VAddr addr, u64 size) { +void GPU::FlushRegion(DAddr addr, u64 size) { impl->FlushRegion(addr, size); } -void GPU::InvalidateRegion(VAddr addr, u64 size) { +void GPU::InvalidateRegion(DAddr addr, u64 size) { impl->InvalidateRegion(addr, size); } -bool GPU::OnCPUWrite(VAddr addr, u64 size) { +bool GPU::OnCPUWrite(DAddr addr, u64 size) { return impl->OnCPUWrite(addr, size); } -void GPU::FlushAndInvalidateRegion(VAddr addr, u64 size) { +void GPU::FlushAndInvalidateRegion(DAddr addr, u64 size) { impl->FlushAndInvalidateRegion(addr, size); } -- cgit v1.2.3 From 96fd1348aea9d70cb502a94cbd0412be6edb0189 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Fri, 29 Dec 2023 09:50:04 +0100 Subject: GPU SMMU: Expand to 34 bits --- src/video_core/gpu.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/video_core/gpu.cpp') diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index 5f780507b..6ad3b94f8 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp @@ -88,6 +88,7 @@ struct GPU::Impl { renderer = std::move(renderer_); rasterizer = renderer->ReadRasterizer(); host1x.MemoryManager().BindInterface(rasterizer); + host1x.GMMU().BindRasterizer(rasterizer); } /// Flush all current written commands into the host GPU for execution. -- cgit v1.2.3 From 0adc09e0afcde345a5303efd73b3b7737245a7d9 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Sat, 30 Dec 2023 03:36:24 +0100 Subject: GPU-SMMU: Estimate game leak and preallocate device region. --- src/video_core/gpu.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/video_core/gpu.cpp') diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index 6ad3b94f8..609704b33 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp @@ -34,8 +34,6 @@ #include "video_core/renderer_base.h" #include "video_core/shader_notify.h" -#pragma optimize("", off) - namespace Tegra { struct GPU::Impl { -- cgit v1.2.3