diff options
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp index 775e76330..8b4867ca7 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp | |||
| @@ -111,7 +111,6 @@ NvResult nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector | |||
| 111 | event.event->GetWritableEvent().Signal(); | 111 | event.event->GetWritableEvent().Signal(); |
| 112 | return NvResult::Success; | 112 | return NvResult::Success; |
| 113 | } | 113 | } |
| 114 | auto lock = gpu.LockSync(); | ||
| 115 | const u32 current_syncpoint_value = event.fence.value; | 114 | const u32 current_syncpoint_value = event.fence.value; |
| 116 | const s32 diff = current_syncpoint_value - params.threshold; | 115 | const s32 diff = current_syncpoint_value - params.threshold; |
| 117 | if (diff >= 0) { | 116 | if (diff >= 0) { |
| @@ -132,23 +131,24 @@ NvResult nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector | |||
| 132 | } | 131 | } |
| 133 | 132 | ||
| 134 | EventState status = events_interface.status[event_id]; | 133 | EventState status = events_interface.status[event_id]; |
| 135 | if (event_id < MaxNvEvents || status == EventState::Free || status == EventState::Registered) { | 134 | const bool bad_parameter = status != EventState::Free && status != EventState::Registered; |
| 136 | events_interface.SetEventStatus(event_id, EventState::Waiting); | 135 | if (bad_parameter) { |
| 137 | events_interface.assigned_syncpt[event_id] = params.syncpt_id; | ||
| 138 | events_interface.assigned_value[event_id] = target_value; | ||
| 139 | if (is_async) { | ||
| 140 | params.value = params.syncpt_id << 4; | ||
| 141 | } else { | ||
| 142 | params.value = ((params.syncpt_id & 0xfff) << 16) | 0x10000000; | ||
| 143 | } | ||
| 144 | params.value |= event_id; | ||
| 145 | event.event->GetWritableEvent().Clear(); | ||
| 146 | gpu.RegisterSyncptInterrupt(params.syncpt_id, target_value); | ||
| 147 | std::memcpy(output.data(), ¶ms, sizeof(params)); | 136 | std::memcpy(output.data(), ¶ms, sizeof(params)); |
| 148 | return NvResult::Timeout; | 137 | return NvResult::BadParameter; |
| 149 | } | 138 | } |
| 139 | events_interface.SetEventStatus(event_id, EventState::Waiting); | ||
| 140 | events_interface.assigned_syncpt[event_id] = params.syncpt_id; | ||
| 141 | events_interface.assigned_value[event_id] = target_value; | ||
| 142 | if (is_async) { | ||
| 143 | params.value = params.syncpt_id << 4; | ||
| 144 | } else { | ||
| 145 | params.value = ((params.syncpt_id & 0xfff) << 16) | 0x10000000; | ||
| 146 | } | ||
| 147 | params.value |= event_id; | ||
| 148 | event.event->GetWritableEvent().Clear(); | ||
| 149 | gpu.RegisterSyncptInterrupt(params.syncpt_id, target_value); | ||
| 150 | std::memcpy(output.data(), ¶ms, sizeof(params)); | 150 | std::memcpy(output.data(), ¶ms, sizeof(params)); |
| 151 | return NvResult::BadParameter; | 151 | return NvResult::Timeout; |
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | NvResult nvhost_ctrl::IocCtrlEventRegister(const std::vector<u8>& input, std::vector<u8>& output) { | 154 | NvResult nvhost_ctrl::IocCtrlEventRegister(const std::vector<u8>& input, std::vector<u8>& output) { |