diff options
Diffstat (limited to 'src/core/hle')
| -rw-r--r-- | src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp | 14 | ||||
| -rw-r--r-- | src/core/hle/service/nvdrv/nvdrv.h | 2 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp index 8b4867ca7..f9b82b504 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp | |||
| @@ -92,6 +92,7 @@ NvResult nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector | |||
| 92 | if (syncpoint_manager.IsSyncpointExpired(params.syncpt_id, params.threshold)) { | 92 | if (syncpoint_manager.IsSyncpointExpired(params.syncpt_id, params.threshold)) { |
| 93 | params.value = syncpoint_manager.GetSyncpointMin(params.syncpt_id); | 93 | params.value = syncpoint_manager.GetSyncpointMin(params.syncpt_id); |
| 94 | std::memcpy(output.data(), ¶ms, sizeof(params)); | 94 | std::memcpy(output.data(), ¶ms, sizeof(params)); |
| 95 | events_interface.failed[event_id] = false; | ||
| 95 | return NvResult::Success; | 96 | return NvResult::Success; |
| 96 | } | 97 | } |
| 97 | 98 | ||
| @@ -99,6 +100,7 @@ NvResult nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector | |||
| 99 | syncpoint_manager.IsSyncpointExpired(params.syncpt_id, params.threshold)) { | 100 | syncpoint_manager.IsSyncpointExpired(params.syncpt_id, params.threshold)) { |
| 100 | params.value = new_value; | 101 | params.value = new_value; |
| 101 | std::memcpy(output.data(), ¶ms, sizeof(params)); | 102 | std::memcpy(output.data(), ¶ms, sizeof(params)); |
| 103 | events_interface.failed[event_id] = false; | ||
| 102 | return NvResult::Success; | 104 | return NvResult::Success; |
| 103 | } | 105 | } |
| 104 | 106 | ||
| @@ -117,6 +119,7 @@ NvResult nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector | |||
| 117 | event.event->GetWritableEvent().Signal(); | 119 | event.event->GetWritableEvent().Signal(); |
| 118 | params.value = current_syncpoint_value; | 120 | params.value = current_syncpoint_value; |
| 119 | std::memcpy(output.data(), ¶ms, sizeof(params)); | 121 | std::memcpy(output.data(), ¶ms, sizeof(params)); |
| 122 | events_interface.failed[event_id] = false; | ||
| 120 | return NvResult::Success; | 123 | return NvResult::Success; |
| 121 | } | 124 | } |
| 122 | const u32 target_value = current_syncpoint_value - diff; | 125 | const u32 target_value = current_syncpoint_value - diff; |
| @@ -146,6 +149,16 @@ NvResult nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector | |||
| 146 | } | 149 | } |
| 147 | params.value |= event_id; | 150 | params.value |= event_id; |
| 148 | event.event->GetWritableEvent().Clear(); | 151 | event.event->GetWritableEvent().Clear(); |
| 152 | if (events_interface.failed[event_id]) { | ||
| 153 | { | ||
| 154 | auto lk = system.StallCPU(); | ||
| 155 | gpu.WaitFence(params.syncpt_id, target_value); | ||
| 156 | system.UnstallCPU(); | ||
| 157 | } | ||
| 158 | std::memcpy(output.data(), ¶ms, sizeof(params)); | ||
| 159 | events_interface.failed[event_id] = false; | ||
| 160 | return NvResult::Success; | ||
| 161 | } | ||
| 149 | gpu.RegisterSyncptInterrupt(params.syncpt_id, target_value); | 162 | gpu.RegisterSyncptInterrupt(params.syncpt_id, target_value); |
| 150 | std::memcpy(output.data(), ¶ms, sizeof(params)); | 163 | std::memcpy(output.data(), ¶ms, sizeof(params)); |
| 151 | return NvResult::Timeout; | 164 | return NvResult::Timeout; |
| @@ -201,6 +214,7 @@ NvResult nvhost_ctrl::IocCtrlClearEventWait(const std::vector<u8>& input, std::v | |||
| 201 | if (events_interface.status[event_id] == EventState::Waiting) { | 214 | if (events_interface.status[event_id] == EventState::Waiting) { |
| 202 | events_interface.LiberateEvent(event_id); | 215 | events_interface.LiberateEvent(event_id); |
| 203 | } | 216 | } |
| 217 | events_interface.failed[event_id] = true; | ||
| 204 | 218 | ||
| 205 | syncpoint_manager.RefreshSyncpoint(events_interface.events[event_id].fence.id); | 219 | syncpoint_manager.RefreshSyncpoint(events_interface.events[event_id].fence.id); |
| 206 | 220 | ||
diff --git a/src/core/hle/service/nvdrv/nvdrv.h b/src/core/hle/service/nvdrv/nvdrv.h index e2a1dde5b..a5af5b785 100644 --- a/src/core/hle/service/nvdrv/nvdrv.h +++ b/src/core/hle/service/nvdrv/nvdrv.h | |||
| @@ -49,6 +49,8 @@ struct EventInterface { | |||
| 49 | std::array<EventState, MaxNvEvents> status{}; | 49 | std::array<EventState, MaxNvEvents> status{}; |
| 50 | // Tells if an NVEvent is registered or not | 50 | // Tells if an NVEvent is registered or not |
| 51 | std::array<bool, MaxNvEvents> registered{}; | 51 | std::array<bool, MaxNvEvents> registered{}; |
| 52 | // Tells the NVEvent that it has failed. | ||
| 53 | std::array<bool, MaxNvEvents> failed{}; | ||
| 52 | // When an NVEvent is waiting on GPU interrupt, this is the sync_point | 54 | // When an NVEvent is waiting on GPU interrupt, this is the sync_point |
| 53 | // associated with it. | 55 | // associated with it. |
| 54 | std::array<u32, MaxNvEvents> assigned_syncpt{}; | 56 | std::array<u32, MaxNvEvents> assigned_syncpt{}; |