kms/impl-device: Adjust deadline times according to dispatch lateness

We treat the lateness measurements as a normal distribution, but instead of keeping a list of samples we just keep a decaying average of the samples.

As a normal(ish) distribution the three sigma rule tells us that 99.73% of all samples will be within three standard deviations of the mean. So mean lateness plus three standard deviations thereof is the amount by which we adjust the deadline time.

This approach seems to come to the same conclusion as I did previously by trial and error (!3212 (merged)): that low frequency input devices require an additional ~300µs of deadline evasion. But it's now clear the reason for that is to account for the late dispatch which occurs when the CPU frequency is staying low with low frequency input.

Closes: #2974 (closed)

Merge request reports