124 lines
4.0 KiB
Diff
124 lines
4.0 KiB
Diff
From 1c0baf5e1507fbccab3bd3e523ae61df461d7bfc 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 27/93] 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 d65f8aa..987c8f9 100644
|
|
--- a/compositor/main.c
|
|
+++ b/compositor/main.c
|
|
@@ -677,6 +677,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)
|
|
@@ -3581,6 +3582,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 },
|
|
@@ -3599,6 +3602,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);
|
|
@@ -3785,6 +3789,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 a41ffba..bf8e20a 100644
|
|
--- a/include/libweston/libweston.h
|
|
+++ b/include/libweston/libweston.h
|
|
@@ -1340,6 +1340,8 @@ struct weston_compositor {
|
|
|
|
enum weston_output_flow output_flow;
|
|
struct weston_output *prefer_output;
|
|
+
|
|
+ bool warm_up;
|
|
};
|
|
|
|
struct weston_solid_buffer_values {
|
|
diff --git a/libweston/compositor.c b/libweston/compositor.c
|
|
index 3da5f18..8ca0c27 100644
|
|
--- a/libweston/compositor.c
|
|
+++ b/libweston/compositor.c
|
|
@@ -179,6 +179,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.
|
|
@@ -3234,7 +3252,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);
|
|
}
|
|
}
|
|
@@ -3290,6 +3315,11 @@ weston_output_repaint(struct weston_output *output)
|
|
/* 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
|
|
|