Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 6db6d622 authored by Alec Mouri's avatar Alec Mouri
Browse files

When adding event listener, use fuzzy window for last event time.

* We track the last callback time anyways, so there's no risk of
double-firing
* Without this we might risk missing a dispsync event. E.g., if vsyncs
are at T and T+11, and we're considering SF events with +1 offset, then
SF will fire at T+1. If we immediately deregister the SF listener, then
re-register later at T+13, we miss the event at T+12. But we would
probably be ok to fire at T+13 anyways.

Note that the old last event time inference did allow for this.
See change I742b30a8d28780a44592c4d3077f33d23cf65789...

listener.mLastEventTime = systemTime() - mPeriod / 2 + mPhase - mWakeupLatency;

...with +2/+6 offsets and 16.6ms period, then if SF registers at +7ms
after vsync, then last event time is inferred to be T-1.3ms, and with
reference time T-16.6ms, then the next computed event time ends up being
(floor(((T-1.3) - (T-16.6) - 6)/16.6) + 1)* 16.6 + 6 + T-16.6, which ends up
being T+6ms, which would immediately cause a wakeup. So this change
reintroduces that behavior while keeping the math right.

Bug: 128918820
Test: systrace
Change-Id: If45be5a579628045ba3d9bfe282bf8831fdb5275
parent 5e1371af
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment