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

Pekka Paalanen ppaalanen at gmail.com
Mon Jul 24 11:59:50 UTC 2017


On Wed, 8 Mar 2017 15:43:17 +0000
"Ucan, Emre (ADITG/SW1)" <eucan at de.adit-jv.com> wrote:

> 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.

Hi,

require-output-config=true sounds like it would trigger an error if
there actually is no "output-config".

I would suggest the following:
output-default={enable,disable}

That could be taken even further if we want to set more defaults for
enabled outputs:

[output]
name=default
...

Where "default" would be a special output name that matches if no
specific name matches. It would allow arbitrary default configuration.
Would it be useful, I'm not sure, but I would like it.

> 
> 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;

Quentin is right, this does not belong here.

> +
>  };
>  
>  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

Very good to remember the man-page and the example config.


Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20170724/9c17374e/attachment.sig>


More information about the wayland-devel mailing list