[PATCH weston 1/2] Add option to disable unconfigured outputs

Ucan, Emre (ADITG/SW1) eucan at de.adit-jv.com
Wed Mar 8 15:43:17 UTC 2017


In current implementation, there is no configuration
to disable unconfigured outputs.

One can create an output section for a known output
in weston.ini file and set its mode to "off" to disable
a known output. But there is no configuration to disable
unknown outputs.

This might be usefull for example, if someone wants to
enable just one output and disable all others. Without
this option, we have to right down an output section for
every output known to system and disable all outputs,
which we do not want to enable.

It might be usefull also for startup time optimization,
because some display types (e.g. LVDS and VGA) are always
up. Therefore, weston would modeset every one of them.
Even there are no attached displays.

This introduces a simple configuration in weston.ini:
  [core]
  require-output-config=false

False is the default, so no behavioral change is introduced.

Signed-off-by: Emre Ucan <eucan at de.adit-jv.com>
---
 compositor/main.c      |    8 +++++++-
 libweston/compositor.h |    3 +++
 man/weston.ini.man     |    4 ++++
 weston.ini.in          |    1 +
 4 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/compositor/main.c b/compositor/main.c
index e870dd4..92f8741 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -1174,7 +1174,8 @@ drm_backend_output_configure(struct wl_listener *listener, void *data)
 	section = weston_config_get_section(wc, "output", "name", output->name);
 	weston_config_section_get_string(section, "mode", &s, "preferred");
 
-	if (strcmp(s, "off") == 0) {
+	if ((!section && output->compositor->require_output_config) ||
+	    (strcmp(s, "off") == 0)) {
 		weston_output_disable(output);
 		free(s);
 		return;
@@ -1785,6 +1786,7 @@ int main(int argc, char *argv[])
 	struct weston_seat *seat;
 	struct wet_compositor user_data;
 	int require_input;
+	int require_output_config;
 
 	const struct weston_option core_options[] = {
 		{ WESTON_OPTION_STRING, "backend", 'B', &backend },
@@ -1874,6 +1876,10 @@ int main(int argc, char *argv[])
 				       &require_input, true);
 	ec->require_input = require_input;
 
+	weston_config_section_get_bool(section, "require-output-config",
+				       &require_output_config, false);
+	ec->require_output_config = require_output_config;
+
 	if (load_backend(ec, backend, &argc, argv, config) < 0) {
 		weston_log("fatal: failed to create compositor backend\n");
 		goto out;
diff --git a/libweston/compositor.h b/libweston/compositor.h
index 08e728a..a7abd35 100644
--- a/libweston/compositor.h
+++ b/libweston/compositor.h
@@ -891,6 +891,9 @@ struct weston_compositor {
 	/* Whether to let the compositor run without any input device. */
 	bool require_input;
 
+	/* Whether to disable unconfigured outputs */
+	bool require_output_config;
+
 };
 
 struct weston_buffer {
diff --git a/man/weston.ini.man b/man/weston.ini.man
index 5ec0e1d..90e1c55 100644
--- a/man/weston.ini.man
+++ b/man/weston.ini.man
@@ -181,6 +181,10 @@ set to 300 seconds.
 .TP 7
 .BI "require-input=" true
 require an input device for launch
+.TP 7
+.BI "require-output-config=" false
+require an output section for every created output. If there is no section
+for an output, compositor disables the output.
 
 .SH "LIBINPUT SECTION"
 The
diff --git a/weston.ini.in b/weston.ini.in
index 257c4ec..fba893d 100644
--- a/weston.ini.in
+++ b/weston.ini.in
@@ -4,6 +4,7 @@
 #shell=desktop-shell.so
 #gbm-format=xrgb2101010
 #require-input=true
+#require-output-config=false
 
 [shell]
 background-image=/usr/share/backgrounds/gnome/Aqua.jpg
-- 
1.7.9.5



More information about the wayland-devel mailing list