General: address feedback
This commit is contained in:
parent
0d99b7962d
commit
ca3db0d7c9
30 changed files with 167 additions and 165 deletions
|
@ -14,10 +14,7 @@
|
|||
|
||||
namespace Tegra::Control {
|
||||
|
||||
ChannelState::ChannelState(s32 bind_id_) {
|
||||
bind_id = bind_id_;
|
||||
initiated = false;
|
||||
}
|
||||
ChannelState::ChannelState(s32 bind_id_) : bind_id{bind_id_}, initialized{} {}
|
||||
|
||||
void ChannelState::Init(Core::System& system, GPU& gpu) {
|
||||
ASSERT(memory_manager);
|
||||
|
@ -27,7 +24,7 @@ void ChannelState::Init(Core::System& system, GPU& gpu) {
|
|||
kepler_compute = std::make_unique<Engines::KeplerCompute>(system, *memory_manager);
|
||||
maxwell_dma = std::make_unique<Engines::MaxwellDMA>(system, *memory_manager);
|
||||
kepler_memory = std::make_unique<Engines::KeplerMemory>(system, *memory_manager);
|
||||
initiated = true;
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
void ChannelState::BindRasterizer(VideoCore::RasterizerInterface* rasterizer) {
|
||||
|
|
|
@ -34,7 +34,7 @@ class DmaPusher;
|
|||
namespace Control {
|
||||
|
||||
struct ChannelState {
|
||||
ChannelState(s32 bind_id);
|
||||
explicit ChannelState(s32 bind_id);
|
||||
ChannelState(const ChannelState& state) = delete;
|
||||
ChannelState& operator=(const ChannelState&) = delete;
|
||||
ChannelState(ChannelState&& other) noexcept = default;
|
||||
|
@ -60,7 +60,7 @@ struct ChannelState {
|
|||
|
||||
std::unique_ptr<DmaPusher> dma_pusher;
|
||||
|
||||
bool initiated{};
|
||||
bool initialized{};
|
||||
};
|
||||
|
||||
} // namespace Control
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace VideoCommon {
|
|||
class ChannelInfo {
|
||||
public:
|
||||
ChannelInfo() = delete;
|
||||
ChannelInfo(Tegra::Control::ChannelState& state);
|
||||
explicit ChannelInfo(Tegra::Control::ChannelState& state);
|
||||
ChannelInfo(const ChannelInfo& state) = delete;
|
||||
ChannelInfo& operator=(const ChannelInfo&) = delete;
|
||||
ChannelInfo(ChannelInfo&& other) = default;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include <memory>
|
||||
|
||||
#include "common/assert.h"
|
||||
#include "video_core/control/channel_state.h"
|
||||
#include "video_core/control/scheduler.h"
|
||||
#include "video_core/gpu.h"
|
||||
|
@ -13,8 +14,9 @@ Scheduler::Scheduler(GPU& gpu_) : gpu{gpu_} {}
|
|||
Scheduler::~Scheduler() = default;
|
||||
|
||||
void Scheduler::Push(s32 channel, CommandList&& entries) {
|
||||
std::unique_lock<std::mutex> lk(scheduling_guard);
|
||||
std::unique_lock lk(scheduling_guard);
|
||||
auto it = channels.find(channel);
|
||||
ASSERT(it != channels.end());
|
||||
auto channel_state = it->second;
|
||||
gpu.BindChannel(channel_state->bind_id);
|
||||
channel_state->dma_pusher->Push(std::move(entries));
|
||||
|
@ -23,7 +25,7 @@ void Scheduler::Push(s32 channel, CommandList&& entries) {
|
|||
|
||||
void Scheduler::DeclareChannel(std::shared_ptr<ChannelState> new_channel) {
|
||||
s32 channel = new_channel->bind_id;
|
||||
std::unique_lock<std::mutex> lk(scheduling_guard);
|
||||
std::unique_lock lk(scheduling_guard);
|
||||
channels.emplace(channel, new_channel);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ struct ChannelState;
|
|||
|
||||
class Scheduler {
|
||||
public:
|
||||
Scheduler(GPU& gpu_);
|
||||
explicit Scheduler(GPU& gpu_);
|
||||
~Scheduler();
|
||||
|
||||
void Push(s32 channel, CommandList&& entries);
|
||||
|
|
|
@ -195,7 +195,7 @@ public:
|
|||
BitField<24, 2, u32> num_dst_components_minus_one;
|
||||
};
|
||||
|
||||
Swizzle GetComponent(size_t i) {
|
||||
Swizzle GetComponent(size_t i) const {
|
||||
const u32 raw = dst_components_raw;
|
||||
return static_cast<Swizzle>((raw >> (i * 3)) & 0x7);
|
||||
}
|
||||
|
|
|
@ -355,7 +355,7 @@ struct GPU::Impl {
|
|||
|
||||
std::condition_variable sync_cv;
|
||||
|
||||
std::list<std::function<void(void)>> sync_requests;
|
||||
std::list<std::function<void()>> sync_requests;
|
||||
std::atomic<u64> current_sync_fence{};
|
||||
u64 last_sync_fence{};
|
||||
std::mutex sync_request_mutex;
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace Host1x {
|
|||
|
||||
class Host1x {
|
||||
public:
|
||||
Host1x(Core::System& system);
|
||||
explicit Host1x(Core::System& system);
|
||||
|
||||
SyncpointManager& GetSyncpointManager() {
|
||||
return syncpoint_manager;
|
||||
|
|
|
@ -12,13 +12,13 @@ MICROPROFILE_DEFINE(GPU_wait, "GPU", "Wait for the GPU", MP_RGB(128, 128, 192));
|
|||
|
||||
SyncpointManager::ActionHandle SyncpointManager::RegisterAction(
|
||||
std::atomic<u32>& syncpoint, std::list<RegisteredAction>& action_storage, u32 expected_value,
|
||||
std::function<void(void)>& action) {
|
||||
std::function<void()>&& action) {
|
||||
if (syncpoint.load(std::memory_order_acquire) >= expected_value) {
|
||||
action();
|
||||
return {};
|
||||
}
|
||||
|
||||
std::unique_lock<std::mutex> lk(guard);
|
||||
std::unique_lock lk(guard);
|
||||
if (syncpoint.load(std::memory_order_relaxed) >= expected_value) {
|
||||
action();
|
||||
return {};
|
||||
|
@ -30,12 +30,12 @@ SyncpointManager::ActionHandle SyncpointManager::RegisterAction(
|
|||
}
|
||||
++it;
|
||||
}
|
||||
return action_storage.emplace(it, expected_value, action);
|
||||
return action_storage.emplace(it, expected_value, std::move(action));
|
||||
}
|
||||
|
||||
void SyncpointManager::DeregisterAction(std::list<RegisteredAction>& action_storage,
|
||||
ActionHandle& handle) {
|
||||
std::unique_lock<std::mutex> lk(guard);
|
||||
std::unique_lock lk(guard);
|
||||
action_storage.erase(handle);
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ void SyncpointManager::Increment(std::atomic<u32>& syncpoint, std::condition_var
|
|||
std::list<RegisteredAction>& action_storage) {
|
||||
auto new_value{syncpoint.fetch_add(1, std::memory_order_acq_rel) + 1};
|
||||
|
||||
std::unique_lock<std::mutex> lk(guard);
|
||||
std::unique_lock lk(guard);
|
||||
auto it = action_storage.begin();
|
||||
while (it != action_storage.end()) {
|
||||
if (it->expected_value > new_value) {
|
||||
|
@ -87,7 +87,7 @@ void SyncpointManager::Wait(std::atomic<u32>& syncpoint, std::condition_variable
|
|||
return;
|
||||
}
|
||||
|
||||
std::unique_lock<std::mutex> lk(guard);
|
||||
std::unique_lock lk(guard);
|
||||
wait_cv.wait(lk, pred);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,34 +18,34 @@ namespace Host1x {
|
|||
|
||||
class SyncpointManager {
|
||||
public:
|
||||
u32 GetGuestSyncpointValue(u32 id) {
|
||||
u32 GetGuestSyncpointValue(u32 id) const {
|
||||
return syncpoints_guest[id].load(std::memory_order_acquire);
|
||||
}
|
||||
|
||||
u32 GetHostSyncpointValue(u32 id) {
|
||||
u32 GetHostSyncpointValue(u32 id) const {
|
||||
return syncpoints_host[id].load(std::memory_order_acquire);
|
||||
}
|
||||
|
||||
struct RegisteredAction {
|
||||
RegisteredAction(u32 expected_value_, std::function<void(void)>& action_)
|
||||
: expected_value{expected_value_}, action{action_} {}
|
||||
explicit RegisteredAction(u32 expected_value_, std::function<void()>&& action_)
|
||||
: expected_value{expected_value_}, action{std::move(action_)} {}
|
||||
u32 expected_value;
|
||||
std::function<void(void)> action;
|
||||
std::function<void()> action;
|
||||
};
|
||||
using ActionHandle = std::list<RegisteredAction>::iterator;
|
||||
|
||||
template <typename Func>
|
||||
ActionHandle RegisterGuestAction(u32 syncpoint_id, u32 expected_value, Func&& action) {
|
||||
std::function<void(void)> func(action);
|
||||
std::function<void()> func(action);
|
||||
return RegisterAction(syncpoints_guest[syncpoint_id], guest_action_storage[syncpoint_id],
|
||||
expected_value, func);
|
||||
expected_value, std::move(func));
|
||||
}
|
||||
|
||||
template <typename Func>
|
||||
ActionHandle RegisterHostAction(u32 syncpoint_id, u32 expected_value, Func&& action) {
|
||||
std::function<void(void)> func(action);
|
||||
std::function<void()> func(action);
|
||||
return RegisterAction(syncpoints_host[syncpoint_id], host_action_storage[syncpoint_id],
|
||||
expected_value, func);
|
||||
expected_value, std::move(func));
|
||||
}
|
||||
|
||||
void DeregisterGuestAction(u32 syncpoint_id, ActionHandle& handle);
|
||||
|
@ -60,11 +60,11 @@ public:
|
|||
|
||||
void WaitHost(u32 syncpoint_id, u32 expected_value);
|
||||
|
||||
bool IsReadyGuest(u32 syncpoint_id, u32 expected_value) {
|
||||
bool IsReadyGuest(u32 syncpoint_id, u32 expected_value) const {
|
||||
return syncpoints_guest[syncpoint_id].load(std::memory_order_acquire) >= expected_value;
|
||||
}
|
||||
|
||||
bool IsReadyHost(u32 syncpoint_id, u32 expected_value) {
|
||||
bool IsReadyHost(u32 syncpoint_id, u32 expected_value) const {
|
||||
return syncpoints_host[syncpoint_id].load(std::memory_order_acquire) >= expected_value;
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ private:
|
|||
|
||||
ActionHandle RegisterAction(std::atomic<u32>& syncpoint,
|
||||
std::list<RegisteredAction>& action_storage, u32 expected_value,
|
||||
std::function<void(void)>& action);
|
||||
std::function<void()>&& action);
|
||||
|
||||
void DeregisterAction(std::list<RegisteredAction>& action_storage, ActionHandle& handle);
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ private:
|
|||
void WriteBlockImpl(GPUVAddr gpu_dest_addr, const void* src_buffer, std::size_t size);
|
||||
|
||||
template <bool is_big_page>
|
||||
[[nodiscard]] inline std::size_t PageEntryIndex(GPUVAddr gpu_addr) const {
|
||||
[[nodiscard]] std::size_t PageEntryIndex(GPUVAddr gpu_addr) const {
|
||||
if constexpr (is_big_page) {
|
||||
return (gpu_addr >> big_page_bits) & big_page_table_mask;
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue