From b2e6a6438f7fb22ce273b2144527ed11eba46cba Mon Sep 17 00:00:00 2001 From: Marius Vlad Date: Fri, 24 May 2024 12:48:10 +0300 Subject: [PATCH] libweston: Don't add frame callbacks from occluded paint nodes This changes the callback frame list insertion after paint node late update takes place in order for to the visibily region to be modified. Signed-off-by: Marius Vlad --- libweston/compositor.c | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/libweston/compositor.c b/libweston/compositor.c index aa032d1ec..04d1279bd 100644 --- a/libweston/compositor.c +++ b/libweston/compositor.c @@ -3583,21 +3583,6 @@ weston_output_repaint(struct weston_output *output) } } - wl_list_init(&frame_callback_list); - wl_list_for_each(pnode, &output->paint_node_z_order_list, - z_order_link) { - /* Note: This operation is safe to do multiple times on the - * same surface. - */ - if (pnode->surface->output == output) { - wl_list_insert_list(&frame_callback_list, - &pnode->surface->frame_callback_list); - wl_list_init(&pnode->surface->frame_callback_list); - - weston_output_take_feedback_list(output, pnode->surface); - } - } - output_update_visibility(output); wl_list_for_each(pnode, &output->paint_node_z_order_list, @@ -3616,6 +3601,31 @@ weston_output_repaint(struct weston_output *output) frame_time_msec = timespec_to_msec(&output->frame_time); + wl_list_init(&frame_callback_list); + wl_list_for_each(pnode, &output->paint_node_z_order_list, + z_order_link) { + /* Note: This operation is safe to do multiple times on the + * same surface. + */ + if (pnode->surface->output == output) { + + /* + * avoid adding pnode's frame callbacks/presented + * feedback to the respective lists if pnode/surface is + * occluded + */ + if (!pixman_region32_not_empty(&pnode->visible)) + continue; + + wl_list_insert_list(&frame_callback_list, + &pnode->surface->frame_callback_list); + wl_list_init(&pnode->surface->frame_callback_list); + + weston_output_take_feedback_list(output, pnode->surface); + } + } + + wl_resource_for_each_safe(cb, cnext, &frame_callback_list) { wl_callback_send_done(cb, frame_time_msec); wl_resource_destroy(cb);