compositor: Replace view_has_valid_buffer with paint_node_had_valid_buffer

Backends should be relying on paint nodes for their information, not
views.

Since we always have a paint node when we want to pass a buffer, we can
pass that instead of a view.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
Derek Foreman 2026-03-16 08:53:32 -05:00
parent f4a56f057f
commit febd93e4da
4 changed files with 14 additions and 14 deletions

View file

@ -641,7 +641,7 @@ drm_output_find_plane_for_view(struct drm_output_state *state,
}
/* check view for valid buffer, doesn't make sense to even try */
if (!weston_view_has_valid_buffer(ev)) {
if (!weston_paint_node_has_valid_buffer(pnode)) {
pnode->try_view_on_plane_failure_reasons |=
FAILURE_REASONS_NO_BUFFER;
return NULL;
@ -1104,13 +1104,13 @@ drm_output_propose_state_try_reuse(struct weston_output *output_base,
/* FIXME: If we get here, there should be a valid weston_buffer, and that's
* all we should ever need at this point. If the buffer is deleted while
* attached to a surface right now weston_view_has_valid_buffer() sees the
* attached to a surface right now weston_paint_node_has_valid_buffer() sees the
* buffer as invalid. We don't want that to be the case, but we also don't
* want paint node DIRTY bits to track that. This will be cleaned up in the
* future by chasing down remaining bugs in buffer lifecycle management, at
* which point we replace this with a weston_assert() instead.
*/
if (!weston_view_has_valid_buffer(pnode->view)) {
if (!weston_paint_node_has_valid_buffer(pnode)) {
drm_debug(b, "\t\t[reuse] view %s no longer has a valid buffer\n",
pnode->view->internal_name);
drm_output_state_free(state);
@ -1368,7 +1368,7 @@ drm_output_propose_state(struct weston_output *output_base,
pnode->try_view_on_plane_failure_reasons |=
FAILURE_REASONS_NO_GBM;
if (!weston_view_has_valid_buffer(ev))
if (!weston_paint_node_has_valid_buffer(pnode))
pnode->try_view_on_plane_failure_reasons |=
FAILURE_REASONS_NO_BUFFER;
@ -1635,7 +1635,7 @@ drm_assign_planes(struct weston_output *output_base)
/* Test whether this buffer can ever go into a plane:
* non-shm, or small enough to be a cursor. */
ev->surface->keep_buffer = false;
if (weston_view_has_valid_buffer(ev)) {
if (weston_paint_node_has_valid_buffer(pnode)) {
struct weston_buffer *buffer =
ev->surface->buffer_ref.buffer;
if (buffer->type == WESTON_BUFFER_DMABUF ||

View file

@ -597,7 +597,9 @@ vnc_output_assign_cursor_plane(struct vnc_output *output)
return;
view = pointer->sprite;
if (!weston_view_has_valid_buffer(view))
assert(pointer_pnode);
if (!weston_paint_node_has_valid_buffer(pointer_pnode))
return;
buffer = view->surface->buffer_ref.buffer;
@ -608,8 +610,6 @@ vnc_output_assign_cursor_plane(struct vnc_output *output)
if (format != WL_SHM_FORMAT_ARGB8888)
return;
assert(pointer_pnode);
weston_paint_node_move_to_plane(pointer_pnode, &output->cursor_plane);
output->cursor_surface = view->surface;

View file

@ -2357,18 +2357,18 @@ weston_view_is_fully_blended(struct weston_view *ev, pixman_region32_t *region)
return !pixman_region32_not_empty(&ev->transform.opaque);
}
/** Check if the view has a valid buffer available
/** Check if the paint node has a valid buffer available
*
* @param ev The view to check if it has a valid buffer.
* @param pnode The view to check if it has a valid buffer.
*
* Returns true if the view has a valid buffer or false otherwise.
*/
WL_EXPORT bool
weston_view_has_valid_buffer(struct weston_view *ev)
weston_paint_node_has_valid_buffer(struct weston_paint_node *pnode)
{
if (!ev->surface->buffer_ref.buffer)
if (!pnode->surface->buffer_ref.buffer)
return false;
if (!ev->surface->buffer_ref.buffer->resource)
if (!pnode->surface->buffer_ref.buffer->resource)
return false;
return true;
}

View file

@ -545,7 +545,7 @@ bool
weston_view_is_opaque(struct weston_view *ev, pixman_region32_t *region);
bool
weston_view_has_valid_buffer(struct weston_view *ev);
weston_paint_node_has_valid_buffer(struct weston_paint_node *pnode);
bool
weston_view_takes_input_at_point(struct weston_view *view,