scene: keep last preferred configuration when leaving last output

Before this patch, when a surface became occluded on all outputs,
we'd reconfigure it with a base configuration (scale set to 1,
transform set to NORMAL, image description set to gamma 2.2/sRGB).
As a result, when quickly hiding a toplevel and showing it again,
the client would render to switch to the base configuration, then
render again to switch to the output configuration.

Avoi this needless back-and-forth by retaining the last sent
preferred configuration when a surface leaves all outputs.
This commit is contained in:
Simon Ser 2026-01-03 23:16:56 +01:00 committed by Kenny Levinsen
parent ca8b49d858
commit 3f9a164484

View file

@ -96,6 +96,12 @@ static void handle_scene_buffer_outputs_update(
surface->frame_pacing_output = get_surface_frame_pacing_output(surface->surface);
// If the surface is no longer visible on any output, keep the last sent
// preferred configuration to avoid unnecessary redraws
if (wl_list_empty(&surface->surface->current_outputs)) {
return;
}
double scale = get_surface_preferred_buffer_scale(surface->surface);
wlr_fractional_scale_v1_notify_scale(surface->surface, scale);
wlr_surface_set_preferred_buffer_scale(surface->surface, ceil(scale));