diff options
Diffstat (limited to 'src/video_core/control/scheduler.cpp')
| -rw-r--r-- | src/video_core/control/scheduler.cpp | 32 |
1 files changed, 32 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..f7cbe204e --- /dev/null +++ b/src/video_core/control/scheduler.cpp | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | // SPDX-FileCopyrightText: 2021 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-3.0-or-later | ||
| 3 | |||
| 4 | #include <memory> | ||
| 5 | |||
| 6 | #include "common/assert.h" | ||
| 7 | #include "video_core/control/channel_state.h" | ||
| 8 | #include "video_core/control/scheduler.h" | ||
| 9 | #include "video_core/gpu.h" | ||
| 10 | |||
| 11 | namespace Tegra::Control { | ||
| 12 | Scheduler::Scheduler(GPU& gpu_) : gpu{gpu_} {} | ||
| 13 | |||
| 14 | Scheduler::~Scheduler() = default; | ||
| 15 | |||
| 16 | void Scheduler::Push(s32 channel, CommandList&& entries) { | ||
| 17 | std::unique_lock lk(scheduling_guard); | ||
| 18 | auto it = channels.find(channel); | ||
| 19 | ASSERT(it != channels.end()); | ||
| 20 | auto channel_state = it->second; | ||
| 21 | gpu.BindChannel(channel_state->bind_id); | ||
| 22 | channel_state->dma_pusher->Push(std::move(entries)); | ||
| 23 | channel_state->dma_pusher->DispatchCalls(); | ||
| 24 | } | ||
| 25 | |||
| 26 | void Scheduler::DeclareChannel(std::shared_ptr<ChannelState> new_channel) { | ||
| 27 | s32 channel = new_channel->bind_id; | ||
| 28 | std::unique_lock lk(scheduling_guard); | ||
| 29 | channels.emplace(channel, new_channel); | ||
| 30 | } | ||
| 31 | |||
| 32 | } // namespace Tegra::Control | ||