summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2019-06-19 02:53:21 +0200
committerFernandoS27 <fsahmkow27@gmail.com>2019-07-05 21:49:32 +0200
commitd20ede40b1e9cd0539982fb1feb3b13af3501ea2 (patch)
treea084fedd90a6a3cc3e11b099f4ddfe194d49c8ea
parentNVFlinger: Correct GCC compile error (diff)
downloadyuzu-d20ede40b1e9cd0539982fb1feb3b13af3501ea2.tar
yuzu-d20ede40b1e9cd0539982fb1feb3b13af3501ea2.tar.gz
yuzu-d20ede40b1e9cd0539982fb1feb3b13af3501ea2.tar.bz2
yuzu-d20ede40b1e9cd0539982fb1feb3b13af3501ea2.tar.lz
yuzu-d20ede40b1e9cd0539982fb1feb3b13af3501ea2.tar.xz
yuzu-d20ede40b1e9cd0539982fb1feb3b13af3501ea2.tar.zst
yuzu-d20ede40b1e9cd0539982fb1feb3b13af3501ea2.zip
-rw-r--r--src/core/hardware_interrupt_manager.cpp8
-rw-r--r--src/core/hardware_interrupt_manager.h15
-rw-r--r--src/core/hle/service/nvdrv/devices/nvdevice.h2
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp10
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_ctrl.h4
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp2
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h2
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp2
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_nvdec.h2
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_nvjpg.cpp2
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h2
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_vic.cpp2
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_vic.h2
-rw-r--r--src/core/hle/service/nvdrv/devices/nvmap.cpp2
-rw-r--r--src/core/hle/service/nvdrv/devices/nvmap.h2
-rw-r--r--src/core/hle/service/nvdrv/nvdrv.cpp4
-rw-r--r--src/core/hle/service/nvdrv/nvdrv.h16
-rw-r--r--src/core/hle/service/nvflinger/buffer_queue.cpp2
-rw-r--r--src/core/hle/service/nvflinger/nvflinger.cpp7
-rw-r--r--src/core/hle/service/nvflinger/nvflinger.h2
-rw-r--r--src/video_core/gpu.cpp25
-rw-r--r--src/video_core/gpu.h18
-rw-r--r--src/video_core/gpu_asynch.h2
-rw-r--r--src/video_core/gpu_synch.h3
24 files changed, 73 insertions, 65 deletions
diff --git a/src/core/hardware_interrupt_manager.cpp b/src/core/hardware_interrupt_manager.cpp
index c3fffa894..c2115db2d 100644
--- a/src/core/hardware_interrupt_manager.cpp
+++ b/src/core/hardware_interrupt_manager.cpp
@@ -1,5 +1,9 @@
+// Copyright 2019 Yuzu Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
#include "core/core.h"
+#include "core/core_timing.h"
#include "core/hardware_interrupt_manager.h"
#include "core/hle/service/nvdrv/interface.h"
#include "core/hle/service/sm/sm.h"
@@ -11,11 +15,13 @@ InterruptManager::InterruptManager(Core::System& system_in) : system(system_in)
system.CoreTiming().RegisterEvent("GPUInterrupt", [this](u64 message, s64) {
auto nvdrv = system.ServiceManager().GetService<Service::Nvidia::NVDRV>("nvdrv");
const u32 syncpt = static_cast<u32>(message >> 32);
- const u32 value = static_cast<u32>(message & 0x00000000FFFFFFFFULL);
+ const u32 value = static_cast<u32>(message);
nvdrv->SignalGPUInterruptSyncpt(syncpt, value);
});
}
+InterruptManager::~InterruptManager() = default;
+
void InterruptManager::GPUInterruptSyncpt(const u32 syncpoint_id, const u32 value) {
const u64 msg = (static_cast<u64>(syncpoint_id) << 32ULL) | value;
system.CoreTiming().ScheduleEvent(10, gpu_interrupt_event, msg);
diff --git a/src/core/hardware_interrupt_manager.h b/src/core/hardware_interrupt_manager.h
index 590392f75..494db883a 100644
--- a/src/core/hardware_interrupt_manager.h
+++ b/src/core/hardware_interrupt_manager.h
@@ -1,20 +1,27 @@
+// Copyright 2019 Yuzu Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
#pragma once
#include "common/common_types.h"
-#include "core/core_timing.h"
namespace Core {
class System;
}
+namespace Core::Timing {
+struct EventType;
+}
+
namespace Core::Hardware {
class InterruptManager {
public:
- InterruptManager(Core::System& system);
- ~InterruptManager() = default;
+ explicit InterruptManager(Core::System& system);
+ ~InterruptManager();
- void GPUInterruptSyncpt(const u32 syncpoint_id, const u32 value);
+ void GPUInterruptSyncpt(u32 syncpoint_id, u32 value);
private:
Core::System& system;
diff --git a/src/core/hle/service/nvdrv/devices/nvdevice.h b/src/core/hle/service/nvdrv/devices/nvdevice.h
index fae69eb19..5b8248433 100644
--- a/src/core/hle/service/nvdrv/devices/nvdevice.h
+++ b/src/core/hle/service/nvdrv/devices/nvdevice.h
@@ -20,7 +20,7 @@ namespace Service::Nvidia::Devices {
/// implement the ioctl interface.
class nvdevice {
public:
- nvdevice(Core::System& system) : system{system} {};
+ explicit nvdevice(Core::System& system) : system{system} {};
virtual ~nvdevice() = default;
union Ioctl {
u32_le raw;
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp
index a5a4f8c7b..749aa71d4 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp
@@ -15,7 +15,7 @@
namespace Service::Nvidia::Devices {
-nvhost_ctrl::nvhost_ctrl(Core::System& system, EventsInterface& events_interface)
+nvhost_ctrl::nvhost_ctrl(Core::System& system, EventInterface& events_interface)
: nvdevice(system), events_interface{events_interface} {}
nvhost_ctrl::~nvhost_ctrl() = default;
@@ -67,12 +67,11 @@ u32 nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector<u8>&
if (!gpu.IsAsync()) {
return NvResult::Success;
}
- gpu.Guard(true);
+ auto lock = gpu.LockSync();
u32 current_syncpoint_value = gpu.GetSyncpointValue(params.syncpt_id);
if (current_syncpoint_value >= params.threshold) {
params.value = current_syncpoint_value;
std::memcpy(output.data(), &params, sizeof(params));
- gpu.Guard(false);
return NvResult::Success;
}
@@ -82,7 +81,6 @@ u32 nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector<u8>&
if (params.timeout == 0) {
std::memcpy(output.data(), &params, sizeof(params));
- gpu.Guard(false);
return NvResult::Timeout;
}
@@ -91,7 +89,6 @@ u32 nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector<u8>&
event_id = params.value & 0x00FF;
if (event_id >= 64) {
std::memcpy(output.data(), &params, sizeof(params));
- gpu.Guard(false);
return NvResult::BadParameter;
}
} else {
@@ -119,15 +116,12 @@ u32 nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector<u8>&
ctrl.must_delay = true;
ctrl.timeout = params.timeout;
ctrl.event_id = event_id;
- gpu.Guard(false);
return NvResult::Timeout;
}
std::memcpy(output.data(), &params, sizeof(params));
- gpu.Guard(false);
return NvResult::Timeout;
}
std::memcpy(output.data(), &params, sizeof(params));
- gpu.Guard(false);
return NvResult::BadParameter;
}
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h
index 7cb41aa54..14e6e7e57 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h
+++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h
@@ -14,7 +14,7 @@ namespace Service::Nvidia::Devices {
class nvhost_ctrl final : public nvdevice {
public:
- nvhost_ctrl(Core::System& system, EventsInterface& events_interface);
+ explicit nvhost_ctrl(Core::System& system, EventInterface& events_interface);
~nvhost_ctrl() override;
u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output,
@@ -143,7 +143,7 @@ private:
u32 IocCtrlEventSignal(const std::vector<u8>& input, std::vector<u8>& output);
- EventsInterface& events_interface;
+ EventInterface& events_interface;
};
} // namespace Service::Nvidia::Devices
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp
index e3d2b4470..988effd90 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp
@@ -12,7 +12,7 @@
namespace Service::Nvidia::Devices {
-nvhost_ctrl_gpu::nvhost_ctrl_gpu(Core::System& system) : nvdevice(system){};
+nvhost_ctrl_gpu::nvhost_ctrl_gpu(Core::System& system) : nvdevice(system) {}
nvhost_ctrl_gpu::~nvhost_ctrl_gpu() = default;
u32 nvhost_ctrl_gpu::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output,
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h
index de36cb014..2b035ae3f 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h
+++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h
@@ -13,7 +13,7 @@ namespace Service::Nvidia::Devices {
class nvhost_ctrl_gpu final : public nvdevice {
public:
- nvhost_ctrl_gpu(Core::System& system);
+ explicit nvhost_ctrl_gpu(Core::System& system);
~nvhost_ctrl_gpu() override;
u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output,
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp
index f464328f3..f572ad30f 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp
@@ -10,7 +10,7 @@
namespace Service::Nvidia::Devices {
-nvhost_nvdec::nvhost_nvdec(Core::System& system) : nvdevice(system){};
+nvhost_nvdec::nvhost_nvdec(Core::System& system) : nvdevice(system) {}
nvhost_nvdec::~nvhost_nvdec() = default;
u32 nvhost_nvdec::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output,
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h
index c2b7a22f6..2710f0511 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h
+++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h
@@ -13,7 +13,7 @@ namespace Service::Nvidia::Devices {
class nvhost_nvdec final : public nvdevice {
public:
- nvhost_nvdec(Core::System& system);
+ explicit nvhost_nvdec(Core::System& system);
~nvhost_nvdec() override;
u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output,
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.cpp b/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.cpp
index d4d67fc72..38282956f 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.cpp
@@ -10,7 +10,7 @@
namespace Service::Nvidia::Devices {
-nvhost_nvjpg::nvhost_nvjpg(Core::System& system) : nvdevice(system){};
+nvhost_nvjpg::nvhost_nvjpg(Core::System& system) : nvdevice(system) {}
nvhost_nvjpg::~nvhost_nvjpg() = default;
u32 nvhost_nvjpg::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output,
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h b/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h
index 4bf280d67..379766693 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h
+++ b/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h
@@ -13,7 +13,7 @@ namespace Service::Nvidia::Devices {
class nvhost_nvjpg final : public nvdevice {
public:
- nvhost_nvjpg(Core::System& system);
+ explicit nvhost_nvjpg(Core::System& system);
~nvhost_nvjpg() override;
u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output,
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp b/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp
index 24e38d31a..70e8091db 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp
@@ -10,7 +10,7 @@
namespace Service::Nvidia::Devices {
-nvhost_vic::nvhost_vic(Core::System& system) : nvdevice(system){};
+nvhost_vic::nvhost_vic(Core::System& system) : nvdevice(system) {}
nvhost_vic::~nvhost_vic() = default;
u32 nvhost_vic::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output,
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_vic.h b/src/core/hle/service/nvdrv/devices/nvhost_vic.h
index 3d0934a78..7d111977e 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_vic.h
+++ b/src/core/hle/service/nvdrv/devices/nvhost_vic.h
@@ -13,7 +13,7 @@ namespace Service::Nvidia::Devices {
class nvhost_vic final : public nvdevice {
public:
- nvhost_vic(Core::System& system);
+ explicit nvhost_vic(Core::System& system);
~nvhost_vic() override;
u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output,
diff --git a/src/core/hle/service/nvdrv/devices/nvmap.cpp b/src/core/hle/service/nvdrv/devices/nvmap.cpp
index 349454685..223b496b7 100644
--- a/src/core/hle/service/nvdrv/devices/nvmap.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvmap.cpp
@@ -18,7 +18,7 @@ enum {
};
}
-nvmap::nvmap(Core::System& system) : nvdevice(system){};
+nvmap::nvmap(Core::System& system) : nvdevice(system) {}
nvmap::~nvmap() = default;
VAddr nvmap::GetObjectAddress(u32 handle) const {
diff --git a/src/core/hle/service/nvdrv/devices/nvmap.h b/src/core/hle/service/nvdrv/devices/nvmap.h
index b79ed736c..bf4a101c2 100644
--- a/src/core/hle/service/nvdrv/devices/nvmap.h
+++ b/src/core/hle/service/nvdrv/devices/nvmap.h
@@ -16,7 +16,7 @@ namespace Service::Nvidia::Devices {
class nvmap final : public nvdevice {
public:
- nvmap(Core::System& system);
+ explicit nvmap(Core::System& system);
~nvmap() override;
/// Returns the allocated address of an nvmap object given its handle.
diff --git a/src/core/hle/service/nvdrv/nvdrv.cpp b/src/core/hle/service/nvdrv/nvdrv.cpp
index 8958e21e3..2011a226a 100644
--- a/src/core/hle/service/nvdrv/nvdrv.cpp
+++ b/src/core/hle/service/nvdrv/nvdrv.cpp
@@ -100,11 +100,11 @@ void Module::SignalSyncpt(const u32 syncpoint_id, const u32 value) {
}
}
-Kernel::SharedPtr<Kernel::ReadableEvent> Module::GetEvent(const u32 event_id) {
+Kernel::SharedPtr<Kernel::ReadableEvent> Module::GetEvent(const u32 event_id) const {
return events_interface.events[event_id].readable;
}
-Kernel::SharedPtr<Kernel::WritableEvent> Module::GetEventWriteable(const u32 event_id) {
+Kernel::SharedPtr<Kernel::WritableEvent> Module::GetEventWriteable(const u32 event_id) const {
return events_interface.events[event_id].writable;
}
diff --git a/src/core/hle/service/nvdrv/nvdrv.h b/src/core/hle/service/nvdrv/nvdrv.h
index b7f692962..8f7c59a21 100644
--- a/src/core/hle/service/nvdrv/nvdrv.h
+++ b/src/core/hle/service/nvdrv/nvdrv.h
@@ -26,14 +26,15 @@ namespace Devices {
class nvdevice;
}
-struct EventsInterface {
+struct EventInterface {
u64 events_mask{};
std::array<Kernel::EventPair, MaxNvEvents> events;
std::array<EventState, MaxNvEvents> status{};
std::array<bool, MaxNvEvents> registered{};
std::array<u32, MaxNvEvents> assigned_syncpt{};
std::array<u32, MaxNvEvents> assigned_value{};
- u32 GetFreeEvent() {
+ static constexpr u32 null_event = 0xFFFFFFFF;
+ u32 GetFreeEvent() const {
u64 mask = events_mask;
for (u32 i = 0; i < MaxNvEvents; i++) {
const bool is_free = (mask & 0x1) == 0;
@@ -44,12 +45,13 @@ struct EventsInterface {
}
mask = mask >> 1;
}
- return 0xFFFFFFFF;
+ return null_event;
}
void SetEventStatus(const u32 event_id, EventState new_status) {
EventState old_status = status[event_id];
- if (old_status == new_status)
+ if (old_status == new_status) {
return;
+ }
status[event_id] = new_status;
if (new_status == EventState::Registered) {
registered[event_id] = true;
@@ -102,9 +104,9 @@ public:
void SignalSyncpt(const u32 syncpoint_id, const u32 value);
- Kernel::SharedPtr<Kernel::ReadableEvent> GetEvent(const u32 event_id);
+ Kernel::SharedPtr<Kernel::ReadableEvent> GetEvent(u32 event_id) const;
- Kernel::SharedPtr<Kernel::WritableEvent> GetEventWriteable(const u32 event_id);
+ Kernel::SharedPtr<Kernel::WritableEvent> GetEventWriteable(u32 event_id) const;
private:
/// Id to use for the next open file descriptor.
@@ -116,7 +118,7 @@ private:
/// Mapping of device node names to their implementation.
std::unordered_map<std::string, std::shared_ptr<Devices::nvdevice>> devices;
- EventsInterface events_interface;
+ EventInterface events_interface;
};
/// Registers all NVDRV services with the specified service manager.
diff --git a/src/core/hle/service/nvflinger/buffer_queue.cpp b/src/core/hle/service/nvflinger/buffer_queue.cpp
index d8aa3f1c0..ddc224f2c 100644
--- a/src/core/hle/service/nvflinger/buffer_queue.cpp
+++ b/src/core/hle/service/nvflinger/buffer_queue.cpp
@@ -79,7 +79,7 @@ void BufferQueue::QueueBuffer(u32 slot, BufferTransformFlags transform,
}
std::optional<std::reference_wrapper<const BufferQueue::Buffer>> BufferQueue::AcquireBuffer() {
- std::vector<Buffer>::iterator itr = queue.end();
+ auto itr = queue.end();
while (itr == queue.end() && !queue_sequence.empty()) {
u32 slot = queue_sequence.front();
itr = std::find_if(queue.begin(), queue.end(), [&slot](const Buffer& buffer) {
diff --git a/src/core/hle/service/nvflinger/nvflinger.cpp b/src/core/hle/service/nvflinger/nvflinger.cpp
index 70441f6a2..f9db79370 100644
--- a/src/core/hle/service/nvflinger/nvflinger.cpp
+++ b/src/core/hle/service/nvflinger/nvflinger.cpp
@@ -37,8 +37,6 @@ NVFlinger::NVFlinger(Core::Timing::CoreTiming& core_timing) : core_timing{core_t
displays.emplace_back(4, "Null");
// Schedule the screen composition events
- // const auto ticks = Settings::values.force_30fps_mode ? frame_ticks_30fps : frame_ticks;
-
composition_event = core_timing.RegisterEvent("ScreenComposition", [this](u64 userdata,
s64 cycles_late) {
Compose();
@@ -212,8 +210,9 @@ void NVFlinger::Compose() {
}
}
-s64 NVFlinger::GetNextTicks() {
- return (Core::Timing::BASE_CLOCK_RATE * (1LL << swap_interval)) / 120;
+s64 NVFlinger::GetNextTicks() const {
+ constexpr s64 max_hertz = 120LL;
+ return (Core::Timing::BASE_CLOCK_RATE * (1LL << swap_interval)) / max_hertz;
}
} // namespace Service::NVFlinger
diff --git a/src/core/hle/service/nvflinger/nvflinger.h b/src/core/hle/service/nvflinger/nvflinger.h
index 86b94302c..988be8726 100644
--- a/src/core/hle/service/nvflinger/nvflinger.h
+++ b/src/core/hle/service/nvflinger/nvflinger.h
@@ -74,7 +74,7 @@ public:
/// finished.
void Compose();
- s64 GetNextTicks();
+ s64 GetNextTicks() const;
private:
/// Finds the display identified by the specified ID.
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp
index 278528618..da8c715b6 100644
--- a/src/video_core/gpu.cpp
+++ b/src/video_core/gpu.cpp
@@ -89,24 +89,27 @@ u32 GPU::GetSyncpointValue(const u32 syncpoint_id) const {
}
void GPU::RegisterSyncptInterrupt(const u32 syncpoint_id, const u32 value) {
- for (u32 in_value : syncpt_interrupts[syncpoint_id]) {
- if (in_value == value)
- return;
+ auto& interrupt = syncpt_interrupts[syncpoint_id];
+ bool contains = std::any_of(interrupt.begin(), interrupt.end(),
+ [value](u32 in_value) { return in_value == value; });
+ if (contains) {
+ return;
}
syncpt_interrupts[syncpoint_id].emplace_back(value);
}
bool GPU::CancelSyncptInterrupt(const u32 syncpoint_id, const u32 value) {
std::lock_guard lock{sync_mutex};
- auto it = syncpt_interrupts[syncpoint_id].begin();
- while (it != syncpt_interrupts[syncpoint_id].end()) {
- if (value == *it) {
- it = syncpt_interrupts[syncpoint_id].erase(it);
- return true;
- }
- it++;
+ auto& interrupt = syncpt_interrupts[syncpoint_id];
+ const auto iter =
+ std::find_if(interrupt.begin(), interrupt.end(),
+ [value](u32 interrupt_value) { return value == interrupt_value; });
+
+ if (iter == interrupt.end()) {
+ return false;
}
- return false;
+ interrupt.erase(iter);
+ return true;
}
u32 RenderTargetBytesPerPixel(RenderTargetFormat format) {
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h
index 94afc91f8..334dec48c 100644
--- a/src/video_core/gpu.h
+++ b/src/video_core/gpu.h
@@ -168,20 +168,16 @@ public:
/// Returns a reference to the GPU DMA pusher.
Tegra::DmaPusher& DmaPusher();
- void IncrementSyncPoint(const u32 syncpoint_id);
+ void IncrementSyncPoint(u32 syncpoint_id);
- u32 GetSyncpointValue(const u32 syncpoint_id) const;
+ u32 GetSyncpointValue(u32 syncpoint_id) const;
- void RegisterSyncptInterrupt(const u32 syncpoint_id, const u32 value);
+ void RegisterSyncptInterrupt(u32 syncpoint_id, u32 value);
- bool CancelSyncptInterrupt(const u32 syncpoint_id, const u32 value);
+ bool CancelSyncptInterrupt(u32 syncpoint_id, u32 value);
- void Guard(bool guard_set) {
- if (guard_set) {
- sync_mutex.lock();
- } else {
- sync_mutex.unlock();
- }
+ std::unique_lock<std::mutex> LockSync() {
+ return std::unique_lock{sync_mutex};
}
bool IsAsync() const {
@@ -253,7 +249,7 @@ public:
virtual void FlushAndInvalidateRegion(CacheAddr addr, u64 size) = 0;
protected:
- virtual void TriggerCpuInterrupt(const u32 syncpoint_id, const u32 value) const = 0;
+ virtual void TriggerCpuInterrupt(u32 syncpoint_id, u32 value) const = 0;
private:
void ProcessBindMethod(const MethodCall& method_call);
diff --git a/src/video_core/gpu_asynch.h b/src/video_core/gpu_asynch.h
index 5f1b2fb7d..36377d677 100644
--- a/src/video_core/gpu_asynch.h
+++ b/src/video_core/gpu_asynch.h
@@ -28,7 +28,7 @@ public:
void FlushAndInvalidateRegion(CacheAddr addr, u64 size) override;
protected:
- void TriggerCpuInterrupt(const u32 syncpoint_id, const u32 value) const override;
+ void TriggerCpuInterrupt(u32 syncpoint_id, u32 value) const override;
private:
GPUThread::ThreadManager gpu_thread;
diff --git a/src/video_core/gpu_synch.h b/src/video_core/gpu_synch.h
index 58d258503..07bcc47f1 100644
--- a/src/video_core/gpu_synch.h
+++ b/src/video_core/gpu_synch.h
@@ -27,7 +27,8 @@ public:
void FlushAndInvalidateRegion(CacheAddr addr, u64 size) override;
protected:
- void TriggerCpuInterrupt(const u32 syncpoint_id, const u32 value) const override {}
+ void TriggerCpuInterrupt([[maybe_unused]] u32 syncpoint_id,
+ [[maybe_unused]] u32 value) const override {}
};
} // namespace VideoCommon