On 2021-07-29 12:14 p.m., Christian König wrote:
Am 29.07.21 um 11:15 schrieb Pekka Paalanen:
[SNIP]
But how does it then help to wait on the CPU instead?
A compositor does not "wait" literally. It would only check which state set is ready to be used, and uses the most recent set that is ready. Any state sets that are not ready are ignored and reconsidered the next time the compositor updates the screen.
Mhm, then I'm not understanding what Michel's changes are actually doing.
In a nutshell, my mutter MR holds back all Wayland state changes which were committed together with a new buffer (and dependent later ones) until the dma-buf file descriptors for that buffer have become readable. This is achieved by adding the fds to the main event loop (if they aren't readable already when the buffer is committed), and when they become readable, all corresponding state changes are propagated such that they will be taken into account for drawing the next frame.
Depending on which state sets are selected for a screen update, the global window manager state may be updated accordingly, before the drawing commands for the composition can be created.
See what I'm proposing is to either render the next state of the window or compose from the old state (including all atomic properties).
Yes, that's exactly how it would work. It's just that state for a window is not an independent thing, it can affect how unrelated windows are managed.
A simplified example would be two windows side by side where the resizing of one causes the other to move. You can't resize the window or move the other until the buffer with the new size is ready. Until then the compositor uses the old state.
E.g. what do you do if you timeout and can't have the new window content on time? What's the fallback here?
As there is no wait, there is no timeout either.
If the app happens to be frozen (e.g. some weird bug in fence handling to make it never ready, or maybe it's just bugged itself and never drawing again), then the app is frozen, and all the rest of the desktop continues running normally without a glitch.
But that is in contradict to what you told me before.
See when the window should move but fails to draw it's new content what happens?
Are the other windows which would be affected by the move not drawn as well?
Basically, the compositor draws its output as if the new buffer and all connected Wayland state changes had not been committed yet.