libweston: introduce weston_paint_node

This new object is created for every surface-view-output triplet. As
there is always exactly one surface for a view and it does not change
during a view's lifetime, this is really for a view-output pair or a
surface-output pair.

The object is created on-demand as a part of preparing for an output
repaint, so it applies only to surfaces that are going through repaint.
A prerequisite for that is that the surface is mapped, which means it
has a mapped view.

When any one of surface or view gets destroyed or output gets disabled,
all related paint nodes are destroyed.

In future, paint node will be useful for caching surface-output or
view-output pair dependent data:
- damage regions for overlapping outputs
- color transformations
- backend-specific bookkeeping (e.g. DRM KMS plane assigments)
- per-output repaint lists
- surface geometry transformed into output space

Suggested by Daniel Stone in
https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/582#note_899406

PS. The call in weston_view_destroy() to
weston_compositor_build_view_list() might be so that if the view has
sub-surfaces, rebuilding the view list removes those those too and
automagically deletes their views.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
Pekka Paalanen
2021-04-30 14:48:52 +03:00
parent 7ee4149c9e
commit 1a4f87dec5
3 changed files with 143 additions and 12 deletions
+10 -1
View File
@@ -1,6 +1,6 @@
/*
* Copyright © 2008-2011 Kristian Høgsberg
* Copyright © 2012, 2017, 2018 Collabora, Ltd.
* Copyright © 2012, 2017, 2018, 2021 Collabora, Ltd.
* Copyright © 2017, 2018 General Electric Company
*
* Permission is hereby granted, free of charge, to any person obtaining
@@ -280,6 +280,9 @@ struct weston_output {
struct wl_list link;
struct weston_compositor *compositor;
/* struct weston_paint_node::output_link */
struct wl_list paint_node_list;
/** From global to output buffer coordinates. */
struct weston_matrix matrix;
/** From output buffer to global coordinates. */
@@ -1268,6 +1271,9 @@ struct weston_view {
struct wl_list surface_link;
struct wl_signal destroy_signal;
/* struct weston_paint_node::view_link */
struct wl_list paint_node_list;
struct wl_list link; /* weston_compositor::view_list */
struct weston_layer_entry layer_link; /* part of geometry */
struct weston_plane *plane;
@@ -1427,6 +1433,9 @@ struct weston_surface {
struct weston_compositor *compositor;
struct wl_signal commit_signal;
/* struct weston_paint_node::surface_link */
struct wl_list paint_node_list;
/** Damage in local coordinates from the client, for tex upload. */
pixman_region32_t damage;