Add KMS thread
This (potentially) adds a KMS thread, and plumbs pointer motions to bypass the main thread for cursor sprite movements.
If it manages to get a real time scheduled thread for dealing with KMS, it uses a CRTC vblank deadline based approach to postpone posting KMS updates until as late as possible, and uses this method to achieve lower latency cursor movements, as well avoiding potential cursor stutter when the main thread is too busy to manage completing a frame in time. If real time scheduling isn't achieved, it works a bit like before, only that cursor movements can happen during e.g. layout, thus we'd still get a bit better latency.
If EGLStream is used, it'll fall back to a "fake" thread, as that is required by EGLStreams. It's also possible to force using fake threads, as that can be useful when debugging.
It's not yet ready, but posting for some visibility. It can launch and move a cursor around, and if the shell is slow, the cursor will usually move without being slowed down by the main thread. The branch being a bit long, it definitely needs to be split up a bit.
But besides that, some things to note:
- Deadline avoidance is hard coded, should be made dynamic to minimize risk for missing the deadline while decreasing mouse movement feedback latency;
- It's not very well tested, especially with hybrid GPU setups and hotplugs etc;
- Haven't measured whether we drop more/less/same amount of frames as before;
- Might want to add debug flags/tweaks to disable things at runtime to be able to compare better;
- A side effect is we get hardware cursor on all monitors that support it, compared to before when scales/capabilities etc had to match;
- KMS cursor management is still mostly untested.
Some things that should not be added here, but should be follow ups/rebases:
- Don't post unready commits, i.e. check readiness similarly to !1880 (merged);
- Now when the shell is busy / slow, the window can lag behind the cursor when moving as in X11, should consider avoiding this by inhibiting bypassing in this case;
- How to interact with VRR.