diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2019-06-08 02:41:06 +0200 |
---|---|---|
committer | FernandoS27 <fsahmkow27@gmail.com> | 2019-07-05 21:49:14 +0200 |
commit | 8942047d419f6d2d0c56adad689fbf3bcd4d2961 (patch) | |
tree | aa2dd5b6aeef25c9fd5543a2a4ef267a7152b052 /src/core | |
parent | nv_services: Implement NvQueryEvent, NvCtrlEventWait, NvEventRegister, NvEventUnregister (diff) | |
download | yuzu-8942047d419f6d2d0c56adad689fbf3bcd4d2961.tar yuzu-8942047d419f6d2d0c56adad689fbf3bcd4d2961.tar.gz yuzu-8942047d419f6d2d0c56adad689fbf3bcd4d2961.tar.bz2 yuzu-8942047d419f6d2d0c56adad689fbf3bcd4d2961.tar.lz yuzu-8942047d419f6d2d0c56adad689fbf3bcd4d2961.tar.xz yuzu-8942047d419f6d2d0c56adad689fbf3bcd4d2961.tar.zst yuzu-8942047d419f6d2d0c56adad689fbf3bcd4d2961.zip |
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/core/core.cpp | 12 | ||||
-rw-r--r-- | src/core/core.h | 10 | ||||
-rw-r--r-- | src/core/hardware_interrupt_manager.cpp | 21 | ||||
-rw-r--r-- | src/core/hardware_interrupt_manager.h | 24 | ||||
-rw-r--r-- | src/core/hle/service/nvdrv/interface.cpp | 2 | ||||
-rw-r--r-- | src/core/hle/service/nvdrv/interface.h | 2 | ||||
-rw-r--r-- | src/core/hle/service/nvdrv/nvdrv.h | 5 |
8 files changed, 69 insertions, 9 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index c22585bfb..12f06a189 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -111,6 +111,8 @@ add_library(core STATIC frontend/scope_acquire_window_context.h gdbstub/gdbstub.cpp gdbstub/gdbstub.h + hardware_interrupt_manager.cpp + hardware_interrupt_manager.h hle/ipc.h hle/ipc_helpers.h hle/kernel/address_arbiter.cpp diff --git a/src/core/core.cpp b/src/core/core.cpp index 262411db8..d7f43f5ec 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -19,6 +19,7 @@ #include "core/file_sys/vfs_concat.h" #include "core/file_sys/vfs_real.h" #include "core/gdbstub/gdbstub.h" +#include "core/hardware_interrupt_manager.h" #include "core/hle/kernel/client_port.h" #include "core/hle/kernel/kernel.h" #include "core/hle/kernel/process.h" @@ -150,7 +151,7 @@ struct System::Impl { if (!renderer->Init()) { return ResultStatus::ErrorVideoCore; } - + interrupt_manager = std::make_unique<Core::Hardware::InterruptManager>(system); gpu_core = VideoCore::CreateGPU(system); is_powered_on = true; @@ -297,6 +298,7 @@ struct System::Impl { std::unique_ptr<VideoCore::RendererBase> renderer; std::unique_ptr<Tegra::GPU> gpu_core; std::shared_ptr<Tegra::DebugContext> debug_context; + std::unique_ptr<Core::Hardware::InterruptManager> interrupt_manager; CpuCoreManager cpu_core_manager; bool is_powered_on = false; @@ -440,6 +442,14 @@ const Tegra::GPU& System::GPU() const { return *impl->gpu_core; } +Core::Hardware::InterruptManager& System::InterruptManager() { + return *impl->interrupt_manager; +} + +const Core::Hardware::InterruptManager& System::InterruptManager() const { + return *impl->interrupt_manager; +} + VideoCore::RendererBase& System::Renderer() { return *impl->renderer; } diff --git a/src/core/core.h b/src/core/core.h index 70adb7af9..53e6fdb7b 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -66,6 +66,10 @@ namespace Core::Timing { class CoreTiming; } +namespace Core::Hardware { +class InterruptManager; +} + namespace Core { class ARM_Interface; @@ -230,6 +234,12 @@ public: /// Provides a constant reference to the core timing instance. const Timing::CoreTiming& CoreTiming() const; + /// Provides a reference to the interrupt manager instance. + Core::Hardware::InterruptManager& InterruptManager(); + + /// Provides a constant reference to the interrupt manager instance. + const Core::Hardware::InterruptManager& InterruptManager() const; + /// Provides a reference to the kernel instance. Kernel::KernelCore& Kernel(); diff --git a/src/core/hardware_interrupt_manager.cpp b/src/core/hardware_interrupt_manager.cpp new file mode 100644 index 000000000..463d2916c --- /dev/null +++ b/src/core/hardware_interrupt_manager.cpp @@ -0,0 +1,21 @@ + +#include "core/core.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 event_index, s64) { + auto nvdrv = system.ServiceManager().GetService<Service::Nvidia::NVDRV>("nvdrv"); + nvdrv->SignalGPUInterrupt(static_cast<u32>(event_index)); + }); +} + +void InterruptManager::InterruptGPU(const u32 event_index) { + system.CoreTiming().ScheduleEvent(10, gpu_interrupt_event, static_cast<u64>(event_index)); +} + +} // namespace Core::Hardware diff --git a/src/core/hardware_interrupt_manager.h b/src/core/hardware_interrupt_manager.h new file mode 100644 index 000000000..fc565c88b --- /dev/null +++ b/src/core/hardware_interrupt_manager.h @@ -0,0 +1,24 @@ +#pragma once + +#include "common/common_types.h" +#include "core/core_timing.h" + +namespace Core { +class System; +} + +namespace Core::Hardware { + +class InterruptManager { +public: + InterruptManager(Core::System& system); + ~InterruptManager() = default; + + void InterruptGPU(const u32 event_index); + +private: + Core::System& system; + Core::Timing::EventType* gpu_interrupt_event{}; +}; + +} // namespace Core::Hardware diff --git a/src/core/hle/service/nvdrv/interface.cpp b/src/core/hle/service/nvdrv/interface.cpp index 76482d16e..d95ba18cb 100644 --- a/src/core/hle/service/nvdrv/interface.cpp +++ b/src/core/hle/service/nvdrv/interface.cpp @@ -140,8 +140,6 @@ NVDRV::NVDRV(std::shared_ptr<Module> nvdrv, const char* name) RegisterHandlers(functions); auto& kernel = Core::System::GetInstance().Kernel(); - query_event = Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Automatic, - "NVDRV::query_event"); } NVDRV::~NVDRV() = default; diff --git a/src/core/hle/service/nvdrv/interface.h b/src/core/hle/service/nvdrv/interface.h index 421b01017..09cf4bb12 100644 --- a/src/core/hle/service/nvdrv/interface.h +++ b/src/core/hle/service/nvdrv/interface.h @@ -35,8 +35,6 @@ private: std::shared_ptr<Module> nvdrv; u64 pid{}; - - Kernel::EventPair query_event; }; } // namespace Service::Nvidia diff --git a/src/core/hle/service/nvdrv/nvdrv.h b/src/core/hle/service/nvdrv/nvdrv.h index 9a4cdc60f..d299f2877 100644 --- a/src/core/hle/service/nvdrv/nvdrv.h +++ b/src/core/hle/service/nvdrv/nvdrv.h @@ -8,6 +8,7 @@ #include <unordered_map> #include <vector> #include "common/common_types.h" +#include "core/hle/kernel/writable_event.h" #include "core/hle/service/nvdrv/nvdata.h" #include "core/hle/service/service.h" @@ -15,10 +16,6 @@ namespace Service::NVFlinger { class NVFlinger; } -namespace Kernel { -class WritableEvent; -} - namespace Service::Nvidia { namespace Devices { |