libweston: Delete paint nodes when views change layers

Since we use paint nodes to track damage, we have to be very careful to
make sure that we never have paint nodes that aren't actually being
displayed on their outputs.

Shells may move views to invisible layers (minimized_layer, inactive_layer)
and this currently leaves the paint node alive but not visible on its
output.

When this happens, the paint node's previous visible region is left
undamaged, and the paint node is removed from processing.

Let's delete paint nodes when their views change layers, thus creating
damage for their full visible region.

This may create excess damage if the paint node moves between two visible
layers, but this is probably far less harmful than leaving pieces of
invisible views on screen.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
Derek Foreman 2023-07-31 14:38:38 -05:00 committed by Marius Vlad
parent ea4700c81f
commit b75f1c0fd1

View File

@ -3725,10 +3725,17 @@ weston_view_move_to_layer(struct weston_view *view,
struct weston_layer_entry *layer)
{
bool was_mapped = view->is_mapped;
struct weston_paint_node *pnode, *pntmp;
if (layer == &view->layer_link)
return;
/* Remove all paint nodes because we have no idea what a layer change
* does to view visibility on any output.
*/
wl_list_for_each_safe(pnode, pntmp, &view->paint_node_list, view_link)
weston_paint_node_destroy(pnode);
view->surface->compositor->view_list_needs_rebuild = true;
/* Damage the view's old region, and remove it from the layer. */