diff options
Diffstat (limited to 'src/video_core/gpu_thread.cpp')
| -rw-r--r-- | src/video_core/gpu_thread.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/video_core/gpu_thread.cpp b/src/video_core/gpu_thread.cpp index cc56cf467..c9a2077de 100644 --- a/src/video_core/gpu_thread.cpp +++ b/src/video_core/gpu_thread.cpp | |||
| @@ -55,19 +55,24 @@ static void RunThread(VideoCore::RendererBase& renderer, Tegra::DmaPusher& dma_p | |||
| 55 | } | 55 | } |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | ThreadManager::ThreadManager(Core::System& system, VideoCore::RendererBase& renderer, | 58 | ThreadManager::ThreadManager(Core::System& system) : system{system} {} |
| 59 | Tegra::DmaPusher& dma_pusher) | ||
| 60 | : system{system}, thread{RunThread, std::ref(renderer), std::ref(dma_pusher), std::ref(state)} { | ||
| 61 | synchronization_event = system.CoreTiming().RegisterEvent( | ||
| 62 | "GPUThreadSynch", [this](u64 fence, s64) { state.WaitForSynchronization(fence); }); | ||
| 63 | } | ||
| 64 | 59 | ||
| 65 | ThreadManager::~ThreadManager() { | 60 | ThreadManager::~ThreadManager() { |
| 61 | if (!thread.joinable()) { | ||
| 62 | return; | ||
| 63 | } | ||
| 64 | |||
| 66 | // Notify GPU thread that a shutdown is pending | 65 | // Notify GPU thread that a shutdown is pending |
| 67 | PushCommand(EndProcessingCommand()); | 66 | PushCommand(EndProcessingCommand()); |
| 68 | thread.join(); | 67 | thread.join(); |
| 69 | } | 68 | } |
| 70 | 69 | ||
| 70 | void ThreadManager::StartThread(VideoCore::RendererBase& renderer, Tegra::DmaPusher& dma_pusher) { | ||
| 71 | thread = std::thread{RunThread, std::ref(renderer), std::ref(dma_pusher), std::ref(state)}; | ||
| 72 | synchronization_event = system.CoreTiming().RegisterEvent( | ||
| 73 | "GPUThreadSynch", [this](u64 fence, s64) { state.WaitForSynchronization(fence); }); | ||
| 74 | } | ||
| 75 | |||
| 71 | void ThreadManager::SubmitList(Tegra::CommandList&& entries) { | 76 | void ThreadManager::SubmitList(Tegra::CommandList&& entries) { |
| 72 | const u64 fence{PushCommand(SubmitListCommand(std::move(entries)))}; | 77 | const u64 fence{PushCommand(SubmitListCommand(std::move(entries)))}; |
| 73 | const s64 synchronization_ticks{Core::Timing::usToCycles(9000)}; | 78 | const s64 synchronization_ticks{Core::Timing::usToCycles(9000)}; |