diff options
| author | 2019-01-23 22:17:55 -0500 | |
|---|---|---|
| committer | 2019-03-06 21:48:57 -0500 | |
| commit | 7b574f406b25c02a0e0efd8b7ec13d68ecb55497 (patch) | |
| tree | 375d4637d49ffe506129ce9cb679b5902328106a /src/video_core/gpu.cpp | |
| parent | bootmanager: Ensure that we have a context for shader loading. (diff) | |
| download | yuzu-7b574f406b25c02a0e0efd8b7ec13d68ecb55497.tar.gz yuzu-7b574f406b25c02a0e0efd8b7ec13d68ecb55497.tar.xz yuzu-7b574f406b25c02a0e0efd8b7ec13d68ecb55497.zip | |
gpu: Move command processing to another thread.
Diffstat (limited to 'src/video_core/gpu.cpp')
| -rw-r--r-- | src/video_core/gpu.cpp | 44 |
1 files changed, 41 insertions, 3 deletions
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index b0f3310e5..0d7a052dd 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp | |||
| @@ -6,12 +6,14 @@ | |||
| 6 | #include "core/core.h" | 6 | #include "core/core.h" |
| 7 | #include "core/core_timing.h" | 7 | #include "core/core_timing.h" |
| 8 | #include "core/memory.h" | 8 | #include "core/memory.h" |
| 9 | #include "core/settings.h" | ||
| 9 | #include "video_core/engines/fermi_2d.h" | 10 | #include "video_core/engines/fermi_2d.h" |
| 10 | #include "video_core/engines/kepler_compute.h" | 11 | #include "video_core/engines/kepler_compute.h" |
| 11 | #include "video_core/engines/kepler_memory.h" | 12 | #include "video_core/engines/kepler_memory.h" |
| 12 | #include "video_core/engines/maxwell_3d.h" | 13 | #include "video_core/engines/maxwell_3d.h" |
| 13 | #include "video_core/engines/maxwell_dma.h" | 14 | #include "video_core/engines/maxwell_dma.h" |
| 14 | #include "video_core/gpu.h" | 15 | #include "video_core/gpu.h" |
| 16 | #include "video_core/gpu_thread.h" | ||
| 15 | #include "video_core/renderer_base.h" | 17 | #include "video_core/renderer_base.h" |
| 16 | 18 | ||
| 17 | namespace Tegra { | 19 | namespace Tegra { |
| @@ -37,6 +39,10 @@ GPU::GPU(Core::System& system, VideoCore::RendererBase& renderer) : renderer{ren | |||
| 37 | kepler_compute = std::make_unique<Engines::KeplerCompute>(*memory_manager); | 39 | kepler_compute = std::make_unique<Engines::KeplerCompute>(*memory_manager); |
| 38 | maxwell_dma = std::make_unique<Engines::MaxwellDMA>(system, rasterizer, *memory_manager); | 40 | maxwell_dma = std::make_unique<Engines::MaxwellDMA>(system, rasterizer, *memory_manager); |
| 39 | kepler_memory = std::make_unique<Engines::KeplerMemory>(system, rasterizer, *memory_manager); | 41 | kepler_memory = std::make_unique<Engines::KeplerMemory>(system, rasterizer, *memory_manager); |
| 42 | |||
| 43 | if (Settings::values.use_asynchronous_gpu_emulation) { | ||
| 44 | gpu_thread = std::make_unique<VideoCommon::GPUThread::ThreadManager>(renderer, *dma_pusher); | ||
| 45 | } | ||
| 40 | } | 46 | } |
| 41 | 47 | ||
| 42 | GPU::~GPU() = default; | 48 | GPU::~GPU() = default; |
| @@ -66,13 +72,45 @@ const DmaPusher& GPU::DmaPusher() const { | |||
| 66 | } | 72 | } |
| 67 | 73 | ||
| 68 | void GPU::PushGPUEntries(Tegra::CommandList&& entries) { | 74 | void GPU::PushGPUEntries(Tegra::CommandList&& entries) { |
| 69 | dma_pusher->Push(std::move(entries)); | 75 | if (Settings::values.use_asynchronous_gpu_emulation) { |
| 70 | dma_pusher->DispatchCalls(); | 76 | gpu_thread->SubmitList(std::move(entries)); |
| 77 | } else { | ||
| 78 | dma_pusher->Push(std::move(entries)); | ||
| 79 | dma_pusher->DispatchCalls(); | ||
| 80 | } | ||
| 71 | } | 81 | } |
| 72 | 82 | ||
| 73 | void GPU::SwapBuffers( | 83 | void GPU::SwapBuffers( |
| 74 | std::optional<std::reference_wrapper<const Tegra::FramebufferConfig>> framebuffer) { | 84 | std::optional<std::reference_wrapper<const Tegra::FramebufferConfig>> framebuffer) { |
| 75 | renderer.SwapBuffers(std::move(framebuffer)); | 85 | if (Settings::values.use_asynchronous_gpu_emulation) { |
| 86 | gpu_thread->SwapBuffers(std::move(framebuffer)); | ||
| 87 | } else { | ||
| 88 | renderer.SwapBuffers(std::move(framebuffer)); | ||
| 89 | } | ||
| 90 | } | ||
| 91 | |||
| 92 | void GPU::FlushRegion(VAddr addr, u64 size) { | ||
| 93 | if (Settings::values.use_asynchronous_gpu_emulation) { | ||
| 94 | gpu_thread->FlushRegion(addr, size); | ||
| 95 | } else { | ||
| 96 | renderer.Rasterizer().FlushRegion(addr, size); | ||
| 97 | } | ||
| 98 | } | ||
| 99 | |||
| 100 | void GPU::InvalidateRegion(VAddr addr, u64 size) { | ||
| 101 | if (Settings::values.use_asynchronous_gpu_emulation) { | ||
| 102 | gpu_thread->InvalidateRegion(addr, size); | ||
| 103 | } else { | ||
| 104 | renderer.Rasterizer().InvalidateRegion(addr, size); | ||
| 105 | } | ||
| 106 | } | ||
| 107 | |||
| 108 | void GPU::FlushAndInvalidateRegion(VAddr addr, u64 size) { | ||
| 109 | if (Settings::values.use_asynchronous_gpu_emulation) { | ||
| 110 | gpu_thread->FlushAndInvalidateRegion(addr, size); | ||
| 111 | } else { | ||
| 112 | renderer.Rasterizer().FlushAndInvalidateRegion(addr, size); | ||
| 113 | } | ||
| 76 | } | 114 | } |
| 77 | 115 | ||
| 78 | u32 RenderTargetBytesPerPixel(RenderTargetFormat format) { | 116 | u32 RenderTargetBytesPerPixel(RenderTargetFormat format) { |