egl/wayland: wait for compositor to release shm buffers
authorRobert Mader <robert.mader@collabora.com>
Tue, 11 Jul 2023 14:24:41 +0000 (16:24 +0200)
committerMarge Bot <emma+marge@anholt.net>
Wed, 19 Jul 2023 15:11:46 +0000 (15:11 +0000)
commit74451ed3f0832694c8c1fb8fbfe42b4ed2688d4a
treeceeee5a88758809435b741071551ffe4861ada28
parent2a6fc690c18ad0e22eb0550bae6a26f222f3f182
egl/wayland: wait for compositor to release shm buffers

Some Wayland compositors, notably Exo, do not always release buffers
fast enough, and not in sync with their frame callbacks, to guarantee
that a free buffer is available the next time a client calls
`eglSwapBuffers()`.

This currently leads to a crash in `dri2_wl_swrast_get_backbuffer_data()`
with the swrast backend. To avoid this, simply block until the
compositor releases a buffer eventually.

While arguably compositors should release buffers they don't need any
more for the next frame, this can be quite complex depending on
the architecture - notably multi-process/IPC in case of Exo.

cc: mesa-stable

Signed-off-by: Robert Mader <robert.mader@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24091>
src/egl/drivers/dri2/platform_wayland.c