From 8a30e7617e82e9f9318e1072fbc9ed4db9770b23 Mon Sep 17 00:00:00 2001 From: Jeffy Chen Date: Wed, 1 Jun 2022 11:28:24 +0800 Subject: [PATCH 67/70] 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 1970bf0b5..e3a774f94 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -3994,18 +3994,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.view) return; shell_output->fade.animation = NULL; + switch (shell_output->fade.type) { case FADE_IN: weston_surface_destroy(shell_output->fade.view->surface); shell_output->fade.view = NULL; break; case FADE_OUT: - lock(shell); + if (!compositor->pending_fade_out) + lock(shell); break; default: break; @@ -4084,6 +4090,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.view, 1.0 - tint, tint, 300.0, @@ -4831,6 +4840,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.view) { diff --git a/include/libweston/libweston.h b/include/libweston/libweston.h index 4e8bfecf3..74dec9d46 100644 --- a/include/libweston/libweston.h +++ b/include/libweston/libweston.h @@ -1207,6 +1207,7 @@ struct weston_compositor { struct weston_output *prefer_output; bool warm_up; + uint32_t pending_fade_out; }; struct weston_buffer { -- 2.20.1