compositor,renderers: Store a pointer to the view transform in pnode

This pointer is the same for the life of the view, even if the matrix
changes.

This is a last pedantic step towards preventing renderers from directly
accessing a weston_view.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
Derek Foreman 2026-03-17 11:31:59 -05:00
parent 14d59f6ab1
commit 7ed55f8390
4 changed files with 6 additions and 3 deletions

View file

@ -553,6 +553,8 @@ weston_paint_node_create(struct weston_surface *surface,
pnode->plane = &pnode->output->primary_plane;
pnode->plane_next = NULL;
pnode->view_transform_matrix = &view->transform.matrix;
pnode->need_hole = false;
pnode->status =
WESTON_PAINT_NODE_ALL_DIRTY & ~WESTON_PAINT_NODE_PLANE_DIRTY;

View file

@ -687,6 +687,7 @@ struct weston_paint_node {
/* struct weston_view::paint_node_list */
struct wl_list view_link;
struct weston_view *view;
struct weston_matrix *view_transform_matrix;
/* struct weston_output::paint_node_list */
struct wl_list output_link;

View file

@ -1728,7 +1728,7 @@ prepare_solid_draw(struct gl_shader_config *sconf,
.variant = SHADER_VARIANT_SOLID,
.input_is_premult = true,
},
.projection = pnode->view->transform.matrix,
.projection = *pnode->view_transform_matrix,
.view_alpha = pnode->view_alpha,
.unicolor = { pnode->solid.r,
pnode->solid.g,
@ -1917,7 +1917,7 @@ prepare_textured_draw(struct gl_shader_config *sconf,
*sconf = (struct gl_shader_config) {
.req.texcoord_input = SHADER_TEXCOORD_INPUT_SURFACE,
.projection = pnode->view->transform.matrix,
.projection = *pnode->view_transform_matrix,
.surface_to_buffer =
pnode->surface->surface_to_buffer_matrix,
.view_alpha = pnode->view_alpha,

View file

@ -1523,7 +1523,7 @@ vulkan_pipeline_config_init_for_paint_node(struct vulkan_pipeline_config *pconf,
.renderpass = vo->renderpass,
.green_tint = (vr->debug_mode == DEBUG_MODE_FRAGMENT),
},
.projection = pnode->view->transform.matrix,
.projection = *pnode->view_transform_matrix,
.surface_to_buffer =
pnode->surface->surface_to_buffer_matrix,
.view_alpha = pnode->view_alpha,