From e0027eba854b9cf097360e898457e164e6ae0b4d Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Fri, 7 Jun 2019 18:41:55 -0400 Subject: nv_services: Implement NvQueryEvent, NvCtrlEventWait, NvEventRegister, NvEventUnregister --- src/core/hle/service/nvdrv/nvdrv.cpp | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'src/core/hle/service/nvdrv/nvdrv.cpp') diff --git a/src/core/hle/service/nvdrv/nvdrv.cpp b/src/core/hle/service/nvdrv/nvdrv.cpp index 6e4b8f2c6..618bcbc7c 100644 --- a/src/core/hle/service/nvdrv/nvdrv.cpp +++ b/src/core/hle/service/nvdrv/nvdrv.cpp @@ -4,7 +4,10 @@ #include +#include #include "core/hle/ipc_helpers.h" +#include "core/hle/kernel/readable_event.h" +#include "core/hle/kernel/writable_event.h" #include "core/hle/service/nvdrv/devices/nvdevice.h" #include "core/hle/service/nvdrv/devices/nvdisp_disp0.h" #include "core/hle/service/nvdrv/devices/nvhost_as_gpu.h" @@ -33,13 +36,21 @@ void InstallInterfaces(SM::ServiceManager& service_manager, NVFlinger::NVFlinger } Module::Module() { + auto& kernel = Core::System::GetInstance().Kernel(); + for (u32 i = 0; i < MaxNvEvents; i++) { + std::string event_label = fmt::format("NVDRV::NvEvent_{}", i); + events_interface.events[i] = Kernel::WritableEvent::CreateEventPair( + kernel, Kernel::ResetType::Automatic, event_label); + events_interface.status[i] = EventState::Free; + events_interface.registered[i] = false; + } auto nvmap_dev = std::make_shared(); devices["/dev/nvhost-as-gpu"] = std::make_shared(nvmap_dev); devices["/dev/nvhost-gpu"] = std::make_shared(nvmap_dev); devices["/dev/nvhost-ctrl-gpu"] = std::make_shared(); devices["/dev/nvmap"] = nvmap_dev; devices["/dev/nvdisp_disp0"] = std::make_shared(nvmap_dev); - devices["/dev/nvhost-ctrl"] = std::make_shared(); + devices["/dev/nvhost-ctrl"] = std::make_shared(events_interface); devices["/dev/nvhost-nvdec"] = std::make_shared(); devices["/dev/nvhost-nvjpg"] = std::make_shared(); devices["/dev/nvhost-vic"] = std::make_shared(); @@ -77,4 +88,17 @@ ResultCode Module::Close(u32 fd) { return RESULT_SUCCESS; } +void Module::SignalEvent(const u32 event_id) { + if (event_id >= 64) { + LOG_ERROR(Service_NVDRV, "Unexpected Event signalled!"); + return; + } + events_interface.LiberateEvent(event_id); + events_interface.events[event_id].writable->Signal(); +} + +Kernel::SharedPtr Module::GetEvent(const u32 event_id) { + return events_interface.events[event_id].readable; +} + } // namespace Service::Nvidia -- cgit v1.2.3 From 78add28aabf0d9835336e5b4369b11308ab362e3 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Sat, 8 Jun 2019 15:13:26 -0400 Subject: nvhost_ctrl: Corrections to event handling --- src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp | 18 +++++++++++------- src/core/hle/service/nvdrv/nvdrv.cpp | 2 +- 2 files changed, 12 insertions(+), 8 deletions(-) (limited to 'src/core/hle/service/nvdrv/nvdrv.cpp') diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp index 8e28c2fa4..5b1253f6b 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp @@ -102,6 +102,7 @@ u32 nvhost_ctrl::IocCtrlEventWait(const std::vector& input, std::vector& params.value = ((params.syncpt_id & 0xfff) << 16) | 0x10000000; } params.value |= event_id; + events_interface.events[event_id].writable->Clear(); gpu.RegisterEvent(event_id, params.syncpt_id, params.threshold); std::memcpy(output.data(), ¶ms, sizeof(params)); gpu.Guard(false); @@ -115,26 +116,29 @@ u32 nvhost_ctrl::IocCtrlEventWait(const std::vector& input, std::vector& u32 nvhost_ctrl::IocCtrlEventRegister(const std::vector& input, std::vector& output) { IocCtrlEventRegisterParams params{}; std::memcpy(¶ms, input.data(), sizeof(params)); - if (params.user_event_id >= MaxNvEvents) { + const u32 event_id = params.user_event_id & 0x00FF; + if (event_id >= MaxNvEvents) { return NvResult::BadParameter; } - if (events_interface.registered[params.user_event_id]) { + if (events_interface.registered[event_id]) { return NvResult::BadParameter; } - events_interface.RegisterEvent(params.user_event_id); + events_interface.RegisterEvent(event_id); + events_interface.events[event_id].writable->Signal(); return NvResult::Success; } u32 nvhost_ctrl::IocCtrlEventUnregister(const std::vector& input, std::vector& output) { IocCtrlEventUnregisterParams params{}; std::memcpy(¶ms, input.data(), sizeof(params)); - if (params.user_event_id >= MaxNvEvents) { + const u32 event_id = params.user_event_id & 0x00FF; + if (event_id >= MaxNvEvents) { return NvResult::BadParameter; } - if (!events_interface.registered[params.user_event_id]) { + if (!events_interface.registered[event_id]) { return NvResult::BadParameter; } - events_interface.UnregisterEvent(params.user_event_id); + events_interface.UnregisterEvent(event_id); return NvResult::Success; } @@ -142,7 +146,7 @@ u32 nvhost_ctrl::IocCtrlEventSignal(const std::vector& input, std::vector= MaxNvEvents) { diff --git a/src/core/hle/service/nvdrv/nvdrv.cpp b/src/core/hle/service/nvdrv/nvdrv.cpp index 618bcbc7c..3a716e734 100644 --- a/src/core/hle/service/nvdrv/nvdrv.cpp +++ b/src/core/hle/service/nvdrv/nvdrv.cpp @@ -40,7 +40,7 @@ Module::Module() { for (u32 i = 0; i < MaxNvEvents; i++) { std::string event_label = fmt::format("NVDRV::NvEvent_{}", i); events_interface.events[i] = Kernel::WritableEvent::CreateEventPair( - kernel, Kernel::ResetType::Automatic, event_label); + kernel, Kernel::ResetType::Manual, event_label); events_interface.status[i] = EventState::Free; events_interface.registered[i] = false; } -- cgit v1.2.3 From 24408cce9bd899a6709c03b25e318123f4de7371 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Mon, 10 Jun 2019 12:03:30 -0400 Subject: nv_services: Deglobalize NvServices --- src/core/hle/service/nvdrv/devices/nvdevice.h | 9 ++++++- .../hle/service/nvdrv/devices/nvdisp_disp0.cpp | 5 ++-- src/core/hle/service/nvdrv/devices/nvdisp_disp0.h | 2 +- .../hle/service/nvdrv/devices/nvhost_as_gpu.cpp | 12 ++++----- src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h | 2 +- src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp | 7 ++--- src/core/hle/service/nvdrv/devices/nvhost_ctrl.h | 2 +- .../hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp | 4 +-- .../hle/service/nvdrv/devices/nvhost_ctrl_gpu.h | 2 +- src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp | 9 ++++--- src/core/hle/service/nvdrv/devices/nvhost_gpu.h | 2 +- .../hle/service/nvdrv/devices/nvhost_nvdec.cpp | 2 +- src/core/hle/service/nvdrv/devices/nvhost_nvdec.h | 2 +- .../hle/service/nvdrv/devices/nvhost_nvjpg.cpp | 2 +- src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h | 2 +- src/core/hle/service/nvdrv/devices/nvhost_vic.cpp | 2 +- src/core/hle/service/nvdrv/devices/nvhost_vic.h | 2 +- src/core/hle/service/nvdrv/devices/nvmap.cpp | 2 +- src/core/hle/service/nvdrv/devices/nvmap.h | 2 +- src/core/hle/service/nvdrv/interface.cpp | 2 -- src/core/hle/service/nvdrv/nvdrv.cpp | 31 +++++++++++----------- src/core/hle/service/nvdrv/nvdrv.h | 9 +++++-- src/core/hle/service/service.cpp | 2 +- 23 files changed, 65 insertions(+), 51 deletions(-) (limited to 'src/core/hle/service/nvdrv/nvdrv.cpp') diff --git a/src/core/hle/service/nvdrv/devices/nvdevice.h b/src/core/hle/service/nvdrv/devices/nvdevice.h index 4f6042b00..ed606cd15 100644 --- a/src/core/hle/service/nvdrv/devices/nvdevice.h +++ b/src/core/hle/service/nvdrv/devices/nvdevice.h @@ -9,13 +9,17 @@ #include "common/common_types.h" #include "common/swap.h" +namespace Core { +class System; +} + namespace Service::Nvidia::Devices { /// Represents an abstract nvidia device node. It is to be subclassed by concrete device nodes to /// implement the ioctl interface. class nvdevice { public: - nvdevice() = default; + nvdevice(Core::System& system) : system{system} {}; virtual ~nvdevice() = default; union Ioctl { u32_le raw; @@ -34,6 +38,9 @@ public: * @returns The result code of the ioctl. */ virtual u32 ioctl(Ioctl command, const std::vector& input, std::vector& output) = 0; + +protected: + Core::System& system; }; } // namespace Service::Nvidia::Devices diff --git a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp index 20c7c39aa..3336b2080 100644 --- a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp +++ b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp @@ -13,7 +13,8 @@ namespace Service::Nvidia::Devices { -nvdisp_disp0::nvdisp_disp0(std::shared_ptr nvmap_dev) : nvmap_dev(std::move(nvmap_dev)) {} +nvdisp_disp0::nvdisp_disp0(Core::System& system, std::shared_ptr nvmap_dev) + : nvdevice(system), nvmap_dev(std::move(nvmap_dev)) {} nvdisp_disp0 ::~nvdisp_disp0() = default; u32 nvdisp_disp0::ioctl(Ioctl command, const std::vector& input, std::vector& output) { @@ -34,7 +35,7 @@ void nvdisp_disp0::flip(u32 buffer_handle, u32 offset, u32 format, u32 width, u3 addr, offset, width, height, stride, static_cast(format), transform, crop_rect}; - auto& instance = Core::System::GetInstance(); + auto& instance = system; instance.GetPerfStats().EndGameFrame(); instance.GPU().SwapBuffers(framebuffer); } diff --git a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h index 12f3ef825..812967bdf 100644 --- a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h +++ b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h @@ -17,7 +17,7 @@ class nvmap; class nvdisp_disp0 final : public nvdevice { public: - explicit nvdisp_disp0(std::shared_ptr nvmap_dev); + explicit nvdisp_disp0(Core::System& system, std::shared_ptr nvmap_dev); ~nvdisp_disp0() override; u32 ioctl(Ioctl command, const std::vector& input, std::vector& output) override; diff --git a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp index af62d33d2..eccc3f1d9 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp @@ -22,7 +22,8 @@ enum { }; } -nvhost_as_gpu::nvhost_as_gpu(std::shared_ptr nvmap_dev) : nvmap_dev(std::move(nvmap_dev)) {} +nvhost_as_gpu::nvhost_as_gpu(Core::System& system, std::shared_ptr nvmap_dev) + : nvdevice(system), nvmap_dev(std::move(nvmap_dev)) {} nvhost_as_gpu::~nvhost_as_gpu() = default; u32 nvhost_as_gpu::ioctl(Ioctl command, const std::vector& input, std::vector& output) { @@ -65,7 +66,7 @@ u32 nvhost_as_gpu::AllocateSpace(const std::vector& input, std::vector& LOG_DEBUG(Service_NVDRV, "called, pages={:X}, page_size={:X}, flags={:X}", params.pages, params.page_size, params.flags); - auto& gpu = Core::System::GetInstance().GPU(); + auto& gpu = system.GPU(); const u64 size{static_cast(params.pages) * static_cast(params.page_size)}; if (params.flags & 1) { params.offset = gpu.MemoryManager().AllocateSpace(params.offset, size, 1); @@ -85,7 +86,7 @@ u32 nvhost_as_gpu::Remap(const std::vector& input, std::vector& output) std::vector entries(num_entries); std::memcpy(entries.data(), input.data(), input.size()); - auto& gpu = Core::System::GetInstance().GPU(); + auto& gpu = system.GPU(); for (const auto& entry : entries) { LOG_WARNING(Service_NVDRV, "remap entry, offset=0x{:X} handle=0x{:X} pages=0x{:X}", entry.offset, entry.nvmap_handle, entry.pages); @@ -136,7 +137,7 @@ u32 nvhost_as_gpu::MapBufferEx(const std::vector& input, std::vector& ou // case to prevent unexpected behavior. ASSERT(object->id == params.nvmap_handle); - auto& gpu = Core::System::GetInstance().GPU(); + auto& gpu = system.GPU(); if (params.flags & 1) { params.offset = gpu.MemoryManager().MapBufferEx(object->addr, params.offset, object->size); @@ -173,8 +174,7 @@ u32 nvhost_as_gpu::UnmapBuffer(const std::vector& input, std::vector& ou return 0; } - params.offset = Core::System::GetInstance().GPU().MemoryManager().UnmapBuffer(params.offset, - itr->second.size); + params.offset = system.GPU().MemoryManager().UnmapBuffer(params.offset, itr->second.size); buffer_mappings.erase(itr->second.offset); std::memcpy(output.data(), ¶ms, output.size()); diff --git a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h index eb14b1da8..e45d4f1ff 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h @@ -17,7 +17,7 @@ class nvmap; class nvhost_as_gpu final : public nvdevice { public: - explicit nvhost_as_gpu(std::shared_ptr nvmap_dev); + explicit nvhost_as_gpu(Core::System& system, std::shared_ptr nvmap_dev); ~nvhost_as_gpu() override; u32 ioctl(Ioctl command, const std::vector& input, std::vector& output) override; diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp index 96310ed83..02b078c2f 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp @@ -15,7 +15,8 @@ namespace Service::Nvidia::Devices { -nvhost_ctrl::nvhost_ctrl(EventsInterface& events_interface) : events_interface{events_interface} {} +nvhost_ctrl::nvhost_ctrl(Core::System& system, EventsInterface& events_interface) + : nvdevice(system), events_interface{events_interface} {} nvhost_ctrl::~nvhost_ctrl() = default; u32 nvhost_ctrl::ioctl(Ioctl command, const std::vector& input, std::vector& output) { @@ -59,7 +60,7 @@ u32 nvhost_ctrl::IocCtrlEventWait(const std::vector& input, std::vector& return NvResult::BadParameter; } - auto& gpu = Core::System::GetInstance().GPU(); + auto& gpu = system.GPU(); // This is mostly to take into account unimplemented features. As synced // gpu is always synced. if (!gpu.IsAsync()) { @@ -158,7 +159,7 @@ u32 nvhost_ctrl::IocCtrlEventSignal(const std::vector& input, std::vector& input, std::vector& output) override; 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 0e28755bd..c139f2ceb 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() = default; +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& input, std::vector& output) { @@ -185,7 +185,7 @@ u32 nvhost_ctrl_gpu::GetGpuTime(const std::vector& input, std::vector& o IoctlGetGpuTime params{}; std::memcpy(¶ms, input.data(), input.size()); - const auto ns = Core::Timing::CyclesToNs(Core::System::GetInstance().CoreTiming().GetTicks()); + const auto ns = Core::Timing::CyclesToNs(system.CoreTiming().GetTicks()); params.gpu_time = static_cast(ns.count()); std::memcpy(output.data(), ¶ms, output.size()); return 0; 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 240435eea..65eac47d1 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(); + nvhost_ctrl_gpu(Core::System& system); ~nvhost_ctrl_gpu() override; u32 ioctl(Ioctl command, const std::vector& input, std::vector& output) override; diff --git a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp index 8083f5a87..13e80bfad 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp @@ -13,7 +13,8 @@ namespace Service::Nvidia::Devices { -nvhost_gpu::nvhost_gpu(std::shared_ptr nvmap_dev) : nvmap_dev(std::move(nvmap_dev)) {} +nvhost_gpu::nvhost_gpu(Core::System& system, std::shared_ptr nvmap_dev) + : nvdevice(system), nvmap_dev(std::move(nvmap_dev)) {} nvhost_gpu::~nvhost_gpu() = default; u32 nvhost_gpu::ioctl(Ioctl command, const std::vector& input, std::vector& output) { @@ -119,7 +120,7 @@ u32 nvhost_gpu::AllocGPFIFOEx2(const std::vector& input, std::vector& ou params.num_entries, params.flags, params.unk0, params.unk1, params.unk2, params.unk3); - auto& gpu = Core::System::GetInstance().GPU(); + auto& gpu = system.GPU(); params.fence_out.id = channels; params.fence_out.value = gpu.GetSyncpointValue(channels); channels++; @@ -158,7 +159,7 @@ u32 nvhost_gpu::SubmitGPFIFO(const std::vector& input, std::vector& outp UNIMPLEMENTED_IF(params.flags.add_wait.Value() != 0); UNIMPLEMENTED_IF(params.flags.add_increment.Value() != 0); - auto& gpu = Core::System::GetInstance().GPU(); + auto& gpu = system.GPU(); u32 current_syncpoint_value = gpu.GetSyncpointValue(params.fence_out.id); if (params.flags.increment.Value()) { params.fence_out.value += current_syncpoint_value; @@ -189,7 +190,7 @@ u32 nvhost_gpu::KickoffPB(const std::vector& input, std::vector& output) UNIMPLEMENTED_IF(params.flags.add_wait.Value() != 0); UNIMPLEMENTED_IF(params.flags.add_increment.Value() != 0); - auto& gpu = Core::System::GetInstance().GPU(); + auto& gpu = system.GPU(); u32 current_syncpoint_value = gpu.GetSyncpointValue(params.fence_out.id); if (params.flags.increment.Value()) { params.fence_out.value += current_syncpoint_value; diff --git a/src/core/hle/service/nvdrv/devices/nvhost_gpu.h b/src/core/hle/service/nvdrv/devices/nvhost_gpu.h index 54378cb5d..106359f87 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_gpu.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_gpu.h @@ -20,7 +20,7 @@ constexpr u32 NVGPU_IOCTL_CHANNEL_KICKOFF_PB(0x1b); class nvhost_gpu final : public nvdevice { public: - explicit nvhost_gpu(std::shared_ptr nvmap_dev); + explicit nvhost_gpu(Core::System& system, std::shared_ptr nvmap_dev); ~nvhost_gpu() override; u32 ioctl(Ioctl command, const std::vector& input, std::vector& output) override; diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp index f5e8ea7c3..3bfcb8423 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() = default; +nvhost_nvdec::nvhost_nvdec(Core::System& system) : nvdevice(system){}; nvhost_nvdec::~nvhost_nvdec() = default; u32 nvhost_nvdec::ioctl(Ioctl command, const std::vector& input, std::vector& output) { diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h index 0e7b284f8..febfd4cc4 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(); + nvhost_nvdec(Core::System& system); ~nvhost_nvdec() override; u32 ioctl(Ioctl command, const std::vector& input, std::vector& output) override; diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.cpp b/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.cpp index 3e0951ab0..16c683b47 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() = default; +nvhost_nvjpg::nvhost_nvjpg(Core::System& system) : nvdevice(system){}; nvhost_nvjpg::~nvhost_nvjpg() = default; u32 nvhost_nvjpg::ioctl(Ioctl command, const std::vector& input, std::vector& output) { diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h b/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h index 89fd5e95e..33b149bb7 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(); + nvhost_nvjpg(Core::System& system); ~nvhost_nvjpg() override; u32 ioctl(Ioctl command, const std::vector& input, std::vector& output) override; diff --git a/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp b/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp index d544f0f31..853136dea 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() = default; +nvhost_vic::nvhost_vic(Core::System& system) : nvdevice(system){}; nvhost_vic::~nvhost_vic() = default; u32 nvhost_vic::ioctl(Ioctl command, const std::vector& input, std::vector& output) { diff --git a/src/core/hle/service/nvdrv/devices/nvhost_vic.h b/src/core/hle/service/nvdrv/devices/nvhost_vic.h index fc24c3f9c..b71816ba1 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(); + nvhost_vic(Core::System& system); ~nvhost_vic() override; u32 ioctl(Ioctl command, const std::vector& input, std::vector& output) override; diff --git a/src/core/hle/service/nvdrv/devices/nvmap.cpp b/src/core/hle/service/nvdrv/devices/nvmap.cpp index 1ec796fc6..a75ff334b 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() = default; +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 396230c19..623c9b232 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(); + 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/interface.cpp b/src/core/hle/service/nvdrv/interface.cpp index d95ba18cb..c548f1223 100644 --- a/src/core/hle/service/nvdrv/interface.cpp +++ b/src/core/hle/service/nvdrv/interface.cpp @@ -138,8 +138,6 @@ NVDRV::NVDRV(std::shared_ptr nvdrv, const char* name) {13, &NVDRV::FinishInitialize, "FinishInitialize"}, }; RegisterHandlers(functions); - - auto& kernel = Core::System::GetInstance().Kernel(); } NVDRV::~NVDRV() = default; diff --git a/src/core/hle/service/nvdrv/nvdrv.cpp b/src/core/hle/service/nvdrv/nvdrv.cpp index 3a716e734..c68d29177 100644 --- a/src/core/hle/service/nvdrv/nvdrv.cpp +++ b/src/core/hle/service/nvdrv/nvdrv.cpp @@ -25,8 +25,9 @@ namespace Service::Nvidia { -void InstallInterfaces(SM::ServiceManager& service_manager, NVFlinger::NVFlinger& nvflinger) { - auto module_ = std::make_shared(); +void InstallInterfaces(SM::ServiceManager& service_manager, NVFlinger::NVFlinger& nvflinger, + Core::System& system) { + auto module_ = std::make_shared(system); std::make_shared(module_, "nvdrv")->InstallAsService(service_manager); std::make_shared(module_, "nvdrv:a")->InstallAsService(service_manager); std::make_shared(module_, "nvdrv:s")->InstallAsService(service_manager); @@ -35,25 +36,25 @@ void InstallInterfaces(SM::ServiceManager& service_manager, NVFlinger::NVFlinger nvflinger.SetNVDrvInstance(module_); } -Module::Module() { - auto& kernel = Core::System::GetInstance().Kernel(); +Module::Module(Core::System& system) { + auto& kernel = system.Kernel(); for (u32 i = 0; i < MaxNvEvents; i++) { std::string event_label = fmt::format("NVDRV::NvEvent_{}", i); - events_interface.events[i] = Kernel::WritableEvent::CreateEventPair( - kernel, Kernel::ResetType::Manual, event_label); + events_interface.events[i] = + Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Manual, event_label); events_interface.status[i] = EventState::Free; events_interface.registered[i] = false; } - auto nvmap_dev = std::make_shared(); - devices["/dev/nvhost-as-gpu"] = std::make_shared(nvmap_dev); - devices["/dev/nvhost-gpu"] = std::make_shared(nvmap_dev); - devices["/dev/nvhost-ctrl-gpu"] = std::make_shared(); + auto nvmap_dev = std::make_shared(system); + devices["/dev/nvhost-as-gpu"] = std::make_shared(system, nvmap_dev); + devices["/dev/nvhost-gpu"] = std::make_shared(system, nvmap_dev); + devices["/dev/nvhost-ctrl-gpu"] = std::make_shared(system); devices["/dev/nvmap"] = nvmap_dev; - devices["/dev/nvdisp_disp0"] = std::make_shared(nvmap_dev); - devices["/dev/nvhost-ctrl"] = std::make_shared(events_interface); - devices["/dev/nvhost-nvdec"] = std::make_shared(); - devices["/dev/nvhost-nvjpg"] = std::make_shared(); - devices["/dev/nvhost-vic"] = std::make_shared(); + devices["/dev/nvdisp_disp0"] = std::make_shared(system, nvmap_dev); + devices["/dev/nvhost-ctrl"] = std::make_shared(system, events_interface); + devices["/dev/nvhost-nvdec"] = std::make_shared(system); + devices["/dev/nvhost-nvjpg"] = std::make_shared(system); + devices["/dev/nvhost-vic"] = std::make_shared(system); } Module::~Module() = default; diff --git a/src/core/hle/service/nvdrv/nvdrv.h b/src/core/hle/service/nvdrv/nvdrv.h index d299f2877..0e8eed113 100644 --- a/src/core/hle/service/nvdrv/nvdrv.h +++ b/src/core/hle/service/nvdrv/nvdrv.h @@ -12,6 +12,10 @@ #include "core/hle/service/nvdrv/nvdata.h" #include "core/hle/service/service.h" +namespace Core { +class System; +} + namespace Service::NVFlinger { class NVFlinger; } @@ -66,7 +70,7 @@ struct EventsInterface { class Module final { public: - Module(); + Module(Core::System& system); ~Module(); /// Returns a pointer to one of the available devices, identified by its name. @@ -103,6 +107,7 @@ private: }; /// Registers all NVDRV services with the specified service manager. -void InstallInterfaces(SM::ServiceManager& service_manager, NVFlinger::NVFlinger& nvflinger); +void InstallInterfaces(SM::ServiceManager& service_manager, NVFlinger::NVFlinger& nvflinger, + Core::System& system); } // namespace Service::Nvidia diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index 5fc7d3cab..07b1f4d43 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp @@ -237,7 +237,7 @@ void Init(std::shared_ptr& sm, Core::System& system, NIM::InstallInterfaces(*sm); NPNS::InstallInterfaces(*sm); NS::InstallInterfaces(*sm); - Nvidia::InstallInterfaces(*sm, *nv_flinger); + Nvidia::InstallInterfaces(*sm, *nv_flinger, system); PCIe::InstallInterfaces(*sm); PCTL::InstallInterfaces(*sm); PCV::InstallInterfaces(*sm); -- cgit v1.2.3 From 7d1b974bcaf72c32910dcf4ff2d435f91cf40609 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Wed, 12 Jun 2019 07:52:49 -0400 Subject: GPU: Correct Interrupts to interrupt on syncpt/value instead of event, mirroring hardware --- src/core/hardware_interrupt_manager.cpp | 11 +++++--- src/core/hardware_interrupt_manager.h | 2 +- src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp | 5 +--- src/core/hle/service/nvdrv/interface.cpp | 4 +-- src/core/hle/service/nvdrv/interface.h | 2 +- src/core/hle/service/nvdrv/nvdrv.cpp | 13 +++++----- src/core/hle/service/nvdrv/nvdrv.h | 4 ++- src/video_core/gpu.cpp | 30 +++++++++++----------- src/video_core/gpu.h | 14 +++------- src/video_core/gpu_asynch.cpp | 4 +-- src/video_core/gpu_asynch.h | 2 +- src/video_core/gpu_synch.h | 2 +- 12 files changed, 45 insertions(+), 48 deletions(-) (limited to 'src/core/hle/service/nvdrv/nvdrv.cpp') diff --git a/src/core/hardware_interrupt_manager.cpp b/src/core/hardware_interrupt_manager.cpp index 463d2916c..c3fffa894 100644 --- a/src/core/hardware_interrupt_manager.cpp +++ b/src/core/hardware_interrupt_manager.cpp @@ -8,14 +8,17 @@ namespace Core::Hardware { InterruptManager::InterruptManager(Core::System& system_in) : system(system_in) { gpu_interrupt_event = - system.CoreTiming().RegisterEvent("GPUInterrupt", [this](u64 event_index, s64) { + system.CoreTiming().RegisterEvent("GPUInterrupt", [this](u64 message, s64) { auto nvdrv = system.ServiceManager().GetService("nvdrv"); - nvdrv->SignalGPUInterrupt(static_cast(event_index)); + const u32 syncpt = static_cast(message >> 32); + const u32 value = static_cast(message & 0x00000000FFFFFFFFULL); + nvdrv->SignalGPUInterruptSyncpt(syncpt, value); }); } -void InterruptManager::InterruptGPU(const u32 event_index) { - system.CoreTiming().ScheduleEvent(10, gpu_interrupt_event, static_cast(event_index)); +void InterruptManager::GPUInterruptSyncpt(const u32 syncpoint_id, const u32 value) { + const u64 msg = (static_cast(syncpoint_id) << 32ULL) | value; + system.CoreTiming().ScheduleEvent(10, gpu_interrupt_event, msg); } } // namespace Core::Hardware diff --git a/src/core/hardware_interrupt_manager.h b/src/core/hardware_interrupt_manager.h index fc565c88b..590392f75 100644 --- a/src/core/hardware_interrupt_manager.h +++ b/src/core/hardware_interrupt_manager.h @@ -14,7 +14,7 @@ public: InterruptManager(Core::System& system); ~InterruptManager() = default; - void InterruptGPU(const u32 event_index); + void GPUInterruptSyncpt(const u32 syncpoint_id, const u32 value); private: Core::System& system; diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp index 02b078c2f..d41274616 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp @@ -109,7 +109,7 @@ u32 nvhost_ctrl::IocCtrlEventWait(const std::vector& input, std::vector& } params.value |= event_id; events_interface.events[event_id].writable->Clear(); - gpu.RegisterEvent(event_id, params.syncpt_id, params.threshold); + gpu.RegisterSyncptInterrupt(params.syncpt_id, params.threshold); std::memcpy(output.data(), ¶ms, sizeof(params)); gpu.Guard(false); return NvResult::Timeout; @@ -159,9 +159,6 @@ u32 nvhost_ctrl::IocCtrlEventSignal(const std::vector& input, std::vectorSignalEvent(event_id); +void NVDRV::SignalGPUInterruptSyncpt(const u32 syncpoint_id, const u32 value) { + nvdrv->SignalSyncpt(syncpoint_id, value); } void NVDRV::Open(Kernel::HLERequestContext& ctx) { diff --git a/src/core/hle/service/nvdrv/interface.h b/src/core/hle/service/nvdrv/interface.h index 09cf4bb12..10a0ecd52 100644 --- a/src/core/hle/service/nvdrv/interface.h +++ b/src/core/hle/service/nvdrv/interface.h @@ -19,7 +19,7 @@ public: NVDRV(std::shared_ptr nvdrv, const char* name); ~NVDRV() override; - void SignalGPUInterrupt(const u32 event_id); + void SignalGPUInterruptSyncpt(const u32 syncpoint_id, const u32 value); private: void Open(Kernel::HLERequestContext& ctx); diff --git a/src/core/hle/service/nvdrv/nvdrv.cpp b/src/core/hle/service/nvdrv/nvdrv.cpp index c68d29177..b87c228bd 100644 --- a/src/core/hle/service/nvdrv/nvdrv.cpp +++ b/src/core/hle/service/nvdrv/nvdrv.cpp @@ -89,13 +89,14 @@ ResultCode Module::Close(u32 fd) { return RESULT_SUCCESS; } -void Module::SignalEvent(const u32 event_id) { - if (event_id >= 64) { - LOG_ERROR(Service_NVDRV, "Unexpected Event signalled!"); - return; +void Module::SignalSyncpt(const u32 syncpoint_id, const u32 value) { + for (u32 i = 0; i < MaxNvEvents; i++) { + if (events_interface.assigned_syncpt[i] == syncpoint_id && + events_interface.assigned_value[i] == value) { + events_interface.LiberateEvent(i); + events_interface.events[i].writable->Signal(); + } } - events_interface.LiberateEvent(event_id); - events_interface.events[event_id].writable->Signal(); } Kernel::SharedPtr Module::GetEvent(const u32 event_id) { diff --git a/src/core/hle/service/nvdrv/nvdrv.h b/src/core/hle/service/nvdrv/nvdrv.h index 597acc9c6..97b48d150 100644 --- a/src/core/hle/service/nvdrv/nvdrv.h +++ b/src/core/hle/service/nvdrv/nvdrv.h @@ -73,6 +73,8 @@ struct EventsInterface { void LiberateEvent(const u32 event_id) { status[event_id] = registered[event_id] ? EventState::Registered : EventState::Free; events_mask &= ~(1 << event_id); + assigned_syncpt[event_id] = 0xFFFFFFFF; + assigned_value[event_id] = 0; } }; @@ -97,7 +99,7 @@ public: /// Closes a device file descriptor and returns operation success. ResultCode Close(u32 fd); - void SignalEvent(const u32 event_id); + void SignalSyncpt(const u32 syncpoint_id, const u32 value); Kernel::SharedPtr GetEvent(const u32 event_id); diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index 086db0e69..efea23bf2 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp @@ -70,13 +70,13 @@ const DmaPusher& GPU::DmaPusher() const { void GPU::IncrementSyncPoint(const u32 syncpoint_id) { syncpoints[syncpoint_id]++; sync_mutex.lock(); - if (!events[syncpoint_id].empty()) { + if (!syncpt_interrupts[syncpoint_id].empty()) { u32 value = syncpoints[syncpoint_id].load(); - auto it = events[syncpoint_id].begin(); - while (it != events[syncpoint_id].end()) { - if (value >= it->value) { - TriggerCpuInterrupt(it->event_id); - it = events[syncpoint_id].erase(it); + auto it = syncpt_interrupts[syncpoint_id].begin(); + while (it != syncpt_interrupts[syncpoint_id].end()) { + if (value >= *it) { + TriggerCpuInterrupt(syncpoint_id, *it); + it = syncpt_interrupts[syncpoint_id].erase(it); continue; } it++; @@ -89,19 +89,19 @@ u32 GPU::GetSyncpointValue(const u32 syncpoint_id) const { return syncpoints[syncpoint_id].load(); } -void GPU::RegisterEvent(const u32 event_id, const u32 syncpoint_id, const u32 value) { - for (auto& ev : events[syncpoint_id]) { - if (ev.event_id == event_id && ev.value == value) +void GPU::RegisterSyncptInterrupt(const u32 syncpoint_id, const u32 value) { + for (u32 in_value : syncpt_interrupts[syncpoint_id]) { + if (in_value == value) return; } - events[syncpoint_id].emplace_back(event_id, value); + syncpt_interrupts[syncpoint_id].emplace_back(value); } -void GPU::CancelEvent(const u32 event_id, const u32 syncpoint_id, const u32 value) { - auto it = events[syncpoint_id].begin(); - while (it != events[syncpoint_id].end()) { - if (value == it->value) { - it = events[syncpoint_id].erase(it); +void GPU::CancelSyncptInterrupt(const u32 syncpoint_id, const u32 value) { + 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; } it++; diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h index 18ac3237e..9bd618941 100644 --- a/src/video_core/gpu.h +++ b/src/video_core/gpu.h @@ -172,9 +172,9 @@ public: u32 GetSyncpointValue(const u32 syncpoint_id) const; - void RegisterEvent(const u32 event_id, const u32 syncpoint_id, const u32 value); + void RegisterSyncptInterrupt(const u32 syncpoint_id, const u32 value); - void CancelEvent(const u32 event_id, const u32 syncpoint_id, const u32 value); + void CancelSyncptInterrupt(const u32 syncpoint_id, const u32 value); void Guard(bool guard_set) { if (guard_set) { @@ -253,7 +253,7 @@ public: virtual void FlushAndInvalidateRegion(CacheAddr addr, u64 size) = 0; protected: - virtual void TriggerCpuInterrupt(const u32 event_id) const = 0; + virtual void TriggerCpuInterrupt(const u32 syncpoint_id, const u32 value) const = 0; private: void ProcessBindMethod(const MethodCall& method_call); @@ -293,13 +293,7 @@ private: std::array, Service::Nvidia::MaxSyncPoints> syncpoints{}; - struct Event { - Event(const u32 event_id, const u32 value) : event_id(event_id), value(value) {} - u32 event_id; - u32 value; - }; - - std::array, Service::Nvidia::MaxSyncPoints> events; + std::array, Service::Nvidia::MaxSyncPoints> syncpt_interrupts; std::mutex sync_mutex; diff --git a/src/video_core/gpu_asynch.cpp b/src/video_core/gpu_asynch.cpp index 6b6f0f6ec..ea67be831 100644 --- a/src/video_core/gpu_asynch.cpp +++ b/src/video_core/gpu_asynch.cpp @@ -40,9 +40,9 @@ void GPUAsynch::FlushAndInvalidateRegion(CacheAddr addr, u64 size) { gpu_thread.FlushAndInvalidateRegion(addr, size); } -void GPUAsynch::TriggerCpuInterrupt(const u32 event_id) const { +void GPUAsynch::TriggerCpuInterrupt(const u32 syncpoint_id, const u32 value) const { auto& interrupt_manager = system.InterruptManager(); - interrupt_manager.InterruptGPU(event_id); + interrupt_manager.GPUInterruptSyncpt(syncpoint_id, value); } } // namespace VideoCommon diff --git a/src/video_core/gpu_asynch.h b/src/video_core/gpu_asynch.h index d49e9b96e..5f1b2fb7d 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 event_id) const override; + void TriggerCpuInterrupt(const u32 syncpoint_id, const 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 09bda854a..58d258503 100644 --- a/src/video_core/gpu_synch.h +++ b/src/video_core/gpu_synch.h @@ -27,7 +27,7 @@ public: void FlushAndInvalidateRegion(CacheAddr addr, u64 size) override; protected: - void TriggerCpuInterrupt(const u32 event_id) const override {} + void TriggerCpuInterrupt(const u32 syncpoint_id, const u32 value) const override {} }; } // namespace VideoCommon -- cgit v1.2.3 From b6844bec608ed82511738e9f3911e72aeb05243a Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Sun, 16 Jun 2019 11:43:41 -0400 Subject: NVServices: Correct CtrlEventWaitSync to block the ipc until timeout. --- src/core/hle/service/nvdrv/devices/nvdevice.h | 4 ++- .../hle/service/nvdrv/devices/nvdisp_disp0.cpp | 3 +- src/core/hle/service/nvdrv/devices/nvdisp_disp0.h | 3 +- .../hle/service/nvdrv/devices/nvhost_as_gpu.cpp | 3 +- src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h | 3 +- src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp | 22 ++++++++++---- src/core/hle/service/nvdrv/devices/nvhost_ctrl.h | 6 ++-- .../hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp | 3 +- .../hle/service/nvdrv/devices/nvhost_ctrl_gpu.h | 3 +- src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp | 3 +- src/core/hle/service/nvdrv/devices/nvhost_gpu.h | 3 +- .../hle/service/nvdrv/devices/nvhost_nvdec.cpp | 3 +- src/core/hle/service/nvdrv/devices/nvhost_nvdec.h | 3 +- .../hle/service/nvdrv/devices/nvhost_nvjpg.cpp | 3 +- src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h | 3 +- src/core/hle/service/nvdrv/devices/nvhost_vic.cpp | 3 +- src/core/hle/service/nvdrv/devices/nvhost_vic.h | 3 +- src/core/hle/service/nvdrv/devices/nvmap.cpp | 3 +- src/core/hle/service/nvdrv/devices/nvmap.h | 3 +- src/core/hle/service/nvdrv/interface.cpp | 34 +++++++++++++++++++--- src/core/hle/service/nvdrv/nvdata.h | 7 +++++ src/core/hle/service/nvdrv/nvdrv.cpp | 9 ++++-- src/core/hle/service/nvdrv/nvdrv.h | 5 +++- 23 files changed, 104 insertions(+), 31 deletions(-) (limited to 'src/core/hle/service/nvdrv/nvdrv.cpp') diff --git a/src/core/hle/service/nvdrv/devices/nvdevice.h b/src/core/hle/service/nvdrv/devices/nvdevice.h index ed606cd15..fae69eb19 100644 --- a/src/core/hle/service/nvdrv/devices/nvdevice.h +++ b/src/core/hle/service/nvdrv/devices/nvdevice.h @@ -8,6 +8,7 @@ #include "common/bit_field.h" #include "common/common_types.h" #include "common/swap.h" +#include "core/hle/service/nvdrv/nvdata.h" namespace Core { class System; @@ -37,7 +38,8 @@ public: * @param output A buffer where the output data will be written to. * @returns The result code of the ioctl. */ - virtual u32 ioctl(Ioctl command, const std::vector& input, std::vector& output) = 0; + virtual u32 ioctl(Ioctl command, const std::vector& input, std::vector& output, + IoctlCtrl& ctrl) = 0; protected: Core::System& system; diff --git a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp index 3336b2080..c918b4225 100644 --- a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp +++ b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp @@ -17,7 +17,8 @@ nvdisp_disp0::nvdisp_disp0(Core::System& system, std::shared_ptr nvmap_de : nvdevice(system), nvmap_dev(std::move(nvmap_dev)) {} nvdisp_disp0 ::~nvdisp_disp0() = default; -u32 nvdisp_disp0::ioctl(Ioctl command, const std::vector& input, std::vector& output) { +u32 nvdisp_disp0::ioctl(Ioctl command, const std::vector& input, std::vector& output, + IoctlCtrl& ctrl) { UNIMPLEMENTED_MSG("Unimplemented ioctl"); return 0; } diff --git a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h index 812967bdf..e79e490ff 100644 --- a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h +++ b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h @@ -20,7 +20,8 @@ public: explicit nvdisp_disp0(Core::System& system, std::shared_ptr nvmap_dev); ~nvdisp_disp0() override; - u32 ioctl(Ioctl command, const std::vector& input, std::vector& output) override; + u32 ioctl(Ioctl command, const std::vector& input, std::vector& output, + IoctlCtrl& ctrl) override; /// Performs a screen flip, drawing the buffer pointed to by the handle. void flip(u32 buffer_handle, u32 offset, u32 format, u32 width, u32 height, u32 stride, diff --git a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp index eccc3f1d9..24ab3f2e9 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp @@ -26,7 +26,8 @@ nvhost_as_gpu::nvhost_as_gpu(Core::System& system, std::shared_ptr nvmap_ : nvdevice(system), nvmap_dev(std::move(nvmap_dev)) {} nvhost_as_gpu::~nvhost_as_gpu() = default; -u32 nvhost_as_gpu::ioctl(Ioctl command, const std::vector& input, std::vector& output) { +u32 nvhost_as_gpu::ioctl(Ioctl command, const std::vector& input, std::vector& output, + IoctlCtrl& ctrl) { LOG_DEBUG(Service_NVDRV, "called, command=0x{:08X}, input_size=0x{:X}, output_size=0x{:X}", command.raw, input.size(), output.size()); diff --git a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h index e45d4f1ff..30ca5f4c3 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h @@ -20,7 +20,8 @@ public: explicit nvhost_as_gpu(Core::System& system, std::shared_ptr nvmap_dev); ~nvhost_as_gpu() override; - u32 ioctl(Ioctl command, const std::vector& input, std::vector& output) override; + u32 ioctl(Ioctl command, const std::vector& input, std::vector& output, + IoctlCtrl& ctrl) override; private: enum class IoctlCommand : u32_le { diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp index d41274616..e46e6b94c 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp @@ -19,7 +19,8 @@ nvhost_ctrl::nvhost_ctrl(Core::System& system, EventsInterface& events_interface : nvdevice(system), events_interface{events_interface} {} nvhost_ctrl::~nvhost_ctrl() = default; -u32 nvhost_ctrl::ioctl(Ioctl command, const std::vector& input, std::vector& output) { +u32 nvhost_ctrl::ioctl(Ioctl command, const std::vector& input, std::vector& output, + IoctlCtrl& ctrl) { LOG_DEBUG(Service_NVDRV, "called, command=0x{:08X}, input_size=0x{:X}, output_size=0x{:X}", command.raw, input.size(), output.size()); @@ -27,9 +28,9 @@ u32 nvhost_ctrl::ioctl(Ioctl command, const std::vector& input, std::vector< case IoctlCommand::IocGetConfigCommand: return NvOsGetConfigU32(input, output); case IoctlCommand::IocCtrlEventWaitCommand: - return IocCtrlEventWait(input, output, false); + return IocCtrlEventWait(input, output, false, ctrl); case IoctlCommand::IocCtrlEventWaitAsyncCommand: - return IocCtrlEventWait(input, output, true); + return IocCtrlEventWait(input, output, true, ctrl); case IoctlCommand::IocCtrlEventRegisterCommand: return IocCtrlEventRegister(input, output); case IoctlCommand::IocCtrlEventUnregisterCommand: @@ -50,7 +51,7 @@ u32 nvhost_ctrl::NvOsGetConfigU32(const std::vector& input, std::vector& } u32 nvhost_ctrl::IocCtrlEventWait(const std::vector& input, std::vector& output, - bool is_async) { + bool is_async, IoctlCtrl& ctrl) { IocCtrlEventWaitParams params{}; std::memcpy(¶ms, input.data(), sizeof(params)); LOG_DEBUG(Service_NVDRV, "syncpt_id={}, threshold={}, timeout={}, is_async={}", @@ -94,7 +95,11 @@ u32 nvhost_ctrl::IocCtrlEventWait(const std::vector& input, std::vector& return NvResult::BadParameter; } } else { - event_id = events_interface.GetFreeEvent(); + if (ctrl.fresh_call) { + event_id = events_interface.GetFreeEvent(); + } else { + event_id = ctrl.event_id; + } } EventState status = events_interface.status[event_id]; @@ -110,6 +115,13 @@ u32 nvhost_ctrl::IocCtrlEventWait(const std::vector& input, std::vector& params.value |= event_id; events_interface.events[event_id].writable->Clear(); gpu.RegisterSyncptInterrupt(params.syncpt_id, params.threshold); + if (!is_async && ctrl.fresh_call) { + ctrl.must_delay = true; + ctrl.timeout = params.timeout; + ctrl.event_id = event_id; + gpu.Guard(false); + return NvResult::Timeout; + } std::memcpy(output.data(), ¶ms, sizeof(params)); gpu.Guard(false); return NvResult::Timeout; diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h index 6cbf75f89..7cb41aa54 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h @@ -17,7 +17,8 @@ public: nvhost_ctrl(Core::System& system, EventsInterface& events_interface); ~nvhost_ctrl() override; - u32 ioctl(Ioctl command, const std::vector& input, std::vector& output) override; + u32 ioctl(Ioctl command, const std::vector& input, std::vector& output, + IoctlCtrl& ctrl) override; private: enum class IoctlCommand : u32_le { @@ -133,7 +134,8 @@ private: u32 NvOsGetConfigU32(const std::vector& input, std::vector& output); - u32 IocCtrlEventWait(const std::vector& input, std::vector& output, bool is_async); + u32 IocCtrlEventWait(const std::vector& input, std::vector& output, bool is_async, + IoctlCtrl& ctrl); u32 IocCtrlEventRegister(const std::vector& input, std::vector& output); 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 c139f2ceb..e3d2b4470 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp @@ -15,7 +15,8 @@ namespace Service::Nvidia::Devices { 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& input, std::vector& output) { +u32 nvhost_ctrl_gpu::ioctl(Ioctl command, const std::vector& input, std::vector& output, + IoctlCtrl& ctrl) { LOG_DEBUG(Service_NVDRV, "called, command=0x{:08X}, input_size=0x{:X}, output_size=0x{:X}", command.raw, input.size(), output.size()); 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 65eac47d1..de36cb014 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h @@ -16,7 +16,8 @@ public: nvhost_ctrl_gpu(Core::System& system); ~nvhost_ctrl_gpu() override; - u32 ioctl(Ioctl command, const std::vector& input, std::vector& output) override; + u32 ioctl(Ioctl command, const std::vector& input, std::vector& output, + IoctlCtrl& ctrl) override; private: enum class IoctlCommand : u32_le { diff --git a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp index 13e80bfad..b9e13fae9 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp @@ -17,7 +17,8 @@ nvhost_gpu::nvhost_gpu(Core::System& system, std::shared_ptr nvmap_dev) : nvdevice(system), nvmap_dev(std::move(nvmap_dev)) {} nvhost_gpu::~nvhost_gpu() = default; -u32 nvhost_gpu::ioctl(Ioctl command, const std::vector& input, std::vector& output) { +u32 nvhost_gpu::ioctl(Ioctl command, const std::vector& input, std::vector& output, + IoctlCtrl& ctrl) { LOG_DEBUG(Service_NVDRV, "called, command=0x{:08X}, input_size=0x{:X}, output_size=0x{:X}", command.raw, input.size(), output.size()); diff --git a/src/core/hle/service/nvdrv/devices/nvhost_gpu.h b/src/core/hle/service/nvdrv/devices/nvhost_gpu.h index 106359f87..edc37ff3a 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_gpu.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_gpu.h @@ -23,7 +23,8 @@ public: explicit nvhost_gpu(Core::System& system, std::shared_ptr nvmap_dev); ~nvhost_gpu() override; - u32 ioctl(Ioctl command, const std::vector& input, std::vector& output) override; + u32 ioctl(Ioctl command, const std::vector& input, std::vector& output, + IoctlCtrl& ctrl) override; private: enum class IoctlCommand : u32_le { diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp index 3bfcb8423..f464328f3 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp @@ -13,7 +13,8 @@ namespace Service::Nvidia::Devices { nvhost_nvdec::nvhost_nvdec(Core::System& system) : nvdevice(system){}; nvhost_nvdec::~nvhost_nvdec() = default; -u32 nvhost_nvdec::ioctl(Ioctl command, const std::vector& input, std::vector& output) { +u32 nvhost_nvdec::ioctl(Ioctl command, const std::vector& input, std::vector& output, + IoctlCtrl& ctrl) { LOG_DEBUG(Service_NVDRV, "called, command=0x{:08X}, input_size=0x{:X}, output_size=0x{:X}", command.raw, input.size(), output.size()); diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h index febfd4cc4..c2b7a22f6 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h @@ -16,7 +16,8 @@ public: nvhost_nvdec(Core::System& system); ~nvhost_nvdec() override; - u32 ioctl(Ioctl command, const std::vector& input, std::vector& output) override; + u32 ioctl(Ioctl command, const std::vector& input, std::vector& output, + IoctlCtrl& ctrl) override; private: enum class IoctlCommand : u32_le { diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.cpp b/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.cpp index 16c683b47..d4d67fc72 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.cpp @@ -13,7 +13,8 @@ namespace Service::Nvidia::Devices { nvhost_nvjpg::nvhost_nvjpg(Core::System& system) : nvdevice(system){}; nvhost_nvjpg::~nvhost_nvjpg() = default; -u32 nvhost_nvjpg::ioctl(Ioctl command, const std::vector& input, std::vector& output) { +u32 nvhost_nvjpg::ioctl(Ioctl command, const std::vector& input, std::vector& output, + IoctlCtrl& ctrl) { LOG_DEBUG(Service_NVDRV, "called, command=0x{:08X}, input_size=0x{:X}, output_size=0x{:X}", command.raw, input.size(), output.size()); diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h b/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h index 33b149bb7..4bf280d67 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h @@ -16,7 +16,8 @@ public: nvhost_nvjpg(Core::System& system); ~nvhost_nvjpg() override; - u32 ioctl(Ioctl command, const std::vector& input, std::vector& output) override; + u32 ioctl(Ioctl command, const std::vector& input, std::vector& output, + IoctlCtrl& ctrl) override; private: enum class IoctlCommand : u32_le { diff --git a/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp b/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp index 853136dea..24e38d31a 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp @@ -13,7 +13,8 @@ namespace Service::Nvidia::Devices { nvhost_vic::nvhost_vic(Core::System& system) : nvdevice(system){}; nvhost_vic::~nvhost_vic() = default; -u32 nvhost_vic::ioctl(Ioctl command, const std::vector& input, std::vector& output) { +u32 nvhost_vic::ioctl(Ioctl command, const std::vector& input, std::vector& output, + IoctlCtrl& ctrl) { LOG_DEBUG(Service_NVDRV, "called, command=0x{:08X}, input_size=0x{:X}, output_size=0x{:X}", command.raw, input.size(), output.size()); diff --git a/src/core/hle/service/nvdrv/devices/nvhost_vic.h b/src/core/hle/service/nvdrv/devices/nvhost_vic.h index b71816ba1..3d0934a78 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_vic.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_vic.h @@ -16,7 +16,8 @@ public: nvhost_vic(Core::System& system); ~nvhost_vic() override; - u32 ioctl(Ioctl command, const std::vector& input, std::vector& output) override; + u32 ioctl(Ioctl command, const std::vector& input, std::vector& output, + IoctlCtrl& ctrl) override; private: enum class IoctlCommand : u32_le { diff --git a/src/core/hle/service/nvdrv/devices/nvmap.cpp b/src/core/hle/service/nvdrv/devices/nvmap.cpp index a75ff334b..349454685 100644 --- a/src/core/hle/service/nvdrv/devices/nvmap.cpp +++ b/src/core/hle/service/nvdrv/devices/nvmap.cpp @@ -28,7 +28,8 @@ VAddr nvmap::GetObjectAddress(u32 handle) const { return object->addr; } -u32 nvmap::ioctl(Ioctl command, const std::vector& input, std::vector& output) { +u32 nvmap::ioctl(Ioctl command, const std::vector& input, std::vector& output, + IoctlCtrl& ctrl) { switch (static_cast(command.raw)) { case IoctlCommand::Create: return IocCreate(input, output); diff --git a/src/core/hle/service/nvdrv/devices/nvmap.h b/src/core/hle/service/nvdrv/devices/nvmap.h index 623c9b232..b79ed736c 100644 --- a/src/core/hle/service/nvdrv/devices/nvmap.h +++ b/src/core/hle/service/nvdrv/devices/nvmap.h @@ -22,7 +22,8 @@ public: /// Returns the allocated address of an nvmap object given its handle. VAddr GetObjectAddress(u32 handle) const; - u32 ioctl(Ioctl command, const std::vector& input, std::vector& output) override; + u32 ioctl(Ioctl command, const std::vector& input, std::vector& output, + IoctlCtrl& ctrl) override; /// Represents an nvmap object. struct Object { diff --git a/src/core/hle/service/nvdrv/interface.cpp b/src/core/hle/service/nvdrv/interface.cpp index a4cb8cb81..45912153d 100644 --- a/src/core/hle/service/nvdrv/interface.cpp +++ b/src/core/hle/service/nvdrv/interface.cpp @@ -8,6 +8,7 @@ #include "core/hle/ipc_helpers.h" #include "core/hle/kernel/kernel.h" #include "core/hle/kernel/readable_event.h" +#include "core/hle/kernel/thread.h" #include "core/hle/kernel/writable_event.h" #include "core/hle/service/nvdrv/interface.h" #include "core/hle/service/nvdrv/nvdata.h" @@ -41,11 +42,36 @@ void NVDRV::Ioctl(Kernel::HLERequestContext& ctx) { std::vector output(ctx.GetWriteBufferSize()); - IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(RESULT_SUCCESS); - rb.Push(nvdrv->Ioctl(fd, command, ctx.ReadBuffer(), output)); + IoctlCtrl ctrl{}; + + u32 result = nvdrv->Ioctl(fd, command, ctx.ReadBuffer(), output, ctrl); - ctx.WriteBuffer(output); + if (!ctrl.must_delay) { + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(RESULT_SUCCESS); + rb.Push(result); + + ctx.WriteBuffer(output); + return; + } + ctrl.fresh_call = false; + ctx.SleepClientThread( + "NVServices::DelayedResponse", ctrl.timeout, + [this, ctrl = ctrl](Kernel::SharedPtr thread, Kernel::HLERequestContext& ctx, + Kernel::ThreadWakeupReason reason) { + IPC::RequestParser rp{ctx}; + u32 fd = rp.Pop(); + u32 command = rp.Pop(); + std::vector output(ctx.GetWriteBufferSize()); + IoctlCtrl ctrl2{ctrl}; + u32 result = nvdrv->Ioctl(fd, command, ctx.ReadBuffer(), output, ctrl2); + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(RESULT_SUCCESS); + rb.Push(result); + + ctx.WriteBuffer(output); + }, + nvdrv->GetEventWriteable(ctrl.event_id)); } void NVDRV::Close(Kernel::HLERequestContext& ctx) { diff --git a/src/core/hle/service/nvdrv/nvdata.h b/src/core/hle/service/nvdrv/nvdata.h index 6dbc90e4c..22b1dc79b 100644 --- a/src/core/hle/service/nvdrv/nvdata.h +++ b/src/core/hle/service/nvdrv/nvdata.h @@ -34,4 +34,11 @@ enum class EventState { Busy = 3, }; +struct IoctlCtrl { + bool fresh_call{true}; + bool must_delay{}; + s64 timeout{}; + s32 event_id{-1}; +}; + } // namespace Service::Nvidia diff --git a/src/core/hle/service/nvdrv/nvdrv.cpp b/src/core/hle/service/nvdrv/nvdrv.cpp index b87c228bd..598a1123b 100644 --- a/src/core/hle/service/nvdrv/nvdrv.cpp +++ b/src/core/hle/service/nvdrv/nvdrv.cpp @@ -71,12 +71,13 @@ u32 Module::Open(const std::string& device_name) { return fd; } -u32 Module::Ioctl(u32 fd, u32 command, const std::vector& input, std::vector& output) { +u32 Module::Ioctl(u32 fd, u32 command, const std::vector& input, std::vector& output, + IoctlCtrl& ctrl) { auto itr = open_files.find(fd); ASSERT_MSG(itr != open_files.end(), "Tried to talk to an invalid device"); auto& device = itr->second; - return device->ioctl({command}, input, output); + return device->ioctl({command}, input, output, ctrl); } ResultCode Module::Close(u32 fd) { @@ -103,4 +104,8 @@ Kernel::SharedPtr Module::GetEvent(const u32 event_id) { return events_interface.events[event_id].readable; } +Kernel::SharedPtr Module::GetEventWriteable(const u32 event_id) { + return events_interface.events[event_id].writable; +} + } // namespace Service::Nvidia diff --git a/src/core/hle/service/nvdrv/nvdrv.h b/src/core/hle/service/nvdrv/nvdrv.h index 97b48d150..b7f692962 100644 --- a/src/core/hle/service/nvdrv/nvdrv.h +++ b/src/core/hle/service/nvdrv/nvdrv.h @@ -95,7 +95,8 @@ public: /// Opens a device node and returns a file descriptor to it. u32 Open(const std::string& device_name); /// Sends an ioctl command to the specified file descriptor. - u32 Ioctl(u32 fd, u32 command, const std::vector& input, std::vector& output); + u32 Ioctl(u32 fd, u32 command, const std::vector& input, std::vector& output, + IoctlCtrl& ctrl); /// Closes a device file descriptor and returns operation success. ResultCode Close(u32 fd); @@ -103,6 +104,8 @@ public: Kernel::SharedPtr GetEvent(const u32 event_id); + Kernel::SharedPtr GetEventWriteable(const u32 event_id); + private: /// Id to use for the next open file descriptor. u32 next_fd = 1; -- cgit v1.2.3 From 0335a25d1fcca5328ef79b3c62edb679df63ffba Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Mon, 17 Jun 2019 15:27:42 -0400 Subject: NVServices: Make NVEvents Automatic according to documentation. --- src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp | 7 +++++-- src/core/hle/service/nvdrv/nvdrv.cpp | 4 ++-- src/video_core/gpu.cpp | 7 +++++-- src/video_core/gpu.h | 2 +- 4 files changed, 13 insertions(+), 7 deletions(-) (limited to 'src/core/hle/service/nvdrv/nvdrv.cpp') diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp index e46e6b94c..ffa6e75c7 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp @@ -142,7 +142,6 @@ u32 nvhost_ctrl::IocCtrlEventRegister(const std::vector& input, std::vector< return NvResult::BadParameter; } events_interface.RegisterEvent(event_id); - events_interface.events[event_id].writable->Signal(); return NvResult::Success; } @@ -171,7 +170,11 @@ u32 nvhost_ctrl::IocCtrlEventSignal(const std::vector& input, std::vector Date: Tue, 18 Jun 2019 20:53:21 -0400 Subject: NVServices: Styling, define constructors as explicit and corrections --- src/core/hardware_interrupt_manager.cpp | 8 ++++++- src/core/hardware_interrupt_manager.h | 15 +++++++++---- src/core/hle/service/nvdrv/devices/nvdevice.h | 2 +- src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp | 10 ++------- src/core/hle/service/nvdrv/devices/nvhost_ctrl.h | 4 ++-- .../hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp | 2 +- .../hle/service/nvdrv/devices/nvhost_ctrl_gpu.h | 2 +- .../hle/service/nvdrv/devices/nvhost_nvdec.cpp | 2 +- src/core/hle/service/nvdrv/devices/nvhost_nvdec.h | 2 +- .../hle/service/nvdrv/devices/nvhost_nvjpg.cpp | 2 +- src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h | 2 +- src/core/hle/service/nvdrv/devices/nvhost_vic.cpp | 2 +- src/core/hle/service/nvdrv/devices/nvhost_vic.h | 2 +- src/core/hle/service/nvdrv/devices/nvmap.cpp | 2 +- src/core/hle/service/nvdrv/devices/nvmap.h | 2 +- src/core/hle/service/nvdrv/nvdrv.cpp | 4 ++-- src/core/hle/service/nvdrv/nvdrv.h | 16 ++++++++------ src/core/hle/service/nvflinger/buffer_queue.cpp | 2 +- src/core/hle/service/nvflinger/nvflinger.cpp | 7 +++--- src/core/hle/service/nvflinger/nvflinger.h | 2 +- src/video_core/gpu.cpp | 25 ++++++++++++---------- src/video_core/gpu.h | 18 ++++++---------- src/video_core/gpu_asynch.h | 2 +- src/video_core/gpu_synch.h | 3 ++- 24 files changed, 73 insertions(+), 65 deletions(-) (limited to 'src/core/hle/service/nvdrv/nvdrv.cpp') 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("nvdrv"); const u32 syncpt = static_cast(message >> 32); - const u32 value = static_cast(message & 0x00000000FFFFFFFFULL); + const u32 value = static_cast(message); nvdrv->SignalGPUInterruptSyncpt(syncpt, value); }); } +InterruptManager::~InterruptManager() = default; + void InterruptManager::GPUInterruptSyncpt(const u32 syncpoint_id, const u32 value) { const u64 msg = (static_cast(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& input, std::vector& 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(), ¶ms, sizeof(params)); - gpu.Guard(false); return NvResult::Success; } @@ -82,7 +81,6 @@ u32 nvhost_ctrl::IocCtrlEventWait(const std::vector& input, std::vector& if (params.timeout == 0) { std::memcpy(output.data(), ¶ms, sizeof(params)); - gpu.Guard(false); return NvResult::Timeout; } @@ -91,7 +89,6 @@ u32 nvhost_ctrl::IocCtrlEventWait(const std::vector& input, std::vector& event_id = params.value & 0x00FF; if (event_id >= 64) { std::memcpy(output.data(), ¶ms, sizeof(params)); - gpu.Guard(false); return NvResult::BadParameter; } } else { @@ -119,15 +116,12 @@ u32 nvhost_ctrl::IocCtrlEventWait(const std::vector& input, std::vector& ctrl.must_delay = true; ctrl.timeout = params.timeout; ctrl.event_id = event_id; - gpu.Guard(false); return NvResult::Timeout; } std::memcpy(output.data(), ¶ms, sizeof(params)); - gpu.Guard(false); return NvResult::Timeout; } std::memcpy(output.data(), ¶ms, 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& input, std::vector& output, @@ -143,7 +143,7 @@ private: u32 IocCtrlEventSignal(const std::vector& input, std::vector& 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& input, std::vector& 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& input, std::vector& 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& input, std::vector& 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& input, std::vector& 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& input, std::vector& 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& input, std::vector& 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& input, std::vector& 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& input, std::vector& 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 Module::GetEvent(const u32 event_id) { +Kernel::SharedPtr Module::GetEvent(const u32 event_id) const { return events_interface.events[event_id].readable; } -Kernel::SharedPtr Module::GetEventWriteable(const u32 event_id) { +Kernel::SharedPtr 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 events; std::array status{}; std::array registered{}; std::array assigned_syncpt{}; std::array 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 GetEvent(const u32 event_id); + Kernel::SharedPtr GetEvent(u32 event_id) const; - Kernel::SharedPtr GetEventWriteable(const u32 event_id); + Kernel::SharedPtr 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> 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> BufferQueue::AcquireBuffer() { - std::vector::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 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 -- cgit v1.2.3