From 8a29ad8dd5346fd8956b228740c66ed71beb9052 Mon Sep 17 00:00:00 2001
|
From: Jeffy Chen <jeffy.chen@rock-chips.com>
|
Date: Fri, 3 Jul 2020 10:20:40 +0800
|
Subject: [PATCH 24/74] Support holding display for the first app
|
|
Use '-w' or '--warm-up' to enable it.
|
|
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
|
---
|
compositor/main.c | 5 +++++
|
include/libweston/libweston.h | 2 ++
|
libweston/compositor.c | 30 ++++++++++++++++++++++++++++++
|
3 files changed, 37 insertions(+)
|
|
diff --git a/compositor/main.c b/compositor/main.c
|
index a4f679a..128016b 100644
|
--- a/compositor/main.c
|
+++ b/compositor/main.c
|
@@ -679,6 +679,7 @@ usage(int error_code)
|
" -f, --flight-rec-scopes=SCOPE\n\t\t\tSpecify log scopes to "
|
"subscribe to.\n\t\t\tCan specify multiple scopes, "
|
"each followed by comma\n"
|
+ " -w, --warm-up\t\tHold display for the first app\n"
|
" -h, --help\t\tThis help message\n\n");
|
|
#if defined(BUILD_DRM_COMPOSITOR)
|
@@ -3336,6 +3337,8 @@ wet_main(int argc, char *argv[], const struct weston_testsuite_data *test_data)
|
bool wait_for_debugger = false;
|
struct wl_protocol_logger *protologger = NULL;
|
|
+ bool warm_up = false;
|
+
|
const struct weston_option core_options[] = {
|
{ WESTON_OPTION_STRING, "backend", 'B', &backend },
|
{ WESTON_OPTION_STRING, "shell", 0, &shell },
|
@@ -3354,6 +3357,7 @@ wet_main(int argc, char *argv[], const struct weston_testsuite_data *test_data)
|
{ WESTON_OPTION_BOOLEAN, "debug", 0, &debug_protocol },
|
{ WESTON_OPTION_STRING, "logger-scopes", 'l', &log_scopes },
|
{ WESTON_OPTION_STRING, "flight-rec-scopes", 'f', &flight_rec_scopes },
|
+ { WESTON_OPTION_BOOLEAN, "warm-up", 'w', &warm_up },
|
};
|
|
wl_list_init(&wet.layoutput_list);
|
@@ -3528,6 +3532,7 @@ wet_main(int argc, char *argv[], const struct weston_testsuite_data *test_data)
|
wet.compositor->idle_time = idle_time;
|
wet.compositor->default_pointer_grab = NULL;
|
wet.compositor->exit = handle_exit;
|
+ wet.compositor->warm_up = warm_up;
|
|
weston_compositor_log_capabilities(wet.compositor);
|
|
diff --git a/include/libweston/libweston.h b/include/libweston/libweston.h
|
index 7bc01e3..4e8bfec 100644
|
--- a/include/libweston/libweston.h
|
+++ b/include/libweston/libweston.h
|
@@ -1205,6 +1205,8 @@ struct weston_compositor {
|
|
enum weston_output_flow output_flow;
|
struct weston_output *prefer_output;
|
+
|
+ bool warm_up;
|
};
|
|
struct weston_buffer {
|
diff --git a/libweston/compositor.c b/libweston/compositor.c
|
index 02d1fa1..121871c 100644
|
--- a/libweston/compositor.c
|
+++ b/libweston/compositor.c
|
@@ -176,6 +176,24 @@ weston_compositor_is_static_layer(struct weston_layer *layer)
|
}
|
}
|
|
+static bool
|
+weston_compositor_is_system_layer(struct weston_layer *layer)
|
+{
|
+ if (!layer)
|
+ return false;
|
+
|
+ switch (layer->position) {
|
+ case WESTON_LAYER_POSITION_BACKGROUND:
|
+ case WESTON_LAYER_POSITION_UI:
|
+ case WESTON_LAYER_POSITION_LOCK:
|
+ case WESTON_LAYER_POSITION_CURSOR:
|
+ case WESTON_LAYER_POSITION_FADE:
|
+ return true;
|
+ default:
|
+ return false;
|
+ }
|
+}
|
+
|
/** Send wl_output events for mode and scale changes
|
*
|
* \param head Send on all resources bound to this head.
|
@@ -2879,7 +2897,14 @@ weston_compositor_build_view_list(struct weston_compositor *compositor,
|
wl_list_init(&compositor->view_list);
|
|
wl_list_for_each(layer, &compositor->layer_list, link) {
|
+ bool system_layer = weston_compositor_is_system_layer(layer);
|
+
|
wl_list_for_each(view, &layer->view_list.link, layer_link.link) {
|
+ if (compositor->warm_up && !system_layer) {
|
+ weston_log("seeing the first app\n");
|
+ compositor->warm_up = false;
|
+ }
|
+
|
view_list_add(compositor, view, output);
|
}
|
}
|
@@ -2935,6 +2960,11 @@ weston_output_repaint(struct weston_output *output, void *repaint_data)
|
/* Rebuild the surface list and update surface transforms up front. */
|
weston_compositor_build_view_list(ec, output);
|
|
+ if (ec->warm_up) {
|
+ weston_log("holding display for the first app...\n");
|
+ return -1;
|
+ }
|
+
|
/* Find the highest protection desired for an output */
|
wl_list_for_each(pnode, &output->paint_node_z_order_list,
|
z_order_link) {
|
--
|
2.20.1
|