With input threads there's no way to synchronize processing of events with any external source which makes it impossible to implement reliable integration tests that use input. Adding a hook at the end of mieqProcessInputEvents is enough for a custom driver to synchronize with the end of input event processing.
A driver using this API is here: p12tic/xf86-input-emulated!1
Refactoring of existing Xorg tests is here: xorg/test/xorg-integration-tests!1 (merged)
This work has already uncovered a serious regression in touch ownership input event handling.