libweston: Cull paint nodes when their views aren't on their outputs

In the future when we track damage with paint nodes we have a problem when
a paint node is moved off of its output - it immediately stops being
present, so we don't generate damage for the move that placed it off
screen.

We don't want paint nodes to exist when their view isn't on their output
anyway, so let's cull these nodes at the point where we assign outputs to
views.

In the damage-from-paint-nodes future, this will let us properly post
damage when the paint node is destroyed.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
Derek Foreman 2023-06-28 09:17:56 -05:00
parent e5dfc3bc1e
commit 85e3a4723b

View file

@ -1286,6 +1286,7 @@ weston_view_assign_output(struct weston_view *ev)
{
struct weston_compositor *ec = ev->surface->compositor;
struct weston_output *output, *new_output;
struct weston_paint_node *pnode, *pntmp;
pixman_region32_t region;
uint32_t max, area, mask;
pixman_box32_t *e;
@ -1318,6 +1319,12 @@ weston_view_assign_output(struct weston_view *ev)
ev->output_mask = mask;
weston_surface_assign_output(ev->surface);
/* Destroy any paint nodes that no longer appear on their output */
wl_list_for_each_safe(pnode, pntmp, &ev->paint_node_list, view_link) {
if (!(pnode->view->output_mask & (1u << pnode->output->id)))
weston_paint_node_destroy(pnode);
}
}
static void