Discussion:
weston: Add config option to enable pixman-based rendering
Thomas Zimmermann
2018-06-06 14:46:47 UTC
Permalink
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.

Signed-off-by: Thomas Zimmermann <***@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;

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

section = weston_config_get_section(wc, "core", NULL, NULL);
weston_config_section_get_string(section,
@@ -1160,23 +1168,32 @@ load_headless_backend(struct weston_compositor *c,
{
const struct weston_windowed_output_api *api;
struct weston_headless_backend_config config = {{ 0, }};
+ struct weston_config_section *section;
int no_outputs = 0;
int ret = 0;
char *transform = NULL;
+ int32_t use_pixman_config_ = 0;
+ int use_pixman_ = 0;

struct wet_output_config *parsed_options = wet_init_parsed_options(c);
if (!parsed_options)
return -1;

+ 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_;
+
const struct weston_option options[] = {
{ WESTON_OPTION_INTEGER, "width", 0, &parsed_options->width },
{ WESTON_OPTION_INTEGER, "height", 0, &parsed_options->height },
- { WESTON_OPTION_BOOLEAN, "use-pixman", 0, &config.use_pixman },
+ { WESTON_OPTION_BOOLEAN, "use-pixman", 0, &use_pixman_ },
{ WESTON_OPTION_STRING, "transform", 0, &transform },
{ WESTON_OPTION_BOOLEAN, "no-outputs", 0, &no_outputs },
};

parse_options(options, ARRAY_LENGTH(options), argc, argv);
+ config.use_pixman = use_pixman_;

if (transform) {
if (weston_parse_transform(transform, &parsed_options->transform) < 0) {
@@ -1385,11 +1402,18 @@ load_x11_backend(struct weston_compositor *c,
int output_count = 0;
char const *section_name;
int i;
+ int32_t use_pixman_config_ = 0;
+ int use_pixman_ = 0;

struct wet_output_config *parsed_options = wet_init_parsed_options(c);
if (!parsed_options)
return -1;

+ 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_;
+
const struct weston_option options[] = {
{ WESTON_OPTION_INTEGER, "width", 0, &parsed_options->width },
{ WESTON_OPTION_INTEGER, "height", 0, &parsed_options->height },
@@ -1397,10 +1421,11 @@ load_x11_backend(struct weston_compositor *c,
{ WESTON_OPTION_BOOLEAN, "fullscreen", 'f', &config.fullscreen },
{ WESTON_OPTION_INTEGER, "output-count", 0, &option_count },
{ WESTON_OPTION_BOOLEAN, "no-input", 0, &config.no_input },
- { 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_;

config.base.struct_version = WESTON_X11_BACKEND_CONFIG_VERSION;
config.base.struct_size = sizeof(struct weston_x11_backend_config);
@@ -1503,6 +1528,7 @@ load_wayland_backend(struct weston_compositor *c,
int32_t use_pixman_ = 0;
int32_t sprawl_ = 0;
int32_t fullscreen_ = 0;
+ int use_pixman_config_ = 0;

struct wet_output_config *parsed_options = wet_init_parsed_options(c);
if (!parsed_options)
@@ -1512,6 +1538,11 @@ load_wayland_backend(struct weston_compositor *c,
config.cursor_theme = NULL;
config.display_name = NULL;

+ 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_;
+
const struct weston_option wayland_options[] = {
{ WESTON_OPTION_INTEGER, "width", 0, &parsed_options->width },
{ WESTON_OPTION_INTEGER, "height", 0, &parsed_options->height },
@@ -1525,8 +1556,8 @@ load_wayland_backend(struct weston_compositor *c,

parse_options(wayland_options, ARRAY_LENGTH(wayland_options), argc, argv);
config.sprawl = sprawl_;
- config.use_pixman = use_pixman_;
config.fullscreen = fullscreen_;
+ config.use_pixman = use_pixman_config_;

section = weston_config_get_section(wc, "shell", NULL, NULL);
weston_config_section_get_string(section, "cursor-theme",
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
Emmanuel Gil Peyrot
2018-09-18 12:43:53 UTC
Permalink
Hi,
Post by Thomas Zimmermann
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.
Post by Thomas Zimmermann
---
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.
Post by Thomas Zimmermann
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.
Post by Thomas Zimmermann
+
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.
Post by Thomas Zimmermann
section = weston_config_get_section(wc, "core", NULL, NULL);
weston_config_section_get_string(section,
[snip]

Same for the other parts of this file.
Post by Thomas Zimmermann
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
Thomas Zimmermann
2018-09-21 13:03:04 UTC
Permalink
Hi,

thank you for the review. The MR is pending at [1]. but it's basically
the same code as posted here. Please see my comments below.
Post by Thomas Zimmermann
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.
This code uses the same style as load_wayland_backend(). I don't mind
removing the underscore; just saying.
Post by Thomas Zimmermann
+ 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.
Post by Thomas Zimmermann
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.
That's not possible. weston_config_section_get_bool() expects a pointer
to an `int` as its third argument. parse_options() expects a pointer to
an `int32_t` for WESTON_OPTION_BOOLEAN.

Both should certainly be replaced by a `bool` or at least harmonized,
but that seems worth a separate patch set.

Best regards
Thomas

[1] https://gitlab.freedesktop.org/wayland/weston/merge_requests/21
Post by Thomas Zimmermann
section = weston_config_get_section(wc, "core", NULL, NULL);
weston_config_section_get_string(section,
[snip]
Same for the other parts of this file.
Post by Thomas Zimmermann
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
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Linux GmbH, Maxfeldstr. 5, D-90409 NÃŒrnberg
Tel: +49-911-74053-0; Fax: +49-911-7417755; https://www.suse.com/
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard,
Graham Norton, HRB 21284 (AG NÃŒrnberg)
Loading...