blob: b1aaf46b6018031d085242dfecafe610fe3ff856 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: 2021 yuzu Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include <atomic>
#include <memory>
#include <mutex>
#include <vector>
#include "common/container/unordered_map.h"
#include "video_core/dma_pusher.h"
namespace Tegra {
class GPU;
namespace Control {
struct ChannelState;
class Scheduler {
public:
void Push(GPU& gpu, s32 channel, CommandList&& entries);
/// Runs channels whose pending semaphore acquire is now met.
void ResumePending(GPU& gpu);
[[nodiscard]] bool HasPendingChannels() const {
return !pending_channels.empty();
}
/// HasPendingChannels for threads other than the GPU thread.
[[nodiscard]] bool HasPendingChannelsAnyThread() const {
return any_pending.load(std::memory_order_acquire);
}
void DeclareChannel(std::shared_ptr<ChannelState> new_channel);
private:
void BindChannel(GPU& gpu, s32 bind_id);
::Common::unordered_map<s32, std::shared_ptr<ChannelState>> channels;
std::mutex scheduling_guard;
std::vector<std::shared_ptr<ChannelState>> pending_channels; ///< Suspended on an acquire
std::atomic<bool> any_pending{};
};
} // namespace Control
} // namespace Tegra
|