summaryrefslogtreecommitdiff
path: root/src/video_core/gpu.cpp
diff options
context:
space:
mode:
authorGravatar bunnei2020-04-22 22:09:38 -0400
committerGravatar GitHub2020-04-22 22:09:38 -0400
commitbf2ddb8fd5feaeaf2806fe102de8e3089f893137 (patch)
treeb97d388da23608c00808b6662e3c0564fc4f6d59 /src/video_core/gpu.cpp
parentMerge pull request #3767 from ReinUsesLisp/point-size-pipeline (diff)
parentGL_Fence_Manager: use GL_TIMEOUT_IGNORED instead of a loop, (diff)
downloadyuzu-bf2ddb8fd5feaeaf2806fe102de8e3089f893137.tar.gz
yuzu-bf2ddb8fd5feaeaf2806fe102de8e3089f893137.tar.xz
yuzu-bf2ddb8fd5feaeaf2806fe102de8e3089f893137.zip
Merge pull request #3677 from FernandoS27/better-sync
Introduce Predictive Flushing and Improve ASYNC GPU
Diffstat (limited to 'src/video_core/gpu.cpp')
-rw-r--r--src/video_core/gpu.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp
index a606f4abd..3b7572d61 100644
--- a/src/video_core/gpu.cpp
+++ b/src/video_core/gpu.cpp
@@ -125,6 +125,28 @@ bool GPU::CancelSyncptInterrupt(const u32 syncpoint_id, const u32 value) {
125 return true; 125 return true;
126} 126}
127 127
128u64 GPU::RequestFlush(VAddr addr, std::size_t size) {
129 std::unique_lock lck{flush_request_mutex};
130 const u64 fence = ++last_flush_fence;
131 flush_requests.emplace_back(fence, addr, size);
132 return fence;
133}
134
135void GPU::TickWork() {
136 std::unique_lock lck{flush_request_mutex};
137 while (!flush_requests.empty()) {
138 auto& request = flush_requests.front();
139 const u64 fence = request.fence;
140 const VAddr addr = request.addr;
141 const std::size_t size = request.size;
142 flush_requests.pop_front();
143 flush_request_mutex.unlock();
144 renderer->Rasterizer().FlushRegion(addr, size);
145 current_flush_fence.store(fence);
146 flush_request_mutex.lock();
147 }
148}
149
128u64 GPU::GetTicks() const { 150u64 GPU::GetTicks() const {
129 // This values were reversed engineered by fincs from NVN 151 // This values were reversed engineered by fincs from NVN
130 // The gpu clock is reported in units of 385/625 nanoseconds 152 // The gpu clock is reported in units of 385/625 nanoseconds
@@ -142,6 +164,13 @@ void GPU::FlushCommands() {
142 renderer->Rasterizer().FlushCommands(); 164 renderer->Rasterizer().FlushCommands();
143} 165}
144 166
167void GPU::SyncGuestHost() {
168 renderer->Rasterizer().SyncGuestHost();
169}
170
171void GPU::OnCommandListEnd() {
172 renderer->Rasterizer().ReleaseFences();
173}
145// Note that, traditionally, methods are treated as 4-byte addressable locations, and hence 174// Note that, traditionally, methods are treated as 4-byte addressable locations, and hence
146// their numbers are written down multiplied by 4 in Docs. Here we are not multiply by 4. 175// their numbers are written down multiplied by 4 in Docs. Here we are not multiply by 4.
147// So the values you see in docs might be multiplied by 4. 176// So the values you see in docs might be multiplied by 4.