libweston: Add visible region to weston_view

Later, we'll want to use the visible region for damage tracking in
paint_nodes. For now, we can use it in the renderers where they've been
calculating it independently to draw paint nodes.

We still can't remove view->clip entirely, because
weston_view_damage_below() may be called before the first render of
a view, when its visible region hasn't been calculated yet. The
clip is empty at that point, which allows weston_view_damage_below()
to "work".

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
Derek Foreman 2023-06-21 16:03:35 -05:00
parent 61cbd8f3c5
commit 7b2ae2ba77
4 changed files with 7 additions and 5 deletions

View File

@ -1657,6 +1657,7 @@ struct weston_view {
unsigned int click_to_activate_serial; unsigned int click_to_activate_serial;
pixman_region32_t clip; /* See weston_view_damage_below() */ pixman_region32_t clip; /* See weston_view_damage_below() */
pixman_region32_t visible; /* Unoccluded region in global space */
float alpha; /* part of geometry, see below */ float alpha; /* part of geometry, see below */
/* Surface geometry state, mutable. /* Surface geometry state, mutable.

View File

@ -484,6 +484,7 @@ weston_view_create_internal(struct weston_surface *surface)
wl_list_init(&view->paint_node_list); wl_list_init(&view->paint_node_list);
pixman_region32_init(&view->clip); pixman_region32_init(&view->clip);
pixman_region32_init(&view->visible);
view->alpha = 1.0; view->alpha = 1.0;
pixman_region32_init(&view->transform.opaque); pixman_region32_init(&view->transform.opaque);
@ -2283,6 +2284,7 @@ weston_view_destroy(struct weston_view *view)
weston_layer_entry_remove(&view->layer_link); weston_layer_entry_remove(&view->layer_link);
pixman_region32_fini(&view->clip); pixman_region32_fini(&view->clip);
pixman_region32_fini(&view->visible);
pixman_region32_fini(&view->geometry.scissor); pixman_region32_fini(&view->geometry.scissor);
pixman_region32_fini(&view->transform.boundingbox); pixman_region32_fini(&view->transform.boundingbox);
pixman_region32_fini(&view->transform.opaque); pixman_region32_fini(&view->transform.opaque);
@ -2931,6 +2933,8 @@ view_accumulate_damage(struct weston_view *view,
pixman_region32_union(&view->plane->damage, pixman_region32_union(&view->plane->damage,
&view->plane->damage, &damage); &view->plane->damage, &damage);
pixman_region32_fini(&damage); pixman_region32_fini(&damage);
pixman_region32_subtract(&view->visible, &view->transform.boundingbox,
opaque);
pixman_region32_copy(&view->clip, opaque); pixman_region32_copy(&view->clip, opaque);
pixman_region32_union(opaque, opaque, &view->transform.opaque); pixman_region32_union(opaque, opaque, &view->transform.opaque);
} }

View File

@ -514,8 +514,7 @@ draw_paint_node(struct weston_paint_node *pnode,
pixman_region32_init(&repaint); pixman_region32_init(&repaint);
pixman_region32_intersect(&repaint, pixman_region32_intersect(&repaint,
&pnode->view->transform.boundingbox, damage); &pnode->view->visible, damage);
pixman_region32_subtract(&repaint, &repaint, &pnode->view->clip);
if (!pixman_region32_not_empty(&repaint)) if (!pixman_region32_not_empty(&repaint))
goto out; goto out;

View File

@ -1257,9 +1257,7 @@ draw_paint_node(struct weston_paint_node *pnode,
return; return;
pixman_region32_init(&repaint); pixman_region32_init(&repaint);
pixman_region32_intersect(&repaint, pixman_region32_intersect(&repaint, &pnode->view->visible, damage);
&pnode->view->transform.boundingbox, damage);
pixman_region32_subtract(&repaint, &repaint, &pnode->view->clip);
if (!pixman_region32_not_empty(&repaint)) if (!pixman_region32_not_empty(&repaint))
goto out; goto out;