yuzu-emu
/
yuzu
Archived
1
0
Fork 0

Merge pull request #9354 from lioncash/const-param

host1x/syncpoint_manager: Pass DeregisterAction() handle as const-ref
This commit is contained in:
liamwhite 2022-11-29 18:45:05 -05:00 committed by GitHub
commit 1a6785d296
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 10 deletions

View File

@ -34,7 +34,7 @@ SyncpointManager::ActionHandle SyncpointManager::RegisterAction(
} }
void SyncpointManager::DeregisterAction(std::list<RegisteredAction>& action_storage, void SyncpointManager::DeregisterAction(std::list<RegisteredAction>& action_storage,
ActionHandle& handle) { const ActionHandle& handle) {
std::unique_lock lk(guard); std::unique_lock lk(guard);
// We want to ensure the iterator still exists prior to erasing it // We want to ensure the iterator still exists prior to erasing it
@ -49,11 +49,11 @@ void SyncpointManager::DeregisterAction(std::list<RegisteredAction>& action_stor
} }
} }
void SyncpointManager::DeregisterGuestAction(u32 syncpoint_id, ActionHandle& handle) { void SyncpointManager::DeregisterGuestAction(u32 syncpoint_id, const ActionHandle& handle) {
DeregisterAction(guest_action_storage[syncpoint_id], handle); DeregisterAction(guest_action_storage[syncpoint_id], handle);
} }
void SyncpointManager::DeregisterHostAction(u32 syncpoint_id, ActionHandle& handle) { void SyncpointManager::DeregisterHostAction(u32 syncpoint_id, const ActionHandle& handle) {
DeregisterAction(host_action_storage[syncpoint_id], handle); DeregisterAction(host_action_storage[syncpoint_id], handle);
} }

View File

@ -36,21 +36,19 @@ public:
template <typename Func> template <typename Func>
ActionHandle RegisterGuestAction(u32 syncpoint_id, u32 expected_value, Func&& action) { ActionHandle RegisterGuestAction(u32 syncpoint_id, u32 expected_value, Func&& action) {
std::function<void()> func(action);
return RegisterAction(syncpoints_guest[syncpoint_id], guest_action_storage[syncpoint_id], return RegisterAction(syncpoints_guest[syncpoint_id], guest_action_storage[syncpoint_id],
expected_value, std::move(func)); expected_value, std::move(action));
} }
template <typename Func> template <typename Func>
ActionHandle RegisterHostAction(u32 syncpoint_id, u32 expected_value, Func&& action) { ActionHandle RegisterHostAction(u32 syncpoint_id, u32 expected_value, Func&& action) {
std::function<void()> func(action);
return RegisterAction(syncpoints_host[syncpoint_id], host_action_storage[syncpoint_id], return RegisterAction(syncpoints_host[syncpoint_id], host_action_storage[syncpoint_id],
expected_value, std::move(func)); expected_value, std::move(action));
} }
void DeregisterGuestAction(u32 syncpoint_id, ActionHandle& handle); void DeregisterGuestAction(u32 syncpoint_id, const ActionHandle& handle);
void DeregisterHostAction(u32 syncpoint_id, ActionHandle& handle); void DeregisterHostAction(u32 syncpoint_id, const ActionHandle& handle);
void IncrementGuest(u32 syncpoint_id); void IncrementGuest(u32 syncpoint_id);
@ -76,7 +74,7 @@ private:
std::list<RegisteredAction>& action_storage, u32 expected_value, std::list<RegisteredAction>& action_storage, u32 expected_value,
std::function<void()>&& action); std::function<void()>&& action);
void DeregisterAction(std::list<RegisteredAction>& action_storage, ActionHandle& handle); void DeregisterAction(std::list<RegisteredAction>& action_storage, const ActionHandle& handle);
void Wait(std::atomic<u32>& syncpoint, std::condition_variable& wait_cv, u32 expected_value); void Wait(std::atomic<u32>& syncpoint, std::condition_variable& wait_cv, u32 expected_value);