diff options
| author | 2019-07-04 09:55:50 -0400 | |
|---|---|---|
| committer | 2019-07-05 15:49:34 -0400 | |
| commit | 8c91d5c16614ac42efee7c1858cb338d65861154 (patch) | |
| tree | e383ef077df218f84a3aa686fabbac52d46a0a8c /src | |
| parent | NVServices: Address Feedback (diff) | |
| download | yuzu-8c91d5c16614ac42efee7c1858cb338d65861154.tar.gz yuzu-8c91d5c16614ac42efee7c1858cb338d65861154.tar.xz yuzu-8c91d5c16614ac42efee7c1858cb338d65861154.zip | |
Nv_Host_Ctrl: Correct difference calculation
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp index 1f178d17d..9a66a5f88 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp | |||
| @@ -68,12 +68,14 @@ u32 nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector<u8>& | |||
| 68 | return NvResult::Success; | 68 | return NvResult::Success; |
| 69 | } | 69 | } |
| 70 | auto lock = gpu.LockSync(); | 70 | auto lock = gpu.LockSync(); |
| 71 | u32 current_syncpoint_value = gpu.GetSyncpointValue(params.syncpt_id); | 71 | const u32 current_syncpoint_value = gpu.GetSyncpointValue(params.syncpt_id); |
| 72 | if (current_syncpoint_value >= params.threshold) { | 72 | const s32 diff = current_syncpoint_value - params.threshold; |
| 73 | if (diff >= 0) { | ||
| 73 | params.value = current_syncpoint_value; | 74 | params.value = current_syncpoint_value; |
| 74 | std::memcpy(output.data(), ¶ms, sizeof(params)); | 75 | std::memcpy(output.data(), ¶ms, sizeof(params)); |
| 75 | return NvResult::Success; | 76 | return NvResult::Success; |
| 76 | } | 77 | } |
| 78 | const u32 target_value = current_syncpoint_value - diff; | ||
| 77 | 79 | ||
| 78 | if (!is_async) { | 80 | if (!is_async) { |
| 79 | params.value = 0; | 81 | params.value = 0; |
| @@ -109,7 +111,7 @@ u32 nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector<u8>& | |||
| 109 | if (event_id < MaxNvEvents || status == EventState::Free || status == EventState::Registered) { | 111 | if (event_id < MaxNvEvents || status == EventState::Free || status == EventState::Registered) { |
| 110 | events_interface.SetEventStatus(event_id, EventState::Waiting); | 112 | events_interface.SetEventStatus(event_id, EventState::Waiting); |
| 111 | events_interface.assigned_syncpt[event_id] = params.syncpt_id; | 113 | events_interface.assigned_syncpt[event_id] = params.syncpt_id; |
| 112 | events_interface.assigned_value[event_id] = params.threshold; | 114 | events_interface.assigned_value[event_id] = target_value; |
| 113 | if (is_async) { | 115 | if (is_async) { |
| 114 | params.value = params.syncpt_id << 4; | 116 | params.value = params.syncpt_id << 4; |
| 115 | } else { | 117 | } else { |
| @@ -117,7 +119,7 @@ u32 nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector<u8>& | |||
| 117 | } | 119 | } |
| 118 | params.value |= event_id; | 120 | params.value |= event_id; |
| 119 | events_interface.events[event_id].writable->Clear(); | 121 | events_interface.events[event_id].writable->Clear(); |
| 120 | gpu.RegisterSyncptInterrupt(params.syncpt_id, params.threshold); | 122 | gpu.RegisterSyncptInterrupt(params.syncpt_id, target_value); |
| 121 | if (!is_async && ctrl.fresh_call) { | 123 | if (!is_async && ctrl.fresh_call) { |
| 122 | ctrl.must_delay = true; | 124 | ctrl.must_delay = true; |
| 123 | ctrl.timeout = params.timeout; | 125 | ctrl.timeout = params.timeout; |
| @@ -167,7 +169,7 @@ u32 nvhost_ctrl::IocCtrlEventSignal(const std::vector<u8>& input, std::vector<u8 | |||
| 167 | // TODO(Blinkhawk): This is normally called when an NvEvents timeout on WaitSynchronization | 169 | // TODO(Blinkhawk): This is normally called when an NvEvents timeout on WaitSynchronization |
| 168 | // It is believed from RE to cancel the GPU Event. However, better research is required | 170 | // It is believed from RE to cancel the GPU Event. However, better research is required |
| 169 | u32 event_id = params.user_event_id & 0x00FF; | 171 | u32 event_id = params.user_event_id & 0x00FF; |
| 170 | LOG_DEBUG(Service_NVDRV, " called, user_event_id: {:X}", event_id); | 172 | LOG_WARNING(Service_NVDRV, "(STUBBED) called, user_event_id: {:X}", event_id); |
| 171 | if (event_id >= MaxNvEvents) { | 173 | if (event_id >= MaxNvEvents) { |
| 172 | return NvResult::BadParameter; | 174 | return NvResult::BadParameter; |
| 173 | } | 175 | } |