diff options
author | bunnei <bunneidev@gmail.com> | 2019-10-16 16:34:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-16 16:34:48 +0200 |
commit | ef9b31783d2c6af6ec21e5a8a4a9de4e340295c7 (patch) | |
tree | ccf16ff57bd3213bd364c6d96e1e702fe9e961a0 /src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp | |
parent | Merge pull request #2984 from lioncash/fallthrough2 (diff) | |
parent | AsyncGpu: Address Feedback (diff) | |
download | yuzu-ef9b31783d2c6af6ec21e5a8a4a9de4e340295c7.tar yuzu-ef9b31783d2c6af6ec21e5a8a4a9de4e340295c7.tar.gz yuzu-ef9b31783d2c6af6ec21e5a8a4a9de4e340295c7.tar.bz2 yuzu-ef9b31783d2c6af6ec21e5a8a4a9de4e340295c7.tar.lz yuzu-ef9b31783d2c6af6ec21e5a8a4a9de4e340295c7.tar.xz yuzu-ef9b31783d2c6af6ec21e5a8a4a9de4e340295c7.tar.zst yuzu-ef9b31783d2c6af6ec21e5a8a4a9de4e340295c7.zip |
Diffstat (limited to 'src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp')
-rw-r--r-- | src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp | 33 |
1 files changed, 11 insertions, 22 deletions
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp index eb88fee1b..b27ee0502 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp @@ -63,16 +63,26 @@ u32 nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector<u8>& return NvResult::BadParameter; } + u32 event_id = params.value & 0x00FF; + + if (event_id >= MaxNvEvents) { + std::memcpy(output.data(), ¶ms, sizeof(params)); + return NvResult::BadParameter; + } + + auto event = events_interface.events[event_id]; auto& gpu = system.GPU(); // This is mostly to take into account unimplemented features. As synced // gpu is always synced. if (!gpu.IsAsync()) { + event.writable->Signal(); return NvResult::Success; } auto lock = gpu.LockSync(); const u32 current_syncpoint_value = gpu.GetSyncpointValue(params.syncpt_id); const s32 diff = current_syncpoint_value - params.threshold; if (diff >= 0) { + event.writable->Signal(); params.value = current_syncpoint_value; std::memcpy(output.data(), ¶ms, sizeof(params)); return NvResult::Success; @@ -88,27 +98,6 @@ u32 nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector<u8>& return NvResult::Timeout; } - u32 event_id; - if (is_async) { - event_id = params.value & 0x00FF; - if (event_id >= MaxNvEvents) { - std::memcpy(output.data(), ¶ms, sizeof(params)); - return NvResult::BadParameter; - } - } else { - if (ctrl.fresh_call) { - const auto result = events_interface.GetFreeEvent(); - if (result) { - event_id = *result; - } else { - LOG_CRITICAL(Service_NVDRV, "No Free Events available!"); - event_id = params.value & 0x00FF; - } - } else { - event_id = ctrl.event_id; - } - } - EventState status = events_interface.status[event_id]; if (event_id < MaxNvEvents || status == EventState::Free || status == EventState::Registered) { events_interface.SetEventStatus(event_id, EventState::Waiting); @@ -120,7 +109,7 @@ u32 nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector<u8>& params.value = ((params.syncpt_id & 0xfff) << 16) | 0x10000000; } params.value |= event_id; - events_interface.events[event_id].writable->Clear(); + event.writable->Clear(); gpu.RegisterSyncptInterrupt(params.syncpt_id, target_value); if (!is_async && ctrl.fresh_call) { ctrl.must_delay = true; |