1From f938f8c7d225535ad41058e38b699cb712a3eb03 Mon Sep 17 00:00:00 2001 2From: Jeffy Chen <jeffy.chen@rock-chips.com> 3Date: Wed, 1 Jun 2022 11:28:24 +0800 4Subject: [PATCH 66/79] desktop-shell: Delay locking when having pending 5 fade-out animations 6 7Avoid "unexpectedly large timestamp jump" warning when resuming with 8multi-head. 9 10Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com> 11--- 12 desktop-shell/shell.c | 14 +++++++++++++- 13 include/libweston/libweston.h | 1 + 14 2 files changed, 14 insertions(+), 1 deletion(-) 15 16diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c 17index 0643418..eca22c6 100644 18--- a/desktop-shell/shell.c 19+++ b/desktop-shell/shell.c 20@@ -4018,18 +4018,24 @@ shell_fade_done_for_output(struct weston_view_animation *animation, void *data) 21 { 22 struct shell_output *shell_output = data; 23 struct desktop_shell *shell = shell_output->shell; 24+ struct weston_compositor *compositor = shell->compositor; 25+ 26+ if (shell_output->fade.type == FADE_OUT) 27+ shell->compositor->pending_fade_out --; 28 29 if (!shell_output->fade.view) 30 return; 31 32 shell_output->fade.animation = NULL; 33+ 34 switch (shell_output->fade.type) { 35 case FADE_IN: 36 weston_surface_destroy(shell_output->fade.view->surface); 37 shell_output->fade.view = NULL; 38 break; 39 case FADE_OUT: 40- lock(shell); 41+ if (!compositor->pending_fade_out) 42+ lock(shell); 43 break; 44 default: 45 break; 46@@ -4131,6 +4137,9 @@ shell_fade(struct desktop_shell *shell, enum fade_type type) 47 } else if (shell_output->fade.animation) { 48 weston_fade_update(shell_output->fade.animation, tint); 49 } else { 50+ if (type == FADE_OUT) 51+ shell->compositor->pending_fade_out ++; 52+ 53 shell_output->fade.animation = 54 weston_fade_run(shell_output->fade.view, 55 1.0 - tint, tint, 300.0, 56@@ -4878,6 +4887,9 @@ shell_output_destroy(struct shell_output *shell_output) 57 if (shell_output->fade.animation) { 58 weston_view_animation_destroy(shell_output->fade.animation); 59 shell_output->fade.animation = NULL; 60+ 61+ if (shell_output->fade.type == FADE_OUT) 62+ shell->compositor->pending_fade_out --; 63 } 64 65 if (shell_output->fade.view) { 66diff --git a/include/libweston/libweston.h b/include/libweston/libweston.h 67index 4e8bfec..74dec9d 100644 68--- a/include/libweston/libweston.h 69+++ b/include/libweston/libweston.h 70@@ -1207,6 +1207,7 @@ struct weston_compositor { 71 struct weston_output *prefer_output; 72 73 bool warm_up; 74+ uint32_t pending_fade_out; 75 }; 76 77 struct weston_buffer { 78-- 792.20.1 80 81