mer-packages/qtwayland — pull request #35 by kvahlman (2013-10-17 08:16:43+00:00)
Title: wayland-egl: Add support for extra swaps upon window resizes

If an EGL implementation does not take care of surface resizing through
wayland (native) window resize mechanisms, it is allowed by spec to detect
the resize on eglSwapBuffers(). However, this means that in the junction
of resize there is a possible conflict in rendered size and window size and
the rendering (if this happens to be the last frame rendered for a while)
might be left incomplete or clipped.

Furthermore, some implementations seem to resize the surface *after* the swap
that follows the native window resize, not *during* the swap.

The simplest and possibly most flicker-free solution is to issue an extra
swap when the native window has been resized but new content is not rendered
yet. This requires the SWAP_BEHAVIOR to preserve the buffer contents but
it would allow the implementation to detect the double swap and optimize it
(maybe even completely away).

This patch implements that strategy by querying the window if it needs an
extra swap when the related surface is made current, ie. rendering to it
is starting. Since this problem isn't a concern for many platforms, the
flag is hidden behind a compile-time option so one needs to opt-in for it.

Signed-off-by: Kalle Vahlman