From 68761d3f113122746c9b4fd4fba281c6df70330e Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Mon, 2 Dec 2024 11:11:04 -0600 Subject: [PATCH] compositor: Ensure the scene graph isn't empty at repaint If the scene graph is empty at repaint the renderer will do nothing to the buffer. On some platforms this results in displaying garbage, and on platforms where we use frame buffer compression we can cause longer lasting visual problems. Make sure we never get here with an empty scene graph. Signed-off-by: Derek Foreman --- libweston/compositor.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libweston/compositor.c b/libweston/compositor.c index a54fe6f49..0c9f93776 100644 --- a/libweston/compositor.c +++ b/libweston/compositor.c @@ -3749,6 +3749,15 @@ weston_output_repaint(struct weston_output *output, struct timespec *now) if (ec->view_list_needs_rebuild) weston_compositor_build_view_list(ec); + /* If the scene graph is empty, we could end up passing a buffer + * we've never drawn into to a hardware plane later. If that hardware + * plane uses compression, the results can be very messy. + * + * Ensure we have scene graph contents here. + */ + assert(!wl_list_empty(&output->paint_node_z_order_list) && + "empty scene graph at repaint"); + wl_list_for_each(pnode, &output->paint_node_z_order_list, z_order_link) { assert(pnode->view->output_mask & (1u << pnode->output->id));