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 <derek.foreman@collabora.com>
This commit is contained in:
Derek Foreman 2024-12-02 11:11:04 -06:00 committed by Marius Vlad
parent 0ff5ac0f7b
commit 68761d3f11

View file

@ -3749,6 +3749,15 @@ weston_output_repaint(struct weston_output *output, struct timespec *now)
if (ec->view_list_needs_rebuild) if (ec->view_list_needs_rebuild)
weston_compositor_build_view_list(ec); 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, wl_list_for_each(pnode, &output->paint_node_z_order_list,
z_order_link) { z_order_link) {
assert(pnode->view->output_mask & (1u << pnode->output->id)); assert(pnode->view->output_mask & (1u << pnode->output->id));