compositor: store and use a clipped view in the paint node

Instead of clipping the visible region to the output, clip the entire
region to the output first and save that, then create the visible region
from that.

Now we have both the clipped and visible view regions that the backends
may want to do plane assignment stored in paint nodes, so we can save
some duplicate math.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
Derek Foreman 2025-10-17 11:02:51 -05:00 committed by Daniel Stone
parent 48aaf6434d
commit 58298e2346
2 changed files with 8 additions and 5 deletions

View file

@ -406,6 +406,7 @@ weston_paint_node_create(struct weston_surface *surface,
pixman_region32_init(&pnode->damage);
pixman_region32_init(&pnode->visible);
pixman_region32_init(&pnode->visible_previous);
pixman_region32_init(&pnode->clipped_view);
pixman_region32_copy(&pnode->visible, &view->transform.boundingbox);
pnode->plane = &pnode->output->primary_plane;
@ -434,6 +435,7 @@ weston_paint_node_destroy(struct weston_paint_node *pnode)
pixman_region32_fini(&pnode->damage);
pixman_region32_fini(&pnode->visible);
pixman_region32_fini(&pnode->visible_previous);
pixman_region32_fini(&pnode->clipped_view);
free(pnode);
}
@ -3223,13 +3225,13 @@ paint_node_update_visible(struct weston_paint_node *pnode,
pixman_region32_copy(&pnode->visible_previous, &pnode->visible);
pixman_region32_subtract(&pnode->visible, &view->transform.boundingbox,
pixman_region32_intersect(&pnode->clipped_view,
&view->transform.boundingbox,
&pnode->output->region);
pixman_region32_subtract(&pnode->visible, &pnode->clipped_view,
opaque);
pixman_region32_union(opaque, opaque, &view->transform.opaque);
pixman_region32_intersect(&pnode->visible,
&pnode->visible,
&pnode->output->region);
}

View file

@ -706,6 +706,7 @@ struct weston_paint_node {
pixman_region32_t visible_previous;
pixman_region32_t visible;
pixman_region32_t clipped_view;
pixman_region32_t damage; /* In global coordinates */
struct weston_plane *plane;
struct weston_plane *plane_next;