compositor: Store view alpha in the paint node

This is one of the few things backends and renderers still need to grab
from the view.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
Derek Foreman 2026-03-16 12:06:22 -05:00
parent d85618a029
commit 1ec218026a
4 changed files with 8 additions and 3 deletions

View file

@ -315,9 +315,10 @@ drm_plane_state_coords_for_paint_node(struct drm_plane_state *state,
/* The alpha of the view is normalized to alpha value range
* [min_alpha, max_alpha] that got from drm. The alpha value would
* never exceed max_alpha if ev->alpha <= 1.0.
* never exceed max_alpha if pnode->view_alpha <= 1.0.
*/
state->alpha = min_alpha + (uint16_t)round((max_alpha - min_alpha) * ev->alpha);
state->alpha = min_alpha +
(uint16_t)round((max_alpha - min_alpha) * pnode->view_alpha);
}
/**

View file

@ -577,7 +577,7 @@ pnode_can_use_plane(struct drm_output_state *output_state,
}
/* if view has alpha check if this plane supports plane alpha */
if (pnode->view->alpha != 1.0f && plane->alpha_max == plane->alpha_min) {
if (pnode->view_alpha != 1.0f && plane->alpha_max == plane->alpha_min) {
drm_debug(b, "\t\t\t\t[plane] not trying plane %d:"
"plane-alpha not supported\n",
plane->plane_id);

View file

@ -279,6 +279,9 @@ paint_node_update_early(struct weston_paint_node *pnode)
pnode->on_cursor_layer =
pnode->view->layer_link.layer == &compositor->cursor_layer;
if (view_dirty)
pnode->view_alpha = pnode->view->alpha;
pnode->output->paint_node_changes |= pnode->status;
pnode->status &= ~(WESTON_PAINT_NODE_VIEW_DIRTY | \
WESTON_PAINT_NODE_OUTPUT_DIRTY |

View file

@ -721,6 +721,7 @@ struct weston_paint_node {
bool is_fully_opaque;
bool is_fully_blended;
bool on_cursor_layer;
float view_alpha;
/* This node's contents are solid, either from a solid buffer or a
* placeholder.