2019-06-19 03:53:21 +03:00
|
|
|
// Copyright 2019 Yuzu Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
2019-06-08 03:41:06 +03:00
|
|
|
|
|
|
|
#include "core/core.h"
|
2019-06-19 03:53:21 +03:00
|
|
|
#include "core/core_timing.h"
|
2019-06-08 03:41:06 +03:00
|
|
|
#include "core/hardware_interrupt_manager.h"
|
2021-07-14 07:52:17 +03:00
|
|
|
#include "core/hle/service/nvdrv/nvdrv_interface.h"
|
2019-06-08 03:41:06 +03:00
|
|
|
#include "core/hle/service/sm/sm.h"
|
|
|
|
|
|
|
|
namespace Core::Hardware {
|
|
|
|
|
|
|
|
InterruptManager::InterruptManager(Core::System& system_in) : system(system_in) {
|
2020-07-28 02:00:41 +03:00
|
|
|
gpu_interrupt_event = Core::Timing::CreateEvent(
|
|
|
|
"GPUInterrupt", [this](std::uintptr_t message, std::chrono::nanoseconds) {
|
2020-07-16 02:14:21 +03:00
|
|
|
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);
|
|
|
|
});
|
2019-06-08 03:41:06 +03:00
|
|
|
}
|
|
|
|
|
2019-06-19 03:53:21 +03:00
|
|
|
InterruptManager::~InterruptManager() = default;
|
|
|
|
|
2019-06-12 14:52:49 +03:00
|
|
|
void InterruptManager::GPUInterruptSyncpt(const u32 syncpoint_id, const u32 value) {
|
|
|
|
const u64 msg = (static_cast<u64>(syncpoint_id) << 32ULL) | value;
|
2020-07-16 01:30:06 +03:00
|
|
|
system.CoreTiming().ScheduleEvent(std::chrono::nanoseconds{10}, gpu_interrupt_event, msg);
|
2019-06-08 03:41:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace Core::Hardware
|