weston: Add config option to enable pixman-based rendering

Emmanuel Gil Peyrot linkmauve at linkmauve.fr
Tue Sep 18 12:43:53 UTC 2018


Hi,

On Wed, Jun 06, 2018 at 04:46:47PM +0200, Thomas Zimmermann wrote:
> Pixman can be used for rendering if the default GLESv2 rendering
> is broken or cannot be used.
> 
> Pixman-based rendering is already available with the command-line
> switch '--use-pixman'. This patch adds support for this option to
> the configuration file. Putting
> 
>   [core]
>   use-pixman=true
> 
> into 'weston.ini' enables pixman-based rendering for all backends
> that support it. With this change, pixman has to be enabled once.

I’ve wanted to use that in the past, this sounds useful as configuration
is now entirely doable in the same place.

> 
> Signed-off-by: Thomas Zimmermann <tdz at users.sourceforge.net>
> ---
>  compositor/main.c  | 39 +++++++++++++++++++++++++++++++++++----
>  man/weston.ini.man |  6 ++++++
>  2 files changed, 41 insertions(+), 4 deletions(-)
> 
> diff --git a/compositor/main.c b/compositor/main.c
> index 1e827884..e7ac52ca 100644
> --- a/compositor/main.c
> +++ b/compositor/main.c
> @@ -1104,18 +1104,26 @@ load_drm_backend(struct weston_compositor *c,
>  	struct weston_config_section *section;
>  	struct wet_compositor *wet = to_wet_compositor(c);
>  	int ret = 0;
> +	int use_pixman_config_ = 0;
> +	int32_t use_pixman_ = 0;

Weston’s coding style doesn’t use underscore suffixes anywhere, and
these two don’t seem to add any semantics.

>  
>  	wet->drm_use_current_mode = false;
>  
> +	section = weston_config_get_section(wc, "core", NULL, NULL);
> +	weston_config_section_get_bool(section, "use-pixman", &use_pixman_config_,
> +				       use_pixman_config_);
> +	use_pixman_ = use_pixman_config_;

Here you can use `false` as the default value, and remove the
`use_pixman_config_` variable altogether.

> +
>  	const struct weston_option options[] = {
>  		{ WESTON_OPTION_STRING, "seat", 0, &config.seat_id },
>  		{ WESTON_OPTION_INTEGER, "tty", 0, &config.tty },
>  		{ WESTON_OPTION_STRING, "drm-device", 0, &config.specific_device },
>  		{ WESTON_OPTION_BOOLEAN, "current-mode", 0, &wet->drm_use_current_mode },
> -		{ WESTON_OPTION_BOOLEAN, "use-pixman", 0, &config.use_pixman },
> +		{ WESTON_OPTION_BOOLEAN, "use-pixman", 0, &use_pixman_ },
>  	};
>  
>  	parse_options(options, ARRAY_LENGTH(options), argc, argv);
> +	config.use_pixman = use_pixman_;

Actually you can even remove both local variables and use
`config.use_pixman` everywhere, also make it a bool.

>  
>  	section = weston_config_get_section(wc, "core", NULL, NULL);
>  	weston_config_section_get_string(section,
[snip]

Same for the other parts of this file.

> diff --git a/man/weston.ini.man b/man/weston.ini.man
> index f237fd60..cc1cb409 100644
> --- a/man/weston.ini.man
> +++ b/man/weston.ini.man
> @@ -189,6 +189,12 @@ useful for debugging a crash on start-up when it would be inconvenient to
>  launch weston directly from a debugger. Boolean, defaults to
>  .BR false .
>  There is also a command line option to do the same.
> +.TP 7
> +.BI "use-pixman=" true
> +Enables pixman-based rendering for all outputs on backends that support it.
> +Boolean, defaults to
> +.BR false .
> +There is also a command line option to do the same.
>  
>  .SH "LIBINPUT SECTION"
>  The
> -- 
> 2.14.4

Otherwise, LGTM!

Please open a merge request on Freedesktop’s GitLab[1] instead for the
v2 of these patches, the mailing list isn’t used for patches or reviews
anymore.

[1] https://gitlab.freedesktop.org/wayland/weston

-- 
Emmanuel Gil Peyrot


More information about the wayland-devel mailing list