summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2020-02-16 16:24:37 -0400
committerGravatar Fernando Sahmkow2020-04-22 11:36:08 -0400
commit339d0d9d6c02cf79d6025dae7c60d8635fa4ea3b (patch)
treec9a583f3a581fd52cef4d77c2c82d4d9a1e9c1fe
parentBufferCache: Implement OnCPUWrite and SyncGuestHost (diff)
downloadyuzu-339d0d9d6c02cf79d6025dae7c60d8635fa4ea3b.tar.gz
yuzu-339d0d9d6c02cf79d6025dae7c60d8635fa4ea3b.tar.xz
yuzu-339d0d9d6c02cf79d6025dae7c60d8635fa4ea3b.zip
GPU: Delay Fences.
-rw-r--r--src/video_core/dma_pusher.cpp1
-rw-r--r--src/video_core/engines/maxwell_3d.cpp10
-rw-r--r--src/video_core/engines/maxwell_3d.h4
-rw-r--r--src/video_core/gpu.cpp4
-rw-r--r--src/video_core/gpu.h1
-rw-r--r--src/video_core/gpu_thread.cpp2
6 files changed, 20 insertions, 2 deletions
diff --git a/src/video_core/dma_pusher.cpp b/src/video_core/dma_pusher.cpp
index 31627b812..324dafdcd 100644
--- a/src/video_core/dma_pusher.cpp
+++ b/src/video_core/dma_pusher.cpp
@@ -34,6 +34,7 @@ void DmaPusher::DispatchCalls() {
34 } 34 }
35 gpu.FlushCommands(); 35 gpu.FlushCommands();
36 gpu.SyncGuestHost(); 36 gpu.SyncGuestHost();
37 gpu.OnCommandListEnd();
37} 38}
38 39
39bool DmaPusher::Step() { 40bool DmaPusher::Step() {
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp
index 2298a6273..2605c3b42 100644
--- a/src/video_core/engines/maxwell_3d.cpp
+++ b/src/video_core/engines/maxwell_3d.cpp
@@ -397,6 +397,14 @@ void Maxwell3D::StampQueryResult(u64 payload, bool long_query) {
397 } 397 }
398} 398}
399 399
400void Maxwell3D::ReleaseFences() {
401 for (const auto pair : delay_fences) {
402 const auto [addr, payload] = pair;
403 memory_manager.Write<u32>(addr, static_cast<u32>(payload));
404 }
405 delay_fences.clear();
406}
407
400void Maxwell3D::ProcessQueryGet() { 408void Maxwell3D::ProcessQueryGet() {
401 // TODO(Subv): Support the other query units. 409 // TODO(Subv): Support the other query units.
402 ASSERT_MSG(regs.query.query_get.unit == Regs::QueryUnit::Crop, 410 ASSERT_MSG(regs.query.query_get.unit == Regs::QueryUnit::Crop,
@@ -407,7 +415,7 @@ void Maxwell3D::ProcessQueryGet() {
407 rasterizer.FlushCommands(); 415 rasterizer.FlushCommands();
408 rasterizer.SyncGuestHost(); 416 rasterizer.SyncGuestHost();
409 const u64 result = regs.query.query_sequence; 417 const u64 result = regs.query.query_sequence;
410 StampQueryResult(result, regs.query.query_get.short_query == 0); 418 delay_fences.emplace_back(regs.query.QueryAddress(), result);
411 break; 419 break;
412 } 420 }
413 case Regs::QueryOperation::Acquire: 421 case Regs::QueryOperation::Acquire:
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h
index 59d5752d2..0a93827ec 100644
--- a/src/video_core/engines/maxwell_3d.h
+++ b/src/video_core/engines/maxwell_3d.h
@@ -1427,6 +1427,8 @@ public:
1427 Tables tables{}; 1427 Tables tables{};
1428 } dirty; 1428 } dirty;
1429 1429
1430 void ReleaseFences();
1431
1430private: 1432private:
1431 void InitializeRegisterDefaults(); 1433 void InitializeRegisterDefaults();
1432 1434
@@ -1467,6 +1469,8 @@ private:
1467 1469
1468 std::array<u8, Regs::NUM_REGS> dirty_pointers{}; 1470 std::array<u8, Regs::NUM_REGS> dirty_pointers{};
1469 1471
1472 std::vector<std::pair<GPUVAddr, u64>> delay_fences;
1473
1470 /// Retrieves information about a specific TIC entry from the TIC buffer. 1474 /// Retrieves information about a specific TIC entry from the TIC buffer.
1471 Texture::TICEntry GetTICEntry(u32 tic_index) const; 1475 Texture::TICEntry GetTICEntry(u32 tic_index) const;
1472 1476
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp
index 13bca5a78..71ddfbd26 100644
--- a/src/video_core/gpu.cpp
+++ b/src/video_core/gpu.cpp
@@ -145,6 +145,10 @@ void GPU::FlushCommands() {
145void GPU::SyncGuestHost() { 145void GPU::SyncGuestHost() {
146 renderer->Rasterizer().SyncGuestHost(); 146 renderer->Rasterizer().SyncGuestHost();
147} 147}
148
149void GPU::OnCommandListEnd() {
150 maxwell_3d->ReleaseFences();
151}
148// Note that, traditionally, methods are treated as 4-byte addressable locations, and hence 152// Note that, traditionally, methods are treated as 4-byte addressable locations, and hence
149// their numbers are written down multiplied by 4 in Docs. Here we are not multiply by 4. 153// their numbers are written down multiplied by 4 in Docs. Here we are not multiply by 4.
150// So the values you see in docs might be multiplied by 4. 154// So the values you see in docs might be multiplied by 4.
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h
index 99ed190bc..b88445634 100644
--- a/src/video_core/gpu.h
+++ b/src/video_core/gpu.h
@@ -157,6 +157,7 @@ public:
157 157
158 void FlushCommands(); 158 void FlushCommands();
159 void SyncGuestHost(); 159 void SyncGuestHost();
160 void OnCommandListEnd();
160 161
161 /// Returns a reference to the Maxwell3D GPU engine. 162 /// Returns a reference to the Maxwell3D GPU engine.
162 Engines::Maxwell3D& Maxwell3D(); 163 Engines::Maxwell3D& Maxwell3D();
diff --git a/src/video_core/gpu_thread.cpp b/src/video_core/gpu_thread.cpp
index 0a8123cfe..1994d3bb4 100644
--- a/src/video_core/gpu_thread.cpp
+++ b/src/video_core/gpu_thread.cpp
@@ -78,7 +78,7 @@ void ThreadManager::SwapBuffers(const Tegra::FramebufferConfig* framebuffer) {
78} 78}
79 79
80void ThreadManager::FlushRegion(VAddr addr, u64 size) { 80void ThreadManager::FlushRegion(VAddr addr, u64 size) {
81 system.Renderer().Rasterizer().FlushRegion(addr, size); 81 PushCommand(FlushRegionCommand(addr, size));
82} 82}
83 83
84void ThreadManager::InvalidateRegion(VAddr addr, u64 size) { 84void ThreadManager::InvalidateRegion(VAddr addr, u64 size) {