eXeC64 / imv

Image viewer for X11/Wayland
MIT License
800 stars 57 forks source link

wayland: committing resized buffer is delayed #340

Closed vyivel closed 3 years ago

vyivel commented 3 years ago

As far as I understand, this is what happens on window resize: 1) A compositor sends a configure event, saving its serial number and waiting. 2) imv receives the event and calls wl_egl_window_resize(). However, this call has no effect yet, as eglSwapBuffers() hasn't been called. 3) imv pushes a resize event to its own event queue. 4) imv acks the configure with the old buffer size. 5) The compositor receives an ack_configure request with the saved serial number, but imv's size wasn't updated. 6) imv handles its own resize event, redraws, calls eglSwapBuffers() and commits a new buffer with a new size. 7) The compositor receives a commit with an unexpected size change.

Instead, imv should redraw right after calling wl_egl_window_resize(). Calling eglSwapBuffers() in toplevel_configure() fixes the problem, while unsurprisingly introducing rendering issues.

vyivel commented 3 years ago

Nevermind, this issue seems to be present with every(?) program that uses EGL for rendering (e.g. weston-simple-egl).