Low FPS with IMMEDIATE mode under Xwayland with direct scanout
Since !27074 (merged) I'm getting low FPS in IMMEDIATE mode if tearing is disabled compositor side or not available for atomic commits.
The reason is already described in the MR: Up to 2 buffers locked up for direct scanout with an overlap of 1/refresh_rate, and the remaining buffer is the current surface state.
I have not tested this but I believe this is not an issue with native wayland since the WSI uses 4 images for both IMMEDIATE and MAILBOX.
This affects several compositors. Sway, cosmic, and jay are affected. GNOME and KDE seem unaffected (see first comment below).
If tearing is enabled, then obviously the 1/refresh_rate overlap is much reduced and there is effectively no issue. But tearing is not always available and then it is unfortunate that IMMEDIATE degrades to FIFO instead of MAILBOX.
To get the highest possible refresh rate (equivalent to tearing being enabled), I further had to increase the image count from 4 to 5. This increased FPS from 450 to 1000. Apparently due to the GPU work mentioned in the code before !27074 (merged).