swaylock icon indicating copy to clipboard operation
swaylock copied to clipboard

Swaylock can run out of buffers when output is resized

Open mstoeckl opened this issue 3 years ago • 0 comments

When running Sway nested under wayland or x11, it is possible to dynamically resize the outputs. Most of the time, swaylock correctly redraws when this is done. However, if rendering a frame takes a long time -- which can happen when running swaylock -i large_image.png -- sometimes swaylock fails to provide a properly sized buffer for the new output size. In this case, the background will only cover a portion of the screen, revealing whatever is underneath the rest.

This behavior stems from the limited number of background buffers associated with a given struct swaylock_surface. If swaylock is made to render a new frame background at least three times in short succession, it will render and submit two buffers, but will run out of buffers on the third call to render_frame_background. This can happen if the output is resized many times in a second, so that swaylock receives a large number of layer surface configure events in one batch; in that case, it will try to render a new frame background for each.

mstoeckl avatar May 18 '21 22:05 mstoeckl