Glitches and performance issues of the window resize animation
When resizing windows, it (occasionally?/often?) happens that Mutter shows the resized window for a split second before properly starting the resize animation. I see this especially with Firefox on Wayland, which always uses subsurface, therefore taking the slow path for getting the window image.
It is even visible in screencasts: maximizing Firefox two times, once without, once with glitch Screencast_from_18.12.2019_21_56_29
As far as I can see there are two issues at play here:
- As getting the image can be slow, the animation is started asynchronously. If the image arrives a frame to late, the resized window is shown in between.
- Getting the image is slower then necessary: we take a full round trip from GPU to RAM and back for the image. I guess this can be pretty bad on 8K screens with dedicated graphic cards. On iGPUs and lower resolutions it should be better as RAM and caches are often shared to a certain extend.
For 1., I wonder if we could somehow delay the actual resize until we're ready to start the animation
For 2., we could probably introduce some clutter content type holding a 'snapshot' of another clutter content, from the moment it is initialized, in an offscreen FB or so.