On Mon Nov 27 17:01:04 2023 +0000, Rémi Bernon wrote:
Any reason to delay that until the first present and not do it right away when we set needs_content to TRUE?
There are a couple of reasons why we don't want to present the empty buffer at that point:
1. We will introduce an empty frame which may cause flickering if the surface has (out-of-date) contents already (e.g., during resizes). 2. It is wasteful since in most cases we do not need to ensure contents that early (or at all for non-Vulkan apps), and by the time we need them they may have already been provided by the app.
This mechanism is only needed when Vulkan (or other users of the client subsurface in the future) tries to present before the main surface has been flushed with contents matching the latest window size (the most usual scenario is when a window becomes fullscreen and never gets any non-Vulkan contents).
Now, while thinking about all this, I realized that there is a simpler way to express the requirement for up-to-date contents, by tracking the buffer size committed to a surface and checking it against the window size. I have updated the MR accordingly. Let me know what you think.