From 47e00856e232703dd1da6115d8073891fe79741d Mon Sep 17 00:00:00 2001 From: Jeffy Chen Date: Wed, 1 Jun 2022 11:28:24 +0800 Subject: [PATCH 67/92] desktop-shell: Delay locking when having pending fade-out animations Avoid "unexpectedly large timestamp jump" warning when resuming with multi-head. Signed-off-by: Jeffy Chen --- desktop-shell/shell.c | 14 +++++++++++++- include/libweston/libweston.h | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index ff85ff7..2e88b99 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -3580,18 +3580,24 @@ shell_fade_done_for_output(struct weston_view_animation *animation, void *data) { struct shell_output *shell_output = data; struct desktop_shell *shell = shell_output->shell; + struct weston_compositor *compositor = shell->compositor; + + if (shell_output->fade.type == FADE_OUT) + shell->compositor->pending_fade_out --; if (!shell_output->fade.curtain) return; shell_output->fade.animation = NULL; + switch (shell_output->fade.type) { case FADE_IN: weston_curtain_destroy(shell_output->fade.curtain); shell_output->fade.curtain = NULL; break; case FADE_OUT: - lock(shell); + if (!compositor->pending_fade_out) + lock(shell); break; default: break; @@ -3705,6 +3711,9 @@ shell_fade(struct desktop_shell *shell, enum fade_type type) } else if (shell_output->fade.animation) { weston_fade_update(shell_output->fade.animation, tint); } else { + if (type == FADE_OUT) + shell->compositor->pending_fade_out ++; + shell_output->fade.animation = weston_fade_run(shell_output->fade.curtain->view, 1.0 - tint, tint, 300.0, @@ -4371,6 +4380,9 @@ shell_output_destroy(struct shell_output *shell_output) if (shell_output->fade.animation) { weston_view_animation_destroy(shell_output->fade.animation); shell_output->fade.animation = NULL; + + if (shell_output->fade.type == FADE_OUT) + shell->compositor->pending_fade_out --; } if (shell_output->fade.curtain) { diff --git a/include/libweston/libweston.h b/include/libweston/libweston.h index bf8e20a..9d9c5c6 100644 --- a/include/libweston/libweston.h +++ b/include/libweston/libweston.h @@ -1342,6 +1342,7 @@ struct weston_compositor { struct weston_output *prefer_output; bool warm_up; + uint32_t pending_fade_out; }; struct weston_solid_buffer_values { -- 2.20.1