summaryrefslogtreecommitdiffstats
path: root/src/video_core
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/control/channel_state.cpp7
-rw-r--r--src/video_core/control/channel_state.h4
-rw-r--r--src/video_core/control/channel_state_cache.h2
-rw-r--r--src/video_core/control/scheduler.cpp6
-rw-r--r--src/video_core/control/scheduler.h2
-rw-r--r--src/video_core/engines/maxwell_dma.h2
-rw-r--r--src/video_core/gpu.cpp2
-rw-r--r--src/video_core/host1x/host1x.h2
-rw-r--r--src/video_core/host1x/syncpoint_manager.cpp12
-rw-r--r--src/video_core/host1x/syncpoint_manager.h24
-rw-r--r--src/video_core/memory_manager.h2
11 files changed, 32 insertions, 33 deletions
diff --git a/src/video_core/control/channel_state.cpp b/src/video_core/control/channel_state.cpp
index b04922ac0..cdecc3a91 100644
--- a/src/video_core/control/channel_state.cpp
+++ b/src/video_core/control/channel_state.cpp
@@ -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) {
diff --git a/src/video_core/control/channel_state.h b/src/video_core/control/channel_state.h
index 305b21cba..3a7b9872c 100644
--- a/src/video_core/control/channel_state.h
+++ b/src/video_core/control/channel_state.h
@@ -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
diff --git a/src/video_core/control/channel_state_cache.h b/src/video_core/control/channel_state_cache.h
index 5246192a8..584a0c26c 100644
--- a/src/video_core/control/channel_state_cache.h
+++ b/src/video_core/control/channel_state_cache.h
@@ -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;
diff --git a/src/video_core/control/scheduler.cpp b/src/video_core/control/scheduler.cpp
index 733042690..f7cbe204e 100644
--- a/src/video_core/control/scheduler.cpp
+++ b/src/video_core/control/scheduler.cpp
@@ -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);
}
diff --git a/src/video_core/control/scheduler.h b/src/video_core/control/scheduler.h
index 305a01e0a..44addf61c 100644
--- a/src/video_core/control/scheduler.h
+++ b/src/video_core/control/scheduler.h
@@ -19,7 +19,7 @@ struct ChannelState;
class Scheduler {
public:
- Scheduler(GPU& gpu_);
+ explicit Scheduler(GPU& gpu_);
~Scheduler();
void Push(s32 channel, CommandList&& entries);
diff --git a/src/video_core/engines/maxwell_dma.h b/src/video_core/engines/maxwell_dma.h
index 9c5d567a6..bc48320ce 100644
--- a/src/video_core/engines/maxwell_dma.h
+++ b/src/video_core/engines/maxwell_dma.h
@@ -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);
}
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp
index d7a3dd96b..28b38273e 100644
--- a/src/video_core/gpu.cpp
+++ b/src/video_core/gpu.cpp
@@ -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;
diff --git a/src/video_core/host1x/host1x.h b/src/video_core/host1x/host1x.h
index 7ecf853d9..57082ae54 100644
--- a/src/video_core/host1x/host1x.h
+++ b/src/video_core/host1x/host1x.h
@@ -19,7 +19,7 @@ namespace Host1x {
class Host1x {
public:
- Host1x(Core::System& system);
+ explicit Host1x(Core::System& system);
SyncpointManager& GetSyncpointManager() {
return syncpoint_manager;
diff --git a/src/video_core/host1x/syncpoint_manager.cpp b/src/video_core/host1x/syncpoint_manager.cpp
index 4471bacae..326e8355a 100644
--- a/src/video_core/host1x/syncpoint_manager.cpp
+++ b/src/video_core/host1x/syncpoint_manager.cpp
@@ -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);
}
diff --git a/src/video_core/host1x/syncpoint_manager.h b/src/video_core/host1x/syncpoint_manager.h
index 72220a09a..50a264e23 100644
--- a/src/video_core/host1x/syncpoint_manager.h
+++ b/src/video_core/host1x/syncpoint_manager.h
@@ -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);
diff --git a/src/video_core/memory_manager.h b/src/video_core/memory_manager.h
index ae4fd98df..f992e29f3 100644
--- a/src/video_core/memory_manager.h
+++ b/src/video_core/memory_manager.h
@@ -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 {