diff options
| author | 2017-11-25 14:56:57 +0100 | |
|---|---|---|
| committer | 2018-01-08 19:10:25 -0500 | |
| commit | 82151d407d8021fa8865cf8dd51c4d5cf0a4b702 (patch) | |
| tree | 739df280fddbecb50e1a2fa690abe8749486ea2d /src/core/hle/kernel/timer.cpp | |
| parent | IPC: Make DuplicateSession return the Domain instead of the Session if the re... (diff) | |
| download | yuzu-82151d407d8021fa8865cf8dd51c4d5cf0a4b702.tar.gz yuzu-82151d407d8021fa8865cf8dd51c4d5cf0a4b702.tar.xz yuzu-82151d407d8021fa8865cf8dd51c4d5cf0a4b702.zip | |
CoreTiming: Reworked CoreTiming (cherry-picked from Citra #3119)
* CoreTiming: New CoreTiming; Add Test for CoreTiming
Diffstat (limited to 'src/core/hle/kernel/timer.cpp')
| -rw-r--r-- | src/core/hle/kernel/timer.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/core/hle/kernel/timer.cpp b/src/core/hle/kernel/timer.cpp index d7ec93672..a93a6c87a 100644 --- a/src/core/hle/kernel/timer.cpp +++ b/src/core/hle/kernel/timer.cpp | |||
| @@ -14,7 +14,7 @@ | |||
| 14 | namespace Kernel { | 14 | namespace Kernel { |
| 15 | 15 | ||
| 16 | /// The event type of the generic timer callback event | 16 | /// The event type of the generic timer callback event |
| 17 | static int timer_callback_event_type; | 17 | static CoreTiming::EventType* timer_callback_event_type = nullptr; |
| 18 | // TODO(yuriks): This can be removed if Timer objects are explicitly pooled in the future, allowing | 18 | // TODO(yuriks): This can be removed if Timer objects are explicitly pooled in the future, allowing |
| 19 | // us to simply use a pool index or similar. | 19 | // us to simply use a pool index or similar. |
| 20 | static Kernel::HandleTable timer_callback_handle_table; | 20 | static Kernel::HandleTable timer_callback_handle_table; |
| @@ -57,9 +57,7 @@ void Timer::Set(s64 initial, s64 interval) { | |||
| 57 | // Immediately invoke the callback | 57 | // Immediately invoke the callback |
| 58 | Signal(0); | 58 | Signal(0); |
| 59 | } else { | 59 | } else { |
| 60 | u64 initial_microseconds = initial / 1000; | 60 | CoreTiming::ScheduleEvent(nsToCycles(initial), timer_callback_event_type, callback_handle); |
| 61 | CoreTiming::ScheduleEvent(usToCycles(initial_microseconds), timer_callback_event_type, | ||
| 62 | callback_handle); | ||
| 63 | } | 61 | } |
| 64 | } | 62 | } |
| 65 | 63 | ||
| @@ -88,8 +86,7 @@ void Timer::Signal(int cycles_late) { | |||
| 88 | 86 | ||
| 89 | if (interval_delay != 0) { | 87 | if (interval_delay != 0) { |
| 90 | // Reschedule the timer with the interval delay | 88 | // Reschedule the timer with the interval delay |
| 91 | u64 interval_microseconds = interval_delay / 1000; | 89 | CoreTiming::ScheduleEvent(nsToCycles(interval_delay) - cycles_late, |
| 92 | CoreTiming::ScheduleEvent(usToCycles(interval_microseconds) - cycles_late, | ||
| 93 | timer_callback_event_type, callback_handle); | 90 | timer_callback_event_type, callback_handle); |
| 94 | } | 91 | } |
| 95 | } | 92 | } |