summaryrefslogtreecommitdiff
path: root/src/video_core/gpu.cpp
diff options
context:
space:
mode:
authorGravatar liamwhite2024-01-22 10:55:39 -0500
committerGravatar GitHub2024-01-22 10:55:39 -0500
commit8bd10473d60503c7acddc399604a51b9c9947541 (patch)
treef713f84942681321fca27ba028e31d6c74a09013 /src/video_core/gpu.cpp
parentMerge pull request #12747 from t895/homescreen-widget (diff)
parentdevice_memory_manager: use unique_lock for update (diff)
downloadyuzu-8bd10473d60503c7acddc399604a51b9c9947541.tar.gz
yuzu-8bd10473d60503c7acddc399604a51b9c9947541.tar.xz
yuzu-8bd10473d60503c7acddc399604a51b9c9947541.zip
Merge pull request #12579 from FernandoS27/smmu
Core: Implement Device Mapping & GPU SMMU
Diffstat (limited to 'src/video_core/gpu.cpp')
-rw-r--r--src/video_core/gpu.cpp29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp
index 11549d448..609704b33 100644
--- a/src/video_core/gpu.cpp
+++ b/src/video_core/gpu.cpp
@@ -85,7 +85,8 @@ struct GPU::Impl {
85 void BindRenderer(std::unique_ptr<VideoCore::RendererBase> renderer_) { 85 void BindRenderer(std::unique_ptr<VideoCore::RendererBase> renderer_) {
86 renderer = std::move(renderer_); 86 renderer = std::move(renderer_);
87 rasterizer = renderer->ReadRasterizer(); 87 rasterizer = renderer->ReadRasterizer();
88 host1x.MemoryManager().BindRasterizer(rasterizer); 88 host1x.MemoryManager().BindInterface(rasterizer);
89 host1x.GMMU().BindRasterizer(rasterizer);
89 } 90 }
90 91
91 /// Flush all current written commands into the host GPU for execution. 92 /// Flush all current written commands into the host GPU for execution.
@@ -95,8 +96,8 @@ struct GPU::Impl {
95 96
96 /// Synchronizes CPU writes with Host GPU memory. 97 /// Synchronizes CPU writes with Host GPU memory.
97 void InvalidateGPUCache() { 98 void InvalidateGPUCache() {
98 std::function<void(VAddr, size_t)> callback_writes( 99 std::function<void(PAddr, size_t)> callback_writes(
99 [this](VAddr address, size_t size) { rasterizer->OnCacheInvalidation(address, size); }); 100 [this](PAddr address, size_t size) { rasterizer->OnCacheInvalidation(address, size); });
100 system.GatherGPUDirtyMemory(callback_writes); 101 system.GatherGPUDirtyMemory(callback_writes);
101 } 102 }
102 103
@@ -279,11 +280,11 @@ struct GPU::Impl {
279 } 280 }
280 281
281 /// Notify rasterizer that any caches of the specified region should be flushed to Switch memory 282 /// Notify rasterizer that any caches of the specified region should be flushed to Switch memory
282 void FlushRegion(VAddr addr, u64 size) { 283 void FlushRegion(DAddr addr, u64 size) {
283 gpu_thread.FlushRegion(addr, size); 284 gpu_thread.FlushRegion(addr, size);
284 } 285 }
285 286
286 VideoCore::RasterizerDownloadArea OnCPURead(VAddr addr, u64 size) { 287 VideoCore::RasterizerDownloadArea OnCPURead(DAddr addr, u64 size) {
287 auto raster_area = rasterizer->GetFlushArea(addr, size); 288 auto raster_area = rasterizer->GetFlushArea(addr, size);
288 if (raster_area.preemtive) { 289 if (raster_area.preemtive) {
289 return raster_area; 290 return raster_area;
@@ -299,16 +300,16 @@ struct GPU::Impl {
299 } 300 }
300 301
301 /// Notify rasterizer that any caches of the specified region should be invalidated 302 /// Notify rasterizer that any caches of the specified region should be invalidated
302 void InvalidateRegion(VAddr addr, u64 size) { 303 void InvalidateRegion(DAddr addr, u64 size) {
303 gpu_thread.InvalidateRegion(addr, size); 304 gpu_thread.InvalidateRegion(addr, size);
304 } 305 }
305 306
306 bool OnCPUWrite(VAddr addr, u64 size) { 307 bool OnCPUWrite(DAddr addr, u64 size) {
307 return rasterizer->OnCPUWrite(addr, size); 308 return rasterizer->OnCPUWrite(addr, size);
308 } 309 }
309 310
310 /// Notify rasterizer that any caches of the specified region should be flushed and invalidated 311 /// Notify rasterizer that any caches of the specified region should be flushed and invalidated
311 void FlushAndInvalidateRegion(VAddr addr, u64 size) { 312 void FlushAndInvalidateRegion(DAddr addr, u64 size) {
312 gpu_thread.FlushAndInvalidateRegion(addr, size); 313 gpu_thread.FlushAndInvalidateRegion(addr, size);
313 } 314 }
314 315
@@ -437,7 +438,7 @@ void GPU::OnCommandListEnd() {
437 impl->OnCommandListEnd(); 438 impl->OnCommandListEnd();
438} 439}
439 440
440u64 GPU::RequestFlush(VAddr addr, std::size_t size) { 441u64 GPU::RequestFlush(DAddr addr, std::size_t size) {
441 return impl->RequestSyncOperation( 442 return impl->RequestSyncOperation(
442 [this, addr, size]() { impl->rasterizer->FlushRegion(addr, size); }); 443 [this, addr, size]() { impl->rasterizer->FlushRegion(addr, size); });
443} 444}
@@ -557,23 +558,23 @@ void GPU::SwapBuffers(const Tegra::FramebufferConfig* framebuffer) {
557 impl->SwapBuffers(framebuffer); 558 impl->SwapBuffers(framebuffer);
558} 559}
559 560
560VideoCore::RasterizerDownloadArea GPU::OnCPURead(VAddr addr, u64 size) { 561VideoCore::RasterizerDownloadArea GPU::OnCPURead(PAddr addr, u64 size) {
561 return impl->OnCPURead(addr, size); 562 return impl->OnCPURead(addr, size);
562} 563}
563 564
564void GPU::FlushRegion(VAddr addr, u64 size) { 565void GPU::FlushRegion(DAddr addr, u64 size) {
565 impl->FlushRegion(addr, size); 566 impl->FlushRegion(addr, size);
566} 567}
567 568
568void GPU::InvalidateRegion(VAddr addr, u64 size) { 569void GPU::InvalidateRegion(DAddr addr, u64 size) {
569 impl->InvalidateRegion(addr, size); 570 impl->InvalidateRegion(addr, size);
570} 571}
571 572
572bool GPU::OnCPUWrite(VAddr addr, u64 size) { 573bool GPU::OnCPUWrite(DAddr addr, u64 size) {
573 return impl->OnCPUWrite(addr, size); 574 return impl->OnCPUWrite(addr, size);
574} 575}
575 576
576void GPU::FlushAndInvalidateRegion(VAddr addr, u64 size) { 577void GPU::FlushAndInvalidateRegion(DAddr addr, u64 size) {
577 impl->FlushAndInvalidateRegion(addr, size); 578 impl->FlushAndInvalidateRegion(addr, size);
578} 579}
579 580