summaryrefslogtreecommitdiff
path: root/src/video_core/gpu_asynch.cpp
diff options
context:
space:
mode:
authorGravatar bunnei2020-12-11 22:26:14 -0800
committerGravatar bunnei2020-12-28 16:33:48 -0800
commit14c825bd1c37b2444e858bf1a75fb77455b4eb52 (patch)
tree60dfa8c299f4709d04ca652c8eb35e7f7b13ad89 /src/video_core/gpu_asynch.cpp
parenthle: kernel: hle_ipc: Remove SleepClientThread. (diff)
downloadyuzu-14c825bd1c37b2444e858bf1a75fb77455b4eb52.tar.gz
yuzu-14c825bd1c37b2444e858bf1a75fb77455b4eb52.tar.xz
yuzu-14c825bd1c37b2444e858bf1a75fb77455b4eb52.zip
video_core: gpu: Refactor out synchronous/asynchronous GPU implementations.
- We must always use a GPU thread now, even with synchronous GPU.
Diffstat (limited to 'src/video_core/gpu_asynch.cpp')
-rw-r--r--src/video_core/gpu_asynch.cpp86
1 files changed, 0 insertions, 86 deletions
diff --git a/src/video_core/gpu_asynch.cpp b/src/video_core/gpu_asynch.cpp
deleted file mode 100644
index 6cc091ecd..000000000
--- a/src/video_core/gpu_asynch.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
1// Copyright 2019 yuzu Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include "core/core.h"
6#include "core/hardware_interrupt_manager.h"
7#include "video_core/gpu_asynch.h"
8#include "video_core/gpu_thread.h"
9#include "video_core/renderer_base.h"
10
11namespace VideoCommon {
12
13GPUAsynch::GPUAsynch(Core::System& system_, bool use_nvdec_)
14 : GPU{system_, true, use_nvdec_}, gpu_thread{system_} {}
15
16GPUAsynch::~GPUAsynch() = default;
17
18void GPUAsynch::Start() {
19 gpu_thread.StartThread(*renderer, renderer->Context(), *dma_pusher, *cdma_pusher);
20 cpu_context = renderer->GetRenderWindow().CreateSharedContext();
21 cpu_context->MakeCurrent();
22}
23
24void GPUAsynch::ObtainContext() {
25 cpu_context->MakeCurrent();
26}
27
28void GPUAsynch::ReleaseContext() {
29 cpu_context->DoneCurrent();
30}
31
32void GPUAsynch::PushGPUEntries(Tegra::CommandList&& entries) {
33 gpu_thread.SubmitList(std::move(entries));
34}
35
36void 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
57void GPUAsynch::SwapBuffers(const Tegra::FramebufferConfig* framebuffer) {
58 gpu_thread.SwapBuffers(framebuffer);
59}
60
61void GPUAsynch::FlushRegion(VAddr addr, u64 size) {
62 gpu_thread.FlushRegion(addr, size);
63}
64
65void GPUAsynch::InvalidateRegion(VAddr addr, u64 size) {
66 gpu_thread.InvalidateRegion(addr, size);
67}
68
69void GPUAsynch::FlushAndInvalidateRegion(VAddr addr, u64 size) {
70 gpu_thread.FlushAndInvalidateRegion(addr, size);
71}
72
73void GPUAsynch::TriggerCpuInterrupt(const u32 syncpoint_id, const u32 value) const {
74 auto& interrupt_manager = system.InterruptManager();
75 interrupt_manager.GPUInterruptSyncpt(syncpoint_id, value);
76}
77
78void GPUAsynch::WaitIdle() const {
79 gpu_thread.WaitIdle();
80}
81
82void GPUAsynch::OnCommandListEnd() {
83 gpu_thread.OnCommandListEnd();
84}
85
86} // namespace VideoCommon