gl-renderer: assume pbuffers preserve contents

Graphics / Wayland / Weston - Pekka Paalanen [collabora.com] - 25 February 2021 10:47 UTC

For a pbuffer EGLSurface, assume that EGL swap behavior is "preserved" which means buffer age is always 1 (after the very first eglSwapBuffers()).

EGL pbuffers are always single-buffered.

Mesa EGL Surfaceless platform does not seem to expose EGL_EXT_buffer_age that could have told us the same. Hence all repaints to pbuffer surfaces used to need to repaint the whole output always. This patch makes repainting only the latest damage possible.

Repainting only the latest damage is required for a future test on output damage regions: "tests: add output damage test".

Technically, setting buffer_age to 1 is not correct before the very first eglSwapBuffers(), but to keep the code simpler I chose to rely on a newly enabled output always having full damage anyway.

Checking that EGL_SWAP_BEHAVIOR is EGL_BUFFER_PRESERVED would do too. Unfortunately, Mesa seems to return EGL_BUFFER_DESTROYED, so I cannot fail the headless-backend in that check. Even so, the output damage test actually succeeds.

See also: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4278

1e365c8c gl-renderer: assume pbuffers preserve contents
libweston/renderer-gl/gl-renderer.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)

Upstream: cgit.freedesktop.org


  • Share