diff options
Diffstat (limited to 'src/video_core/gpu_asynch.cpp')
| -rw-r--r-- | src/video_core/gpu_asynch.cpp | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/video_core/gpu_asynch.cpp b/src/video_core/gpu_asynch.cpp index 70a3d5738..a9baaf7ef 100644 --- a/src/video_core/gpu_asynch.cpp +++ b/src/video_core/gpu_asynch.cpp | |||
| @@ -10,12 +10,13 @@ | |||
| 10 | 10 | ||
| 11 | namespace VideoCommon { | 11 | namespace VideoCommon { |
| 12 | 12 | ||
| 13 | GPUAsynch::GPUAsynch(Core::System& system) : GPU{system, true}, gpu_thread{system} {} | 13 | GPUAsynch::GPUAsynch(Core::System& system, bool use_nvdec) |
| 14 | : GPU{system, true, use_nvdec}, gpu_thread{system} {} | ||
| 14 | 15 | ||
| 15 | GPUAsynch::~GPUAsynch() = default; | 16 | GPUAsynch::~GPUAsynch() = default; |
| 16 | 17 | ||
| 17 | void GPUAsynch::Start() { | 18 | void GPUAsynch::Start() { |
| 18 | gpu_thread.StartThread(*renderer, renderer->Context(), *dma_pusher); | 19 | gpu_thread.StartThread(*renderer, renderer->Context(), *dma_pusher, *cdma_pusher); |
| 19 | cpu_context = renderer->GetRenderWindow().CreateSharedContext(); | 20 | cpu_context = renderer->GetRenderWindow().CreateSharedContext(); |
| 20 | cpu_context->MakeCurrent(); | 21 | cpu_context->MakeCurrent(); |
| 21 | } | 22 | } |
| @@ -32,6 +33,27 @@ void GPUAsynch::PushGPUEntries(Tegra::CommandList&& entries) { | |||
| 32 | gpu_thread.SubmitList(std::move(entries)); | 33 | gpu_thread.SubmitList(std::move(entries)); |
| 33 | } | 34 | } |
| 34 | 35 | ||
| 36 | void GPUAsynch::PushCommandBuffer(Tegra::ChCommandHeaderList& entries) { | ||
| 37 | if (!use_nvdec) { | ||
| 38 | return; | ||
| 39 | } | ||
| 40 | // This condition fires when a video stream ends, clear all intermediary data | ||
| 41 | if (entries[0].raw == 0xDEADB33F) { | ||
| 42 | cdma_pusher.reset(); | ||
| 43 | return; | ||
| 44 | } | ||
| 45 | if (!cdma_pusher) { | ||
| 46 | cdma_pusher = std::make_unique<Tegra::CDmaPusher>(*this); | ||
| 47 | } | ||
| 48 | |||
| 49 | // SubmitCommandBuffer would make the nvdec operations async, this is not currently working | ||
| 50 | // TODO(ameerj): RE proper async nvdec operation | ||
| 51 | // gpu_thread.SubmitCommandBuffer(std::move(entries)); | ||
| 52 | |||
| 53 | cdma_pusher->Push(std::move(entries)); | ||
| 54 | cdma_pusher->DispatchCalls(); | ||
| 55 | } | ||
| 56 | |||
| 35 | void GPUAsynch::SwapBuffers(const Tegra::FramebufferConfig* framebuffer) { | 57 | void GPUAsynch::SwapBuffers(const Tegra::FramebufferConfig* framebuffer) { |
| 36 | gpu_thread.SwapBuffers(framebuffer); | 58 | gpu_thread.SwapBuffers(framebuffer); |
| 37 | } | 59 | } |