summaryrefslogtreecommitdiff
path: root/src/video_core/gpu.cpp
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2023-12-25 07:32:16 +0100
committerGravatar Liam2024-01-18 21:12:30 -0500
commit0a2536a0df1f4aea406f2132d3edda0430acc9d1 (patch)
treec0ad53890581c9c7e180c5ccb3b66e3c63e3ba64 /src/video_core/gpu.cpp
parentSMMU: Implement backing CPU page protect/unprotect (diff)
downloadyuzu-0a2536a0df1f4aea406f2132d3edda0430acc9d1.tar.gz
yuzu-0a2536a0df1f4aea406f2132d3edda0430acc9d1.tar.xz
yuzu-0a2536a0df1f4aea406f2132d3edda0430acc9d1.zip
SMMU: Initial adaptation to video_core.
Diffstat (limited to 'src/video_core/gpu.cpp')
-rw-r--r--src/video_core/gpu.cpp28
1 files changed, 15 insertions, 13 deletions
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 @@
34#include "video_core/renderer_base.h" 34#include "video_core/renderer_base.h"
35#include "video_core/shader_notify.h" 35#include "video_core/shader_notify.h"
36 36
37#pragma optimize("", off)
38
37namespace Tegra { 39namespace Tegra {
38 40
39struct GPU::Impl { 41struct GPU::Impl {
@@ -95,8 +97,8 @@ struct GPU::Impl {
95 97
96 /// Synchronizes CPU writes with Host GPU memory. 98 /// Synchronizes CPU writes with Host GPU memory.
97 void InvalidateGPUCache() { 99 void InvalidateGPUCache() {
98 std::function<void(VAddr, size_t)> callback_writes( 100 std::function<void(PAddr, size_t)> callback_writes(
99 [this](VAddr address, size_t size) { rasterizer->OnCacheInvalidation(address, size); }); 101 [this](PAddr address, size_t size) { rasterizer->OnCacheInvalidation(address, size); });
100 system.GatherGPUDirtyMemory(callback_writes); 102 system.GatherGPUDirtyMemory(callback_writes);
101 } 103 }
102 104
@@ -279,11 +281,11 @@ struct GPU::Impl {
279 } 281 }
280 282
281 /// Notify rasterizer that any caches of the specified region should be flushed to Switch memory 283 /// Notify rasterizer that any caches of the specified region should be flushed to Switch memory
282 void FlushRegion(VAddr addr, u64 size) { 284 void FlushRegion(DAddr addr, u64 size) {
283 gpu_thread.FlushRegion(addr, size); 285 gpu_thread.FlushRegion(addr, size);
284 } 286 }
285 287
286 VideoCore::RasterizerDownloadArea OnCPURead(VAddr addr, u64 size) { 288 VideoCore::RasterizerDownloadArea OnCPURead(DAddr addr, u64 size) {
287 auto raster_area = rasterizer->GetFlushArea(addr, size); 289 auto raster_area = rasterizer->GetFlushArea(addr, size);
288 if (raster_area.preemtive) { 290 if (raster_area.preemtive) {
289 return raster_area; 291 return raster_area;
@@ -299,16 +301,16 @@ struct GPU::Impl {
299 } 301 }
300 302
301 /// Notify rasterizer that any caches of the specified region should be invalidated 303 /// Notify rasterizer that any caches of the specified region should be invalidated
302 void InvalidateRegion(VAddr addr, u64 size) { 304 void InvalidateRegion(DAddr addr, u64 size) {
303 gpu_thread.InvalidateRegion(addr, size); 305 gpu_thread.InvalidateRegion(addr, size);
304 } 306 }
305 307
306 bool OnCPUWrite(VAddr addr, u64 size) { 308 bool OnCPUWrite(DAddr addr, u64 size) {
307 return rasterizer->OnCPUWrite(addr, size); 309 return rasterizer->OnCPUWrite(addr, size);
308 } 310 }
309 311
310 /// Notify rasterizer that any caches of the specified region should be flushed and invalidated 312 /// Notify rasterizer that any caches of the specified region should be flushed and invalidated
311 void FlushAndInvalidateRegion(VAddr addr, u64 size) { 313 void FlushAndInvalidateRegion(DAddr addr, u64 size) {
312 gpu_thread.FlushAndInvalidateRegion(addr, size); 314 gpu_thread.FlushAndInvalidateRegion(addr, size);
313 } 315 }
314 316
@@ -437,7 +439,7 @@ void GPU::OnCommandListEnd() {
437 impl->OnCommandListEnd(); 439 impl->OnCommandListEnd();
438} 440}
439 441
440u64 GPU::RequestFlush(VAddr addr, std::size_t size) { 442u64 GPU::RequestFlush(DAddr addr, std::size_t size) {
441 return impl->RequestSyncOperation( 443 return impl->RequestSyncOperation(
442 [this, addr, size]() { impl->rasterizer->FlushRegion(addr, size); }); 444 [this, addr, size]() { impl->rasterizer->FlushRegion(addr, size); });
443} 445}
@@ -557,23 +559,23 @@ void GPU::SwapBuffers(const Tegra::FramebufferConfig* framebuffer) {
557 impl->SwapBuffers(framebuffer); 559 impl->SwapBuffers(framebuffer);
558} 560}
559 561
560VideoCore::RasterizerDownloadArea GPU::OnCPURead(VAddr addr, u64 size) { 562VideoCore::RasterizerDownloadArea GPU::OnCPURead(PAddr addr, u64 size) {
561 return impl->OnCPURead(addr, size); 563 return impl->OnCPURead(addr, size);
562} 564}
563 565
564void GPU::FlushRegion(VAddr addr, u64 size) { 566void GPU::FlushRegion(DAddr addr, u64 size) {
565 impl->FlushRegion(addr, size); 567 impl->FlushRegion(addr, size);
566} 568}
567 569
568void GPU::InvalidateRegion(VAddr addr, u64 size) { 570void GPU::InvalidateRegion(DAddr addr, u64 size) {
569 impl->InvalidateRegion(addr, size); 571 impl->InvalidateRegion(addr, size);
570} 572}
571 573
572bool GPU::OnCPUWrite(VAddr addr, u64 size) { 574bool GPU::OnCPUWrite(DAddr addr, u64 size) {
573 return impl->OnCPUWrite(addr, size); 575 return impl->OnCPUWrite(addr, size);
574} 576}
575 577
576void GPU::FlushAndInvalidateRegion(VAddr addr, u64 size) { 578void GPU::FlushAndInvalidateRegion(DAddr addr, u64 size) {
577 impl->FlushAndInvalidateRegion(addr, size); 579 impl->FlushAndInvalidateRegion(addr, size);
578} 580}
579 581