The Compositor class needs an overhaul. Here is a crude overall plan.
Preliminary cleanup
D21654 D21655
D22218 D22220
D22225 D22270
D22277 D22278
D22295
Structure
- Split up Compositor class into X and Wayland subclasses. D22195 D23011 D23032
- All the timers for starting and deleting unused effects properties can likely go into the X child class only. It's only relevant when Compositor selection is given up and reclaimed on X. [1][2]. There is one special case though also on Wayland: when a Gl error is detected in theory the Scene could request a reinit of the Compositor.
- Introduce Frame objects encapsulating single frames, each created at beginning of compositing run and destroyed again on next page-flip.
Features
- Listen for vblank events via
GLX_OML_sync_controlGLX_INTEL_swap_event and DRM page flips.- GLX_OML_sync_control does not provide events but vsync and frame timing control. Since we as compositor are better served by repainting whenever damage is done by one of our clients it is not directly needed. But we might optimize by using it to approximate the next vblank time and sending the frame shortly before that (instead of using the average frame time).
- Fall back to timer when not available (When it's not? See D23105#511957 for on which hardware which extension is available and D23881 for Nvidia solution).
- Some effects have internal timers and require KWin to not block. Keep that possible. Same holds of course for input on Wayland, but this is already threaded.
- With most of relevant reworking patches landed now get feedback asap.
- Compositing per AbstractOutput (i.e. crtc) if possible on Wayland and X, or if not only on Wayland. --> follow up task T5710
One thread per output, this is not so good because there is a single scene spanning all outputs. What could be an idea is to put the rendering pipeline overall into a separate thread. But this needs to go into a follow-up task
Scene integration
We already can paint per screen. Maybe this is already sufficient.
Platform integration
With AbstractOutput.
[1] https://git.reviewboard.kde.org/r/106844/
[2] https://git.reviewboard.kde.org/r/110232