summaryrefslogtreecommitdiffstats
path: root/src/core/hardware_interrupt_manager.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2019-07-26 20:26:44 +0200
committerGitHub <noreply@github.com>2019-07-26 20:26:44 +0200
commit52f54c728d9691f113f0736fab8fbc60b408dceb (patch)
treee02db0d667f818aacbd27e54927ef91e875eb2c2 /src/core/hardware_interrupt_manager.cpp
parentMerge pull request #2739 from lioncash/cflow (diff)
parentNVServices: Correct delayed responses. (diff)
downloadyuzu-52f54c728d9691f113f0736fab8fbc60b408dceb.tar
yuzu-52f54c728d9691f113f0736fab8fbc60b408dceb.tar.gz
yuzu-52f54c728d9691f113f0736fab8fbc60b408dceb.tar.bz2
yuzu-52f54c728d9691f113f0736fab8fbc60b408dceb.tar.lz
yuzu-52f54c728d9691f113f0736fab8fbc60b408dceb.tar.xz
yuzu-52f54c728d9691f113f0736fab8fbc60b408dceb.tar.zst
yuzu-52f54c728d9691f113f0736fab8fbc60b408dceb.zip
Diffstat (limited to 'src/core/hardware_interrupt_manager.cpp')
-rw-r--r--src/core/hardware_interrupt_manager.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/core/hardware_interrupt_manager.cpp b/src/core/hardware_interrupt_manager.cpp
new file mode 100644
index 000000000..c2115db2d
--- /dev/null
+++ b/src/core/hardware_interrupt_manager.cpp
@@ -0,0 +1,30 @@
+// 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"
+
+namespace Core::Hardware {
+
+InterruptManager::InterruptManager(Core::System& system_in) : system(system_in) {
+ gpu_interrupt_event =
+ 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);
+ 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);
+}
+
+} // namespace Core::Hardware