summaryrefslogtreecommitdiff
path: root/src/video_core/control/scheduler.cpp
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2021-11-05 15:52:31 +0100
committerGravatar Fernando Sahmkow2022-10-06 21:00:51 +0200
commit139ea93512aeead8a4aee3910a3de86eb109a838 (patch)
tree857643fc08617b7035656a51728c399f30c8c2cb /src/video_core/control/scheduler.cpp
parentNVASGPU: Fix Remap. (diff)
downloadyuzu-139ea93512aeead8a4aee3910a3de86eb109a838.tar.gz
yuzu-139ea93512aeead8a4aee3910a3de86eb109a838.tar.xz
yuzu-139ea93512aeead8a4aee3910a3de86eb109a838.zip
VideoCore: implement channels on gpu caches.
Diffstat (limited to 'src/video_core/control/scheduler.cpp')
-rw-r--r--src/video_core/control/scheduler.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/video_core/control/scheduler.cpp b/src/video_core/control/scheduler.cpp
new file mode 100644
index 000000000..e1abcb188
--- /dev/null
+++ b/src/video_core/control/scheduler.cpp
@@ -0,0 +1,31 @@
1// Copyright 2021 yuzu Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include <memory>
6
7#include "video_core/control/channel_state.h"
8#include "video_core/control/scheduler.h"
9#include "video_core/gpu.h"
10
11namespace Tegra::Control {
12Scheduler::Scheduler(GPU& gpu_) : gpu{gpu_} {}
13
14Scheduler::~Scheduler() = default;
15
16void Scheduler::Push(s32 channel, CommandList&& entries) {
17 std::unique_lock<std::mutex> lk(scheduling_guard);
18 auto it = channels.find(channel);
19 auto channel_state = it->second;
20 gpu.BindChannel(channel_state->bind_id);
21 channel_state->dma_pusher->Push(std::move(entries));
22 channel_state->dma_pusher->DispatchCalls();
23}
24
25void Scheduler::DeclareChannel(std::shared_ptr<ChannelState> new_channel) {
26 s32 channel = new_channel->bind_id;
27 std::unique_lock<std::mutex> lk(scheduling_guard);
28 channels.emplace(channel, new_channel);
29}
30
31} // namespace Tegra::Control