core: Don't rebuild view list on surface-local changes

If a surface changes size or opaque region, or a view changes position,
we don't need to rebuild the entire view list from scratch: we can just
rebuild what's changed and nothing else.

Signed-off-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
Daniel Stone 2025-10-13 14:57:12 +01:00 committed by Derek Foreman
parent 562a368fbd
commit abfe874a51
3 changed files with 13 additions and 9 deletions

View file

@ -111,9 +111,6 @@ static void
subsurface_committed(struct weston_surface *surface, subsurface_committed(struct weston_surface *surface,
struct weston_coord_surface new_origin); struct weston_coord_surface new_origin);
static void
weston_view_geometry_dirty_internal(struct weston_view *view);
static bool static bool
weston_view_is_fully_blended(struct weston_view *ev, weston_view_is_fully_blended(struct weston_view *ev,
pixman_region32_t *region); pixman_region32_t *region);
@ -1884,7 +1881,7 @@ weston_view_update_transform(struct weston_view *view)
} }
} }
static void void
weston_view_geometry_dirty_internal(struct weston_view *view) weston_view_geometry_dirty_internal(struct weston_view *view)
{ {
struct weston_view *child; struct weston_view *child;
@ -1987,7 +1984,8 @@ weston_view_set_rel_position(struct weston_view *view,
return; return;
view->geometry.pos_offset = offset.c; view->geometry.pos_offset = offset.c;
weston_view_geometry_dirty(view); weston_view_geometry_dirty_internal(view);
weston_view_update_transform(view);
} }
WL_EXPORT void WL_EXPORT void
@ -2002,7 +2000,8 @@ weston_view_set_position(struct weston_view *view,
return; return;
view->geometry.pos_offset = pos.c; view->geometry.pos_offset = pos.c;
weston_view_geometry_dirty(view); weston_view_geometry_dirty_internal(view);
weston_view_update_transform(view);
} }
WL_EXPORT void WL_EXPORT void
@ -2373,7 +2372,7 @@ surface_set_size(struct weston_surface *surface, int32_t width, int32_t height)
surface->height = height; surface->height = height;
wl_list_for_each(view, &surface->views, surface_link) wl_list_for_each(view, &surface->views, surface_link)
weston_view_geometry_dirty(view); weston_view_geometry_dirty_internal(view);
} }
WL_EXPORT void WL_EXPORT void

View file

@ -554,6 +554,9 @@ bool
weston_view_takes_input_at_point(struct weston_view *view, weston_view_takes_input_at_point(struct weston_view *view,
struct weston_coord_surface surf_pos); struct weston_coord_surface surf_pos);
void
weston_view_geometry_dirty_internal(struct weston_view *view);
void void
weston_paint_node_move_to_plane(struct weston_paint_node *pnode, weston_paint_node_move_to_plane(struct weston_paint_node *pnode,
struct weston_plane *plane); struct weston_plane *plane);

View file

@ -340,8 +340,10 @@ weston_surface_apply_state(struct weston_surface *surface,
if (!pixman_region32_equal(&opaque, &surface->opaque)) { if (!pixman_region32_equal(&opaque, &surface->opaque)) {
pixman_region32_copy(&surface->opaque, &opaque); pixman_region32_copy(&surface->opaque, &opaque);
wl_list_for_each(view, &surface->views, surface_link) wl_list_for_each(view, &surface->views, surface_link) {
weston_view_geometry_dirty(view); weston_view_geometry_dirty_internal(view);
weston_view_update_transform(view);
}
} }
pixman_region32_fini(&opaque); pixman_region32_fini(&opaque);