From da8f17715dbdc7eec92f5f0c11c968a51b86cab4 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Sun, 16 Feb 2020 09:51:37 -0400 Subject: GPU: Refactor synchronization on Async GPU --- src/video_core/gpu.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/video_core/gpu.h') diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h index 1a2d747be..99ed190bc 100644 --- a/src/video_core/gpu.h +++ b/src/video_core/gpu.h @@ -156,6 +156,7 @@ public: void CallMethod(const MethodCall& method_call); void FlushCommands(); + void SyncGuestHost(); /// Returns a reference to the Maxwell3D GPU engine. Engines::Maxwell3D& Maxwell3D(); -- cgit v1.2.3 From 339d0d9d6c02cf79d6025dae7c60d8635fa4ea3b Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Sun, 16 Feb 2020 16:24:37 -0400 Subject: GPU: Delay Fences. --- src/video_core/gpu.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/video_core/gpu.h') 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: void FlushCommands(); void SyncGuestHost(); + void OnCommandListEnd(); /// Returns a reference to the Maxwell3D GPU engine. Engines::Maxwell3D& Maxwell3D(); -- cgit v1.2.3 From 487379c593bcaf3787ede187c5d44f7923b54dc9 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Mon, 17 Feb 2020 18:10:23 -0400 Subject: OpenGL: Implement Fencing backend. --- src/video_core/gpu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/video_core/gpu.h') diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h index b88445634..fa9991c87 100644 --- a/src/video_core/gpu.h +++ b/src/video_core/gpu.h @@ -157,7 +157,7 @@ public: void FlushCommands(); void SyncGuestHost(); - void OnCommandListEnd(); + virtual void OnCommandListEnd(); /// Returns a reference to the Maxwell3D GPU engine. Engines::Maxwell3D& Maxwell3D(); -- cgit v1.2.3 From 1fb516cd979ed0dbf8fa7cb4f6a334932dfb6434 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Thu, 20 Feb 2020 11:55:32 -0400 Subject: GPU: Implement Flush Requests for Async mode. --- src/video_core/gpu.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/video_core/gpu.h') diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h index fa9991c87..943a5b110 100644 --- a/src/video_core/gpu.h +++ b/src/video_core/gpu.h @@ -159,6 +159,14 @@ public: void SyncGuestHost(); virtual void OnCommandListEnd(); + u64 RequestFlush(CacheAddr addr, std::size_t size); + + u64 CurrentFlushRequestFence() const { + return current_flush_fence.load(std::memory_order_relaxed); + } + + void TickWork(); + /// Returns a reference to the Maxwell3D GPU engine. Engines::Maxwell3D& Maxwell3D(); @@ -327,6 +335,19 @@ private: std::condition_variable sync_cv; + struct FlushRequest { + FlushRequest(u64 fence, CacheAddr addr, std::size_t size) + : fence{fence}, addr{addr}, size{size} {} + u64 fence; + CacheAddr addr; + std::size_t size; + }; + + std::list flush_requests; + std::atomic current_flush_fence{}; + u64 last_flush_fence{}; + std::mutex flush_request_mutex; + const bool is_async; }; -- cgit v1.2.3 From f616dc0b591b783b3fb75ca89633f1c26cce05a9 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Thu, 16 Apr 2020 12:29:53 -0400 Subject: Address Feedback. --- src/video_core/gpu.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/video_core/gpu.h') diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h index 943a5b110..5e3eb94e9 100644 --- a/src/video_core/gpu.h +++ b/src/video_core/gpu.h @@ -155,16 +155,22 @@ public: /// Calls a GPU method. void CallMethod(const MethodCall& method_call); + /// Flush all current written commands into the host GPU for execution. void FlushCommands(); + /// Synchronizes CPU writes with Host GPU memory. void SyncGuestHost(); + /// Signal the ending of command list. virtual void OnCommandListEnd(); - u64 RequestFlush(CacheAddr addr, std::size_t size); + /// Request a host GPU memory flush from the CPU. + u64 RequestFlush(VAddr addr, std::size_t size); + /// Obtains current flush request fence id. u64 CurrentFlushRequestFence() const { return current_flush_fence.load(std::memory_order_relaxed); } + /// Tick pending requests within the GPU. void TickWork(); /// Returns a reference to the Maxwell3D GPU engine. @@ -336,10 +342,10 @@ private: std::condition_variable sync_cv; struct FlushRequest { - FlushRequest(u64 fence, CacheAddr addr, std::size_t size) + FlushRequest(u64 fence, VAddr addr, std::size_t size) : fence{fence}, addr{addr}, size{size} {} u64 fence; - CacheAddr addr; + VAddr addr; std::size_t size; }; -- cgit v1.2.3