aboutsummaryrefslogtreecommitdiff
path: root/src/video_core/control/scheduler.cpp
diff options
context:
space:
mode:
authorDjihads <76681596+Djihads80@users.noreply.github.com>2026-10-29 02:25:36 +0100
committerGitHub <noreply@github.com>2026-10-29 02:25:36 +0100
commit0bb5055b6541c74f47603a8dff0569a509cbaf18 (patch)
treeda827ff9c4f2f9a5309ee2804ee689f608c0ac2f /src/video_core/control/scheduler.cpp
parent1af7fe72927af9fc64aa4af117bc9b30043c4dc7 (diff)
parent535b6769709eb22333af26269f1b16f37adce4db (diff)
Merge pull request #1 from Djihads80/yumekiru/ns2-progress-v2
Experimental NS2 support and accumulated GPU fixes
Diffstat (limited to 'src/video_core/control/scheduler.cpp')
-rw-r--r--src/video_core/control/scheduler.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/video_core/control/scheduler.cpp b/src/video_core/control/scheduler.cpp
index 8af13e415c..5f8a830c83 100644
--- a/src/video_core/control/scheduler.cpp
+++ b/src/video_core/control/scheduler.cpp
@@ -4,7 +4,9 @@
// SPDX-FileCopyrightText: 2021 yuzu Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
+#include <algorithm>
#include <memory>
+#include <vector>
#include "common/assert.h"
#include "video_core/control/channel_state.h"
@@ -26,6 +28,26 @@ void Scheduler::Push(GPU& gpu, s32 channel, CommandList&& entries) {
// Multiple channels can prepare their commands in parallel.
channel_state->payload->dma_pusher.Push(std::move(entries));
channel_state->payload->dma_pusher.DispatchCalls();
+ if (channel_state->payload->dma_pusher.HasPendingNativeAcquire() &&
+ std::find(pending_native_channels.begin(), pending_native_channels.end(), channel_state) == pending_native_channels.end()) {
+ pending_native_channels.push_back(channel_state);
+ }
+ if (!pending_native_channels.empty()) ResumePending(gpu);
+}
+
+void Scheduler::ResumePending(GPU& gpu) {
+ ResumeReadyNativeChannels(pending_native_channels,
+ [](const auto& state) { return state->payload->dma_pusher.HasPendingNativeAcquire() &&
+ state->payload->dma_pusher.CanResumeNativeAcquire(); },
+ [&](const auto& state) {
+ {
+ std::scoped_lock lock{scheduling_guard};
+ gpu.BindChannel(state->bind_id);
+ }
+ state->payload->dma_pusher.DispatchCalls();
+ });
+ std::erase_if(pending_native_channels,
+ [](const auto& state) { return !state->payload->dma_pusher.HasPendingNativeAcquire(); });
}
void Scheduler::DeclareChannel(std::shared_ptr<ChannelState> new_channel) {