1From f6fbc575e986855e78e9e4c1512c1d60a5ed1232 Mon Sep 17 00:00:00 2001
2From: Jeffy Chen <jeffy.chen@rock-chips.com>
3Date: Mon, 3 Dec 2018 10:40:16 +0800
4Subject: [PATCH 12/93] compositor: Support freezing display
5
6Freeze display when the specified file(from env "WESTON_FREEZE_DISPLAY")
7exists.
8
9For example:
10export WESTON_FREEZE_DISPLAY=/tmp/.freeze
11touch $WESTON_FREEZE_DISPLAY
12weston --tty=2 -Bdrm-backend.so&
13
14Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
15---
16 libweston/compositor.c | 6 ++++++
17 1 file changed, 6 insertions(+)
18
19diff --git a/libweston/compositor.c b/libweston/compositor.c
20index f34c34c..55751a7 100644
21--- a/libweston/compositor.c
22+++ b/libweston/compositor.c
23@@ -3433,6 +3433,11 @@ output_repaint_timer_handler(void *data)
24 	struct timespec now;
25 	int ret = 0;
26
27+	if (!access(getenv("WESTON_FREEZE_DISPLAY") ? : "", F_OK)) {
28+		usleep(DEFAULT_REPAINT_WINDOW * 1000);
29+		goto out;
30+	}
31+
32 	weston_compositor_read_presentation_clock(compositor, &now);
33 	compositor->last_repaint_start = now;
34
35@@ -3467,6 +3472,7 @@ output_repaint_timer_handler(void *data)
36 	wl_list_for_each(output, &compositor->output_list, link)
37 		output->repainted = false;
38
39+out:
40 	output_repaint_timer_arm(compositor);
41
42 	return 0;
43--
442.20.1
45
46